2023-05-04 22:37:54 +00:00
|
|
|
|
/-! # Bookshelf.Combinator.Aviary
|
|
|
|
|
|
|
|
|
|
A collection of combinator birds representable in Lean. Certain duplicators,
|
|
|
|
|
e.g. mockingbirds, are not directly expressible since they would require
|
|
|
|
|
encoding a signature in which an argument has types `α` *and* `α → α`.
|
|
|
|
|
|
|
|
|
|
Duplicators that are included, e.g. the warbler, are not exactly correct
|
|
|
|
|
considering they still have the same limitation described above during actual
|
|
|
|
|
use. Their inclusion here serves more as pseudo-documentation than anything.
|
|
|
|
|
|
|
|
|
|
[^1]: Smullyan, Raymond M. To Mock a Mockingbird: And Other Logic Puzzles
|
|
|
|
|
Including an Amazing Adventure in Combinatory Logic. Oxford: Oxford
|
|
|
|
|
university press, 2000.
|
|
|
|
|
-/
|
|
|
|
|
|
2023-05-07 16:40:20 +00:00
|
|
|
|
/-- #### Bald Eagle
|
2023-04-21 20:17:52 +00:00
|
|
|
|
|
|
|
|
|
`E'xy₁y₂y₃z₁z₂z₃ = x(y₁y₂y₃)(z₁z₂z₃)`
|
|
|
|
|
-/
|
|
|
|
|
def E' (x : α → β → γ)
|
|
|
|
|
(y₁ : δ → ε → α) (y₂ : δ) (y₃ : ε)
|
|
|
|
|
(z₁ : ζ → η → β) (z₂ : ζ) (z₃ : η) := x (y₁ y₂ y₃) (z₁ z₂ z₃)
|
|
|
|
|
|
2023-05-07 16:40:20 +00:00
|
|
|
|
/-- #### Becard
|
2023-04-21 20:17:52 +00:00
|
|
|
|
|
|
|
|
|
`B₃xyzw = x(y(zw))`
|
|
|
|
|
-/
|
|
|
|
|
def B₃ (x : α → ε) (y : β → α) (z : γ → β) (w : γ) := x (y (z w))
|
|
|
|
|
|
2023-05-07 16:40:20 +00:00
|
|
|
|
/-- #### Blackbird
|
2023-04-21 20:17:52 +00:00
|
|
|
|
|
|
|
|
|
`B₁xyzw = x(yzw)`
|
|
|
|
|
-/
|
|
|
|
|
def B₁ (x : α → ε) (y : β → γ → α) (z : β) (w : γ) := x (y z w)
|
|
|
|
|
|
2023-05-07 16:40:20 +00:00
|
|
|
|
/-- #### Bluebird
|
2023-04-21 20:17:52 +00:00
|
|
|
|
|
|
|
|
|
`Bxyz = x(yz)`
|
|
|
|
|
-/
|
|
|
|
|
def B (x : α → γ) (y : β → α) (z : β) := x (y z)
|
|
|
|
|
|
2023-05-07 16:40:20 +00:00
|
|
|
|
/-- #### Bunting
|
2023-04-21 20:17:52 +00:00
|
|
|
|
|
|
|
|
|
`B₂xyzwv = x(yzwv)`
|
|
|
|
|
-/
|
|
|
|
|
def B₂ (x : α → ζ) (y : β → γ → ε → α) (z : β) (w : γ) (v : ε) := x (y z w v)
|
|
|
|
|
|
2023-05-07 16:40:20 +00:00
|
|
|
|
/-- #### Cardinal Once Removed
|
2023-04-21 20:17:52 +00:00
|
|
|
|
|
|
|
|
|
`C*xyzw = xywz`
|
|
|
|
|
-/
|
|
|
|
|
def C_star (x : α → β → γ → δ) (y : α) (z : γ) (w : β) := x y w z
|
|
|
|
|
|
|
|
|
|
notation "C*" => C_star
|
|
|
|
|
|
2023-05-07 16:40:20 +00:00
|
|
|
|
/-- #### Cardinal
|
2023-04-21 20:17:52 +00:00
|
|
|
|
|
|
|
|
|
`Cxyz = xzy`
|
|
|
|
|
-/
|
|
|
|
|
def C (x : α → β → δ) (y : β) (z : α) := x z y
|
|
|
|
|
|
2023-05-07 16:40:20 +00:00
|
|
|
|
/-- #### Converse Warbler
|
2023-05-02 16:34:47 +00:00
|
|
|
|
|
|
|
|
|
`W'xy = yxx`
|
|
|
|
|
-/
|
|
|
|
|
def W' (x : α) (y : α → α → β) := y x x
|
|
|
|
|
|
2023-05-07 16:40:20 +00:00
|
|
|
|
/-- #### Dickcissel
|
2023-04-21 20:17:52 +00:00
|
|
|
|
|
|
|
|
|
`D₁xyzwv = xyz(wv)`
|
|
|
|
|
-/
|
|
|
|
|
def D₁ (x : α → β → δ → ε) (y : α) (z : β) (w : γ → δ) (v : γ) := x y z (w v)
|
|
|
|
|
|
2023-05-07 16:40:20 +00:00
|
|
|
|
/-! #### Double Mockingbird
|
|
|
|
|
|
|
|
|
|
`M₂xy = xy(xy)`
|
|
|
|
|
-/
|
|
|
|
|
|
|
|
|
|
/-- #### Dove
|
2023-04-21 20:17:52 +00:00
|
|
|
|
|
|
|
|
|
`Dxyzw = xy(zw)`
|
|
|
|
|
-/
|
|
|
|
|
def D (x : α → γ → δ) (y : α) (z : β → γ) (w : β) := x y (z w)
|
|
|
|
|
|
2023-05-07 16:40:20 +00:00
|
|
|
|
/-- #### Dovekie
|
2023-04-21 20:17:52 +00:00
|
|
|
|
|
|
|
|
|
`D₂xyzwv = x(yz)(wv)`
|
|
|
|
|
-/
|
|
|
|
|
def D₂ (x : α → δ → ε) (y : β → α) (z : β) (w : γ → δ) (v : γ) := x (y z) (w v)
|
|
|
|
|
|
2023-05-07 16:40:20 +00:00
|
|
|
|
/-- #### Eagle
|
2023-04-21 20:17:52 +00:00
|
|
|
|
|
|
|
|
|
`Exyzwv = xy(zwv)`
|
|
|
|
|
-/
|
|
|
|
|
def E (x : α → δ → ε) (y : α) (z : β → γ → δ) (w : β) (v : γ) := x y (z w v)
|
|
|
|
|
|
2023-05-07 16:40:20 +00:00
|
|
|
|
/-- #### Finch Once Removed
|
2023-04-21 20:17:52 +00:00
|
|
|
|
|
|
|
|
|
`F*xyzw = xwzy`
|
|
|
|
|
-/
|
|
|
|
|
def F_star (x : α → β → γ → δ) (y : γ) (z : β) (w : α) := x w z y
|
|
|
|
|
|
|
|
|
|
notation "F*" => F_star
|
|
|
|
|
|
2023-05-07 16:40:20 +00:00
|
|
|
|
/-- #### Finch
|
2023-04-21 20:17:52 +00:00
|
|
|
|
|
|
|
|
|
`Fxyz = zyx`
|
|
|
|
|
-/
|
|
|
|
|
def F (x : α) (y : β) (z : β → α → γ) := z y x
|
|
|
|
|
|
2023-05-07 16:40:20 +00:00
|
|
|
|
/-- #### Goldfinch
|
2023-04-21 20:17:52 +00:00
|
|
|
|
|
|
|
|
|
`Gxyzw = xw(yz)`
|
|
|
|
|
-/
|
|
|
|
|
def G (x : α → γ → δ) (y : β → γ) (z : β) (w : α) := x w (y z)
|
|
|
|
|
|
2023-05-07 16:40:20 +00:00
|
|
|
|
/-- #### Hummingbird
|
2023-04-21 20:17:52 +00:00
|
|
|
|
|
|
|
|
|
`Hxyz = xyzy`
|
|
|
|
|
-/
|
|
|
|
|
def H (x : α → β → α → γ) (y : α) (z : β) := x y z y
|
|
|
|
|
|
2023-05-07 16:40:20 +00:00
|
|
|
|
/-- #### Identity Bird
|
2023-04-21 20:17:52 +00:00
|
|
|
|
|
|
|
|
|
`Ix = x`
|
|
|
|
|
-/
|
|
|
|
|
def I (x : α) : α := x
|
|
|
|
|
|
2023-05-07 16:40:20 +00:00
|
|
|
|
/-- #### Kestrel
|
2023-04-21 20:17:52 +00:00
|
|
|
|
|
|
|
|
|
`Kxy = x`
|
|
|
|
|
-/
|
|
|
|
|
def K (x : α) (_ : β) := x
|
|
|
|
|
|
2023-05-07 16:40:20 +00:00
|
|
|
|
/-! #### Lark
|
|
|
|
|
|
|
|
|
|
`Lxy = x(yy)`
|
|
|
|
|
-/
|
|
|
|
|
|
|
|
|
|
/-! #### Mockingbird
|
|
|
|
|
|
|
|
|
|
`Mx = xx`
|
|
|
|
|
-/
|
|
|
|
|
|
|
|
|
|
/-- #### Owl
|
2023-04-21 20:17:52 +00:00
|
|
|
|
|
|
|
|
|
`Oxy = y(xy)`
|
|
|
|
|
-/
|
|
|
|
|
def O (x : (α → β) → α) (y : α → β) := y (x y)
|
|
|
|
|
|
2023-05-07 16:40:20 +00:00
|
|
|
|
/-- #### Phoenix
|
2023-04-21 20:17:52 +00:00
|
|
|
|
|
|
|
|
|
`Φxyzw = x(yw)(zw)`
|
|
|
|
|
-/
|
|
|
|
|
def Φ (x : β → γ → δ) (y : α → β) (z : α → γ) (w : α) := x (y w) (z w)
|
|
|
|
|
|
2023-05-07 16:40:20 +00:00
|
|
|
|
/-- #### Psi Bird
|
2023-04-21 20:17:52 +00:00
|
|
|
|
|
|
|
|
|
`Ψxyzw = x(yz)(yw)`
|
|
|
|
|
-/
|
|
|
|
|
def Ψ (x : α → α → γ) (y : β → α) (z : β) (w : β) := x (y z) (y w)
|
|
|
|
|
|
2023-05-07 16:40:20 +00:00
|
|
|
|
/-- #### Quacky Bird
|
2023-04-21 20:17:52 +00:00
|
|
|
|
|
|
|
|
|
`Q₄xyz = z(yx)`
|
|
|
|
|
-/
|
|
|
|
|
def Q₄ (x : α) (y : α → β) (z : β → γ) := z (y x)
|
|
|
|
|
|
2023-05-07 16:40:20 +00:00
|
|
|
|
/-- #### Queer Bird
|
2023-04-21 20:17:52 +00:00
|
|
|
|
|
|
|
|
|
`Qxyz = y(xz)`
|
|
|
|
|
-/
|
|
|
|
|
def Q (x : α → β) (y : β → γ) (z : α) := y (x z)
|
|
|
|
|
|
2023-05-07 16:40:20 +00:00
|
|
|
|
/-- #### Quirky Bird
|
2023-04-21 20:17:52 +00:00
|
|
|
|
|
|
|
|
|
`Q₃xyz = z(xy)`
|
|
|
|
|
-/
|
|
|
|
|
def Q₃ (x : α → β) (y : α) (z : β → γ) := z (x y)
|
|
|
|
|
|
2023-05-07 16:40:20 +00:00
|
|
|
|
/-- #### Quixotic Bird
|
2023-04-21 20:17:52 +00:00
|
|
|
|
|
|
|
|
|
`Q₁xyz = x(zy)`
|
|
|
|
|
-/
|
|
|
|
|
def Q₁ (x : α → γ) (y : β) (z : β → α) := x (z y)
|
|
|
|
|
|
2023-05-07 16:40:20 +00:00
|
|
|
|
/-- #### Quizzical Bird
|
2023-04-21 20:17:52 +00:00
|
|
|
|
|
|
|
|
|
`Q₂xyz = y(zx)`
|
|
|
|
|
-/
|
|
|
|
|
def Q₂ (x : α) (y : β → γ) (z : α → β) := y (z x)
|
|
|
|
|
|
2023-05-07 16:40:20 +00:00
|
|
|
|
/-- #### Robin Once Removed
|
2023-04-21 20:17:52 +00:00
|
|
|
|
|
|
|
|
|
`R*xyzw = xzwy`
|
|
|
|
|
-/
|
|
|
|
|
def R_star (x : α → β → γ → δ) (y : γ) (z : α) (w : β) := x z w y
|
|
|
|
|
|
|
|
|
|
notation "R*" => R_star
|
|
|
|
|
|
2023-05-07 16:40:20 +00:00
|
|
|
|
/-- #### Robin
|
2023-04-21 20:17:52 +00:00
|
|
|
|
|
|
|
|
|
`Rxyz = yzx`
|
|
|
|
|
-/
|
|
|
|
|
def R (x : α) (y : β → α → γ) (z : β) := y z x
|
|
|
|
|
|
2023-05-07 16:40:20 +00:00
|
|
|
|
/-- #### Sage Bird
|
2023-05-02 16:34:47 +00:00
|
|
|
|
|
|
|
|
|
`Θx = x(Θx)`
|
|
|
|
|
-/
|
|
|
|
|
partial def Θ [Inhabited α] (x : α → α) := x (Θ x)
|
|
|
|
|
|
2023-05-07 16:40:20 +00:00
|
|
|
|
/-- #### Starling
|
2023-04-21 20:17:52 +00:00
|
|
|
|
|
|
|
|
|
`Sxyz = xz(yz)`
|
|
|
|
|
-/
|
|
|
|
|
def S (x : α → β → γ) (y : α → β) (z : α) := x z (y z)
|
|
|
|
|
|
2023-05-07 16:40:20 +00:00
|
|
|
|
/-- #### Thrush
|
2023-04-21 20:17:52 +00:00
|
|
|
|
|
|
|
|
|
`Txy = yx`
|
|
|
|
|
-/
|
|
|
|
|
def T (x : α) (y : α → β) := y x
|
|
|
|
|
|
2023-05-07 16:40:20 +00:00
|
|
|
|
/-! #### Turing Bird
|
|
|
|
|
|
|
|
|
|
`Uxy = y(xxy)`
|
|
|
|
|
-/
|
|
|
|
|
|
|
|
|
|
/-- #### Vireo Once Removed
|
2023-04-21 20:17:52 +00:00
|
|
|
|
|
|
|
|
|
`V*xyzw = xwyz`
|
|
|
|
|
-/
|
|
|
|
|
def V_star (x : α → β → γ → δ) (y : β) (z : γ) (w : α) := x w y z
|
|
|
|
|
|
|
|
|
|
notation "V*" => V_star
|
|
|
|
|
|
2023-05-07 16:40:20 +00:00
|
|
|
|
/-- #### Vireo
|
2023-04-21 20:17:52 +00:00
|
|
|
|
|
|
|
|
|
`Vxyz = zxy`
|
|
|
|
|
-/
|
|
|
|
|
def V (x : α) (y : β) (z : α → β → γ) := z x y
|
2023-05-02 16:34:47 +00:00
|
|
|
|
|
2023-05-07 16:40:20 +00:00
|
|
|
|
/-- #### Warbler
|
2023-05-02 16:34:47 +00:00
|
|
|
|
|
|
|
|
|
`Wxy = xyy`
|
|
|
|
|
-/
|
|
|
|
|
def W (x : α → α → β) (y : α) := x y y
|