module DaraisPhoas where
open import Agda.Primitive using (_ā_)
module Prelude where
infixr 3 āš š”
infixl 5 _āØ_
infixr 20 _ā·_
data š¹ : Set where
T : š¹
F : š¹
data _āØ_ {āā āā} (A : Set āā) (B : Set āā) : Set (āā ā āā) where
Inl : A ā A ⨠B
Inr : B ā A ⨠B
syntax āš š” A (Ī» x ā B) = ā x ⦠A š š” B
data āš š” {āā āā} (A : Set āā) (B : A ā Set āā) : Set (āā ā āā) where
āØā_,_ā© : ā (x : A) ā B x ā ā x ⦠A š š” B x
data ā¬_ā {ā} (A : Set ā) : Set ā where
[] : ⬠A ā
_ā·_ : A ā ⬠A ā ā ⬠A ā
open Prelude
infixr 15 _āØāā©_
data type : Set where
āØāā© : type
_āØāā©_ : type ā type ā type
infixl 15 _āØāā©_
data exp-phoas (var : type ā ⬠type ā ā Set) : ā (Ī : ⬠type ā) (Ļ : type) ā Set where
Var : ā {Ī Ļ}
(x : var Ļ Ī)
ā exp-phoas var Ī Ļ
āØĪ»ā© : ā {Ī Ļā Ļā}
(e : var Ļā (Ļā ā· Ī) ā exp-phoas var (Ļā ā· Ī) Ļā)
ā exp-phoas var Ī (Ļā āØāā© Ļā)
_āØāā©_ : ā {Ī Ļā Ļā}
(eā : exp-phoas var Ī (Ļā āØāā© Ļā))
(eā : exp-phoas var Ī Ļā)
ā exp-phoas var Ī Ļā
infix 10 _ā_
data _ā_ {ā} {A : Set ā} (x : A) : ā (xs : ⬠A ā) ā Set ā where
Z : ā {xs} ā x ā x ā· xs
S : ā {xā² xs} ā x ā xs ā x ā xā² ā· xs
infix 10 _ā¢_
data _ā¢_ : ā (Ī : ⬠type ā) (Ļ : type) ā Set where
Var : ā {Ī Ļ}
(x : Ļ ā Ī)
ā Π⢠Ļ
āØĪ»ā© : ā {Ī Ļā Ļā}
(e : Ļā ⷠΠ⢠Ļā)
ā Π⢠Ļā āØāā© Ļā
_āØāā©_ : ā {Ī Ļā Ļā}
(eā : Π⢠Ļā āØāā© Ļā)
(eā : Π⢠Ļā)
ā Π⢠Ļā
ā¦_ā§ā : ā {Ī Ļ} (e : exp-phoas _ā_ Ī Ļ) ā Π⢠Ļ
⦠Var x ā§ā = Var x
⦠āØĪ»ā© e ā§ā = āØĪ»ā© ⦠e Z ā§ā
⦠eā āØāā© eā ā§ā = ⦠eā ā§ā āØā⩠⦠eā ā§ā
ā¦_ā§ā : ā {Ī Ļ} (e : Π⢠Ļ) ā exp-phoas _ā_ Ī Ļ
⦠Var x ā§ā = Var x
⦠āØĪ»ā© e ā§ā = āØĪ»ā© (Ī» _ ā ⦠e ā§ā)
⦠eā āØāā© eā ā§ā = ⦠eā ā§ā āØā⩠⦠eā ā§ā
Ch : type
Ch = (āØāā© āØāā© āØāā©) āØāā© āØāā© āØāā© āØāā©
twoDB : [] ⢠Ch
twoDB = āØĪ»ā© (āØĪ»ā© (Var (S Z) āØāā© (Var (S Z) āØāā© Var Z)))
twoPH : exp-phoas _ā_ [] Ch
twoPH = āØĪ»ā© (Ī» f ā āØĪ»ā© (Ī» x ā Var f āØāā© (Var f āØāā© Var x)))
{-
/Users/wadler/sf/src/extra/DaraisPhoas.agda:82,9-60
āØāā© āØāā© āØāā© != āØāā© of type type
when checking that the expression
āØĪ»ā© (Ī» f ā āØĪ»ā© (Ī» x ā Var f āØāā© (Var f āØāā© Var x))) has type
exp-phoas _ā_ [] Ch
-}