Add pi type
This commit is contained in:
parent
90b24b259b
commit
46ec21b763
3 changed files with 95 additions and 4 deletions
|
@ -24,7 +24,8 @@ Inductive Tm (n_Tm : nat) : Type :=
|
|||
| Abs : Tm (S n_Tm) -> Tm n_Tm
|
||||
| App : Tm n_Tm -> Tm n_Tm -> Tm n_Tm
|
||||
| Pair : Tm n_Tm -> Tm n_Tm -> Tm n_Tm
|
||||
| Proj : PTag -> Tm n_Tm -> Tm n_Tm.
|
||||
| Proj : PTag -> Tm n_Tm -> Tm n_Tm
|
||||
| Pi : Tm n_Tm -> Tm (S n_Tm) -> Tm n_Tm.
|
||||
|
||||
Lemma congr_Abs {m_Tm : nat} {s0 : Tm (S m_Tm)} {t0 : Tm (S m_Tm)}
|
||||
(H0 : s0 = t0) : Abs m_Tm s0 = Abs m_Tm t0.
|
||||
|
@ -56,6 +57,14 @@ exact (eq_trans (eq_trans eq_refl (ap (fun x => Proj m_Tm x s1) H0))
|
|||
(ap (fun x => Proj m_Tm t0 x) H1)).
|
||||
Qed.
|
||||
|
||||
Lemma congr_Pi {m_Tm : nat} {s0 : Tm m_Tm} {s1 : Tm (S m_Tm)} {t0 : Tm m_Tm}
|
||||
{t1 : Tm (S m_Tm)} (H0 : s0 = t0) (H1 : s1 = t1) :
|
||||
Pi m_Tm s0 s1 = Pi m_Tm t0 t1.
|
||||
Proof.
|
||||
exact (eq_trans (eq_trans eq_refl (ap (fun x => Pi m_Tm x s1) H0))
|
||||
(ap (fun x => Pi m_Tm t0 x) H1)).
|
||||
Qed.
|
||||
|
||||
Lemma upRen_Tm_Tm {m : nat} {n : nat} (xi : fin m -> fin n) :
|
||||
fin (S m) -> fin (S n).
|
||||
Proof.
|
||||
|
@ -76,6 +85,7 @@ Fixpoint ren_Tm {m_Tm : nat} {n_Tm : nat} (xi_Tm : fin m_Tm -> fin n_Tm)
|
|||
| App _ s0 s1 => App n_Tm (ren_Tm xi_Tm s0) (ren_Tm xi_Tm s1)
|
||||
| Pair _ s0 s1 => Pair n_Tm (ren_Tm xi_Tm s0) (ren_Tm xi_Tm s1)
|
||||
| Proj _ s0 s1 => Proj n_Tm s0 (ren_Tm xi_Tm s1)
|
||||
| Pi _ s0 s1 => Pi n_Tm (ren_Tm xi_Tm s0) (ren_Tm (upRen_Tm_Tm xi_Tm) s1)
|
||||
end.
|
||||
|
||||
Lemma up_Tm_Tm {m : nat} {n_Tm : nat} (sigma : fin m -> Tm n_Tm) :
|
||||
|
@ -99,6 +109,8 @@ Fixpoint subst_Tm {m_Tm : nat} {n_Tm : nat} (sigma_Tm : fin m_Tm -> Tm n_Tm)
|
|||
| App _ s0 s1 => App n_Tm (subst_Tm sigma_Tm s0) (subst_Tm sigma_Tm s1)
|
||||
| Pair _ s0 s1 => Pair n_Tm (subst_Tm sigma_Tm s0) (subst_Tm sigma_Tm s1)
|
||||
| Proj _ s0 s1 => Proj n_Tm s0 (subst_Tm sigma_Tm s1)
|
||||
| Pi _ s0 s1 =>
|
||||
Pi n_Tm (subst_Tm sigma_Tm s0) (subst_Tm (up_Tm_Tm sigma_Tm) s1)
|
||||
end.
|
||||
|
||||
Lemma upId_Tm_Tm {m_Tm : nat} (sigma : fin m_Tm -> Tm m_Tm)
|
||||
|
@ -134,6 +146,9 @@ subst_Tm sigma_Tm s = s :=
|
|||
congr_Pair (idSubst_Tm sigma_Tm Eq_Tm s0)
|
||||
(idSubst_Tm sigma_Tm Eq_Tm s1)
|
||||
| Proj _ s0 s1 => congr_Proj (eq_refl s0) (idSubst_Tm sigma_Tm Eq_Tm s1)
|
||||
| Pi _ s0 s1 =>
|
||||
congr_Pi (idSubst_Tm sigma_Tm Eq_Tm s0)
|
||||
(idSubst_Tm (up_Tm_Tm sigma_Tm) (upId_Tm_Tm _ Eq_Tm) s1)
|
||||
end.
|
||||
|
||||
Lemma upExtRen_Tm_Tm {m : nat} {n : nat} (xi : fin m -> fin n)
|
||||
|
@ -172,6 +187,10 @@ Fixpoint extRen_Tm {m_Tm : nat} {n_Tm : nat} (xi_Tm : fin m_Tm -> fin n_Tm)
|
|||
(extRen_Tm xi_Tm zeta_Tm Eq_Tm s1)
|
||||
| Proj _ s0 s1 =>
|
||||
congr_Proj (eq_refl s0) (extRen_Tm xi_Tm zeta_Tm Eq_Tm s1)
|
||||
| Pi _ s0 s1 =>
|
||||
congr_Pi (extRen_Tm xi_Tm zeta_Tm Eq_Tm s0)
|
||||
(extRen_Tm (upRen_Tm_Tm xi_Tm) (upRen_Tm_Tm zeta_Tm)
|
||||
(upExtRen_Tm_Tm _ _ Eq_Tm) s1)
|
||||
end.
|
||||
|
||||
Lemma upExt_Tm_Tm {m : nat} {n_Tm : nat} (sigma : fin m -> Tm n_Tm)
|
||||
|
@ -211,6 +230,10 @@ Fixpoint ext_Tm {m_Tm : nat} {n_Tm : nat} (sigma_Tm : fin m_Tm -> Tm n_Tm)
|
|||
congr_Pair (ext_Tm sigma_Tm tau_Tm Eq_Tm s0)
|
||||
(ext_Tm sigma_Tm tau_Tm Eq_Tm s1)
|
||||
| Proj _ s0 s1 => congr_Proj (eq_refl s0) (ext_Tm sigma_Tm tau_Tm Eq_Tm s1)
|
||||
| Pi _ s0 s1 =>
|
||||
congr_Pi (ext_Tm sigma_Tm tau_Tm Eq_Tm s0)
|
||||
(ext_Tm (up_Tm_Tm sigma_Tm) (up_Tm_Tm tau_Tm) (upExt_Tm_Tm _ _ Eq_Tm)
|
||||
s1)
|
||||
end.
|
||||
|
||||
Lemma up_ren_ren_Tm_Tm {k : nat} {l : nat} {m : nat} (xi : fin k -> fin l)
|
||||
|
@ -250,6 +273,10 @@ Fixpoint compRenRen_Tm {k_Tm : nat} {l_Tm : nat} {m_Tm : nat}
|
|||
(compRenRen_Tm xi_Tm zeta_Tm rho_Tm Eq_Tm s1)
|
||||
| Proj _ s0 s1 =>
|
||||
congr_Proj (eq_refl s0) (compRenRen_Tm xi_Tm zeta_Tm rho_Tm Eq_Tm s1)
|
||||
| Pi _ s0 s1 =>
|
||||
congr_Pi (compRenRen_Tm xi_Tm zeta_Tm rho_Tm Eq_Tm s0)
|
||||
(compRenRen_Tm (upRen_Tm_Tm xi_Tm) (upRen_Tm_Tm zeta_Tm)
|
||||
(upRen_Tm_Tm rho_Tm) (up_ren_ren _ _ _ Eq_Tm) s1)
|
||||
end.
|
||||
|
||||
Lemma up_ren_subst_Tm_Tm {k : nat} {l : nat} {m_Tm : nat}
|
||||
|
@ -299,6 +326,10 @@ Fixpoint compRenSubst_Tm {k_Tm : nat} {l_Tm : nat} {m_Tm : nat}
|
|||
| Proj _ s0 s1 =>
|
||||
congr_Proj (eq_refl s0)
|
||||
(compRenSubst_Tm xi_Tm tau_Tm theta_Tm Eq_Tm s1)
|
||||
| Pi _ s0 s1 =>
|
||||
congr_Pi (compRenSubst_Tm xi_Tm tau_Tm theta_Tm Eq_Tm s0)
|
||||
(compRenSubst_Tm (upRen_Tm_Tm xi_Tm) (up_Tm_Tm tau_Tm)
|
||||
(up_Tm_Tm theta_Tm) (up_ren_subst_Tm_Tm _ _ _ Eq_Tm) s1)
|
||||
end.
|
||||
|
||||
Lemma up_subst_ren_Tm_Tm {k : nat} {l_Tm : nat} {m_Tm : nat}
|
||||
|
@ -369,6 +400,10 @@ ren_Tm zeta_Tm (subst_Tm sigma_Tm s) = subst_Tm theta_Tm s :=
|
|||
| Proj _ s0 s1 =>
|
||||
congr_Proj (eq_refl s0)
|
||||
(compSubstRen_Tm sigma_Tm zeta_Tm theta_Tm Eq_Tm s1)
|
||||
| Pi _ s0 s1 =>
|
||||
congr_Pi (compSubstRen_Tm sigma_Tm zeta_Tm theta_Tm Eq_Tm s0)
|
||||
(compSubstRen_Tm (up_Tm_Tm sigma_Tm) (upRen_Tm_Tm zeta_Tm)
|
||||
(up_Tm_Tm theta_Tm) (up_subst_ren_Tm_Tm _ _ _ Eq_Tm) s1)
|
||||
end.
|
||||
|
||||
Lemma up_subst_subst_Tm_Tm {k : nat} {l_Tm : nat} {m_Tm : nat}
|
||||
|
@ -440,6 +475,10 @@ subst_Tm tau_Tm (subst_Tm sigma_Tm s) = subst_Tm theta_Tm s :=
|
|||
| Proj _ s0 s1 =>
|
||||
congr_Proj (eq_refl s0)
|
||||
(compSubstSubst_Tm sigma_Tm tau_Tm theta_Tm Eq_Tm s1)
|
||||
| Pi _ s0 s1 =>
|
||||
congr_Pi (compSubstSubst_Tm sigma_Tm tau_Tm theta_Tm Eq_Tm s0)
|
||||
(compSubstSubst_Tm (up_Tm_Tm sigma_Tm) (up_Tm_Tm tau_Tm)
|
||||
(up_Tm_Tm theta_Tm) (up_subst_subst_Tm_Tm _ _ _ Eq_Tm) s1)
|
||||
end.
|
||||
|
||||
Lemma renRen_Tm {k_Tm : nat} {l_Tm : nat} {m_Tm : nat}
|
||||
|
@ -550,6 +589,10 @@ Fixpoint rinst_inst_Tm {m_Tm : nat} {n_Tm : nat}
|
|||
(rinst_inst_Tm xi_Tm sigma_Tm Eq_Tm s1)
|
||||
| Proj _ s0 s1 =>
|
||||
congr_Proj (eq_refl s0) (rinst_inst_Tm xi_Tm sigma_Tm Eq_Tm s1)
|
||||
| Pi _ s0 s1 =>
|
||||
congr_Pi (rinst_inst_Tm xi_Tm sigma_Tm Eq_Tm s0)
|
||||
(rinst_inst_Tm (upRen_Tm_Tm xi_Tm) (up_Tm_Tm sigma_Tm)
|
||||
(rinstInst_up_Tm_Tm _ _ Eq_Tm) s1)
|
||||
end.
|
||||
|
||||
Lemma rinstInst'_Tm {m_Tm : nat} {n_Tm : nat} (xi_Tm : fin m_Tm -> fin n_Tm)
|
||||
|
@ -748,6 +791,8 @@ Core.
|
|||
|
||||
Arguments VarTm {n_Tm}.
|
||||
|
||||
Arguments Pi {n_Tm}.
|
||||
|
||||
Arguments Proj {n_Tm}.
|
||||
|
||||
Arguments Pair {n_Tm}.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue