Commit 2558937b authored by Gaspard Ferey's avatar Gaspard Ferey

Proofs are working !

parent 6d2a5c7d
...@@ -101,17 +101,24 @@ Notation "[ ]" := CEmpty (at level 0). ...@@ -101,17 +101,24 @@ Notation "[ ]" := CEmpty (at level 0).
Notation "Γ ',' x ':' A" := (CVar x A Γ) (at level 30, x at level 30). Notation "Γ ',' x ':' A" := (CVar x A Γ) (at level 30, x at level 30).
Notation "Γ ',' t '≡' u" := (CRel t u Γ) (at level 30, t at level 30). Notation "Γ ',' t '≡' u" := (CRel t u Γ) (at level 30, t at level 30).
Definition pop_context (c:context) : context := Definition pop_context (Γ:context) : context :=
match c with match Γ with
| CEmpty => c | CEmpty => Γ
| CVar _ _ c => c | CVar _ _ Γ => Γ
| CRel _ _ c => c | CRel _ _ Γ => Γ
end.
Fixpoint defined_vars (Γ:context) : list Var :=
match Γ with
| CEmpty => nil
| CVar x _ Γ => cons x (defined_vars Γ)
| CRel _ _ Γ => (defined_vars Γ)
end. end.
Reserved Notation "x ':' A '∈' Γ" (at level 80, A at level 80, Γ at level 80). Reserved Notation "x ':' A '∈' Γ" (at level 80, A at level 80, Γ at level 80).
Inductive InCtx : context -> Var -> term -> Prop := Inductive InCtx : context -> Var -> term -> Prop :=
| INow : forall Γ x A, x : A (Γ, x : A) | INow : forall Γ x A, x : A (Γ, x : A)
| IAfterV : forall Γ A x y B, x : A Γ -> x : A (Γ, y : B) | IAfterV : forall Γ A x y B, x : A Γ -> x <> y -> x : A (Γ, y : B)
| IAfterR : forall Γ A x t u, x : A Γ -> x : A (Γ, t u) | IAfterR : forall Γ A x t u, x : A Γ -> x : A (Γ, t u)
where "x ':' A ∈ Γ" := (InCtx Γ x A). where "x ':' A ∈ Γ" := (InCtx Γ x A).
...@@ -128,6 +135,24 @@ Definition Fresh_var Γ v := ~ (Defined_var Γ v). ...@@ -128,6 +135,24 @@ Definition Fresh_var Γ v := ~ (Defined_var Γ v).
Notation "x '∈' Γ" := (Defined_var Γ x) (at level 90). Notation "x '∈' Γ" := (Defined_var Γ x) (at level 90).
Notation "x '∉' Γ" := (Fresh_var Γ x) (at level 90). Notation "x '∉' Γ" := (Fresh_var Γ x) (at level 90).
Theorem defined_eq : forall Γ v, Defined_var Γ v <-> In v (defined_vars Γ).
Proof.
intros.
split; intros.
- induction H. induction H.
+ left. easy.
+ right. easy.
+ easy.
- induction Γ.
+ contradiction H.
+ destruct (var_dec v v0).
* subst. econstructor. econstructor.
* assert (v Γ). apply IHΓ. destruct H. contradiction n. easy. easy.
destruct H0. econstructor. apply IAfterV. apply H0. easy.
+ assert (v Γ). apply IHΓ. exact H.
destruct H0. econstructor. apply IAfterR. apply H0.
Qed.
(* ************ Locally nameless representation ************ *) (* ************ Locally nameless representation ************ *)
...@@ -287,7 +312,7 @@ Inductive typing : context -> term -> term -> Prop := ...@@ -287,7 +312,7 @@ Inductive typing : context -> term -> term -> Prop :=
(forall x, ~ (In x L) -> Γ, x : A t[x] : B[x]) -> (forall x, ~ (In x L) -> Γ, x : A t[x] : B[x]) ->
Γ λ A ~ t : Π A ~ B Γ λ A ~ t : Π A ~ B
| TyApp : forall Γ t u A B, Γ t : Π A ~ B -> Γ u : A -> Γ t @ u : B [0 <- u] | TyApp : forall Γ t u A B, Γ t : Π A ~ B -> Γ u : A -> Γ t @ u : B [0 <- u]
| TyConv : forall Γ t A B s, (Γ t : A) -> (Γ B : s) -> Γ A B -> (Γ t : B) | TyConv : forall Γ t A B s, Γ t : A -> Γ B : s -> Γ A B -> Γ t : B
where "Γ '⊢' t ':' A" := (typing Γ t A) where "Γ '⊢' t ':' A" := (typing Γ t A)
with well_formed : context -> Prop := with well_formed : context -> Prop :=
| WFEmpty : [ ] | WFEmpty : [ ]
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment