Advertisement
Nolrai

lam 1

May 25th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. import data.nat
  2. import data.list
  3.  
  4. open list
  5.  
  6. inductive In {A} : A -> list A -> Type :=
  7. | here {} : forall {x : A} {l : list A}
  8. , In x (x :: l)
  9. | there : forall {x y : A} {l : list A}
  10. , In x l -> In x (y :: l)
  11.  
  12. definition notT : Type -> Type :=
  13. fun t, t -> empty
  14.  
  15. lemma no_In_nil A (x : A) : notT (In x nil) :=
  16. begin
  17. intros T,
  18. cases T,
  19. now
  20. end
  21.  
  22. inductive Maybe A :=
  23. | None {} : Maybe A
  24. | Some : A -> Maybe A
  25.  
  26. structure type :=
  27. (C : Type)
  28. (Lit : C -> Type)
  29. (arrow : C -> C -> C)
  30. (fuse : list C -> list C -> list C -> Prop)
  31. (Ix : C -> list C -> Type)
  32.  
  33. attribute type.C [coercion]
  34.  
  35. notation `~>`:60 := type.arrow
  36.  
  37. open type
  38.  
  39. inductive exp {T : type} (env : list T)
  40. : T -> Type :=
  41. | var : forall {A : T}
  42. , Ix A env -> exp env A
  43. | lit : forall {A : T} {l}
  44. , Lit A -> exp l A
  45. | app : forall {A B}
  46. , exp l1 (A ~> B) -> exp l2 A -> exp l3 B
  47. | lam : forall A {l} {B}
  48. , exp (t :: l) B -> exp l (A ~> B)
  49.  
  50. check unit.rec
  51.  
  52. definition untyped : type :=
  53. {| type
  54. , C := unit
  55. , Lit := unit.rec Tagged
  56. , arrrow := unit.rec unit.star
  57. , fuse := fun unit.star unit.star unit.star := True
  58. , Ix := In
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement