UntypedLambda.agda 764 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. module UntypedLambda where
  2. open import Basics
  3. open import Pr
  4. open import Nom
  5. import Syntacticosmos
  6. data Tag : Set where
  7. lamT : Tag
  8. appT : Tag
  9. open module ULam = Syntacticosmos TT TT (\_ -> Tag)
  10. LAM : Kind
  11. LAM = Ty _
  12. SigLAM : Kind
  13. SigLAM = Pi _ conk where
  14. conk : Tag -> Kind
  15. conk lamT = (LAM |> LAM) |> LAM
  16. conk appT = LAM |> LAM |> LAM
  17. Lam : Cxt -> Set
  18. Lam G = G [! SigLAM !]- LAM
  19. lam : {G : Cxt}(x : Nom){Gx : [| G Hasn't x |]} ->
  20. Lam ((G [ x - LAM ]) {Gx}) -> Lam G
  21. lam x {Gx} b = G[ lamT G^ G\\ (bind x {Gx} b) G& Gnil ]
  22. app : {G : Cxt} -> Lam G -> Lam G -> Lam G
  23. app f s = G[ appT G^ f G& s G& Gnil ]
  24. moo : Lam EC
  25. moo = lam Ze (lam (Su Ze) (var Ze))
  26. noo : Lam EC
  27. noo = lam (Su Ze) (lam Ze (var (Su Ze)))
  28. coo : Id moo noo
  29. coo = refl