Add constants to the reduction semantics

This commit is contained in:
Yiyun Liu 2025-01-20 13:56:40 -05:00
parent 0f1e85c853
commit f3718707f2
3 changed files with 74 additions and 130 deletions

View file

@ -40,7 +40,7 @@ Inductive Tm (n_Tm : nat) : Type :=
| Pair : Tm n_Tm -> Tm n_Tm -> Tm n_Tm
| Proj : PTag -> Tm n_Tm -> Tm n_Tm
| TBind : TTag -> Tm n_Tm -> Tm (S n_Tm) -> Tm n_Tm
| Bot : Tm n_Tm
| Const : TTag -> Tm n_Tm
| Univ : nat -> Tm n_Tm.
Lemma congr_Abs {m_Tm : nat} {s0 : Tm (S m_Tm)} {t0 : Tm (S m_Tm)}
@ -83,9 +83,10 @@ exact (eq_trans
(ap (fun x => TBind m_Tm t0 t1 x) H2)).
Qed.
Lemma congr_Bot {m_Tm : nat} : Bot m_Tm = Bot m_Tm.
Lemma congr_Const {m_Tm : nat} {s0 : TTag} {t0 : TTag} (H0 : s0 = t0) :
Const m_Tm s0 = Const m_Tm t0.
Proof.
exact (eq_refl).
exact (eq_trans eq_refl (ap (fun x => Const m_Tm x) H0)).
Qed.
Lemma congr_Univ {m_Tm : nat} {s0 : nat} {t0 : nat} (H0 : s0 = t0) :
@ -116,7 +117,7 @@ Fixpoint ren_Tm {m_Tm : nat} {n_Tm : nat} (xi_Tm : fin m_Tm -> fin n_Tm)
| Proj _ s0 s1 => Proj n_Tm s0 (ren_Tm xi_Tm s1)
| TBind _ s0 s1 s2 =>
TBind n_Tm s0 (ren_Tm xi_Tm s1) (ren_Tm (upRen_Tm_Tm xi_Tm) s2)
| Bot _ => Bot n_Tm
| Const _ s0 => Const n_Tm s0
| Univ _ s0 => Univ n_Tm s0
end.
@ -143,7 +144,7 @@ Fixpoint subst_Tm {m_Tm : nat} {n_Tm : nat} (sigma_Tm : fin m_Tm -> Tm n_Tm)
| Proj _ s0 s1 => Proj n_Tm s0 (subst_Tm sigma_Tm s1)
| TBind _ s0 s1 s2 =>
TBind n_Tm s0 (subst_Tm sigma_Tm s1) (subst_Tm (up_Tm_Tm sigma_Tm) s2)
| Bot _ => Bot n_Tm
| Const _ s0 => Const n_Tm s0
| Univ _ s0 => Univ n_Tm s0
end.
@ -183,7 +184,7 @@ subst_Tm sigma_Tm s = s :=
| TBind _ s0 s1 s2 =>
congr_TBind (eq_refl s0) (idSubst_Tm sigma_Tm Eq_Tm s1)
(idSubst_Tm (up_Tm_Tm sigma_Tm) (upId_Tm_Tm _ Eq_Tm) s2)
| Bot _ => congr_Bot
| Const _ s0 => congr_Const (eq_refl s0)
| Univ _ s0 => congr_Univ (eq_refl s0)
end.
@ -227,7 +228,7 @@ Fixpoint extRen_Tm {m_Tm : nat} {n_Tm : nat} (xi_Tm : fin m_Tm -> fin n_Tm)
congr_TBind (eq_refl s0) (extRen_Tm xi_Tm zeta_Tm Eq_Tm s1)
(extRen_Tm (upRen_Tm_Tm xi_Tm) (upRen_Tm_Tm zeta_Tm)
(upExtRen_Tm_Tm _ _ Eq_Tm) s2)
| Bot _ => congr_Bot
| Const _ s0 => congr_Const (eq_refl s0)
| Univ _ s0 => congr_Univ (eq_refl s0)
end.
@ -272,7 +273,7 @@ Fixpoint ext_Tm {m_Tm : nat} {n_Tm : nat} (sigma_Tm : fin m_Tm -> Tm n_Tm)
congr_TBind (eq_refl s0) (ext_Tm sigma_Tm tau_Tm Eq_Tm s1)
(ext_Tm (up_Tm_Tm sigma_Tm) (up_Tm_Tm tau_Tm) (upExt_Tm_Tm _ _ Eq_Tm)
s2)
| Bot _ => congr_Bot
| Const _ s0 => congr_Const (eq_refl s0)
| Univ _ s0 => congr_Univ (eq_refl s0)
end.
@ -317,7 +318,7 @@ Fixpoint compRenRen_Tm {k_Tm : nat} {l_Tm : nat} {m_Tm : nat}
congr_TBind (eq_refl s0) (compRenRen_Tm xi_Tm zeta_Tm rho_Tm Eq_Tm s1)
(compRenRen_Tm (upRen_Tm_Tm xi_Tm) (upRen_Tm_Tm zeta_Tm)
(upRen_Tm_Tm rho_Tm) (up_ren_ren _ _ _ Eq_Tm) s2)
| Bot _ => congr_Bot
| Const _ s0 => congr_Const (eq_refl s0)
| Univ _ s0 => congr_Univ (eq_refl s0)
end.
@ -373,7 +374,7 @@ Fixpoint compRenSubst_Tm {k_Tm : nat} {l_Tm : nat} {m_Tm : nat}
(compRenSubst_Tm xi_Tm tau_Tm theta_Tm Eq_Tm s1)
(compRenSubst_Tm (upRen_Tm_Tm xi_Tm) (up_Tm_Tm tau_Tm)
(up_Tm_Tm theta_Tm) (up_ren_subst_Tm_Tm _ _ _ Eq_Tm) s2)
| Bot _ => congr_Bot
| Const _ s0 => congr_Const (eq_refl s0)
| Univ _ s0 => congr_Univ (eq_refl s0)
end.
@ -450,7 +451,7 @@ ren_Tm zeta_Tm (subst_Tm sigma_Tm s) = subst_Tm theta_Tm s :=
(compSubstRen_Tm sigma_Tm zeta_Tm theta_Tm Eq_Tm s1)
(compSubstRen_Tm (up_Tm_Tm sigma_Tm) (upRen_Tm_Tm zeta_Tm)
(up_Tm_Tm theta_Tm) (up_subst_ren_Tm_Tm _ _ _ Eq_Tm) s2)
| Bot _ => congr_Bot
| Const _ s0 => congr_Const (eq_refl s0)
| Univ _ s0 => congr_Univ (eq_refl s0)
end.
@ -528,7 +529,7 @@ subst_Tm tau_Tm (subst_Tm sigma_Tm s) = subst_Tm theta_Tm s :=
(compSubstSubst_Tm sigma_Tm tau_Tm theta_Tm Eq_Tm s1)
(compSubstSubst_Tm (up_Tm_Tm sigma_Tm) (up_Tm_Tm tau_Tm)
(up_Tm_Tm theta_Tm) (up_subst_subst_Tm_Tm _ _ _ Eq_Tm) s2)
| Bot _ => congr_Bot
| Const _ s0 => congr_Const (eq_refl s0)
| Univ _ s0 => congr_Univ (eq_refl s0)
end.
@ -644,7 +645,7 @@ Fixpoint rinst_inst_Tm {m_Tm : nat} {n_Tm : nat}
congr_TBind (eq_refl s0) (rinst_inst_Tm xi_Tm sigma_Tm Eq_Tm s1)
(rinst_inst_Tm (upRen_Tm_Tm xi_Tm) (up_Tm_Tm sigma_Tm)
(rinstInst_up_Tm_Tm _ _ Eq_Tm) s2)
| Bot _ => congr_Bot
| Const _ s0 => congr_Const (eq_refl s0)
| Univ _ s0 => congr_Univ (eq_refl s0)
end.
@ -846,7 +847,7 @@ Arguments VarTm {n_Tm}.
Arguments Univ {n_Tm}.
Arguments Bot {n_Tm}.
Arguments Const {n_Tm}.
Arguments TBind {n_Tm}.