(* *)
(**************************************************************************)
-include "basic_2/notation/relations/sn_5.ma".
-include "basic_2/reduction/cnx.ma".
+include "basic_2/notation/relations/predtystrong_5.ma".
+include "basic_2/syntax/tdeq.ma".
+include "basic_2/rt_transition/cpx.ma".
-(* CONTEXT-SENSITIVE EXTENDED STRONGLY NORMALIZING TERMS ********************)
+(* STRONGLY NORMALIZING TERMS FOR UNCOUNTED PARALLEL RT-TRANSITION **********)
definition csx: ∀h. sd h → relation3 genv lenv term ≝
- λh,o,G,L. SN … (cpx h o G L) (eq …).
+ λh,o,G,L. SN … (cpx h G L) (tdeq h o …).
interpretation
- "context-sensitive extended strong normalization (term)"
- 'SN h o G L T = (csx h o G L T).
+ "strong normalization for uncounted context-sensitive parallel rt-transition (term)"
+ 'PRedTyStrong h o G L T = (csx h o G L T).
(* Basic eliminators ********************************************************)
lemma csx_ind: ∀h,o,G,L. ∀R:predicate term.
- (â\88\80T1. â¦\83G, Lâ¦\84 â\8a¢ â¬\8a*[h, o] T1 →
- (â\88\80T2. â¦\83G, Lâ¦\84 â\8a¢ T1 â\9e¡[h, o] T2 â\86\92 (T1 = T2 → ⊥) → R T2) →
+ (â\88\80T1. â¦\83G, Lâ¦\84 â\8a¢ â¬\88[h, o] ð\9d\90\92â¦\83T1â¦\84 →
+ (â\88\80T2. â¦\83G, Lâ¦\84 â\8a¢ T1 â¬\88[h] T2 â\86\92 (T1 â\89¡[h, o] T2 → ⊥) → R T2) →
R T1
) →
- â\88\80T. â¦\83G, Lâ¦\84 â\8a¢ â¬\8a*[h, o] T → R T.
+ â\88\80T. â¦\83G, Lâ¦\84 â\8a¢ â¬\88[h, o] ð\9d\90\92â¦\83Tâ¦\84 → R T.
#h #o #G #L #R #H0 #T1 #H elim H -T1
/5 width=1 by SN_intro/
qed-.
(* Basic_1: was just: sn3_pr2_intro *)
lemma csx_intro: ∀h,o,G,L,T1.
- (â\88\80T2. â¦\83G, Lâ¦\84 â\8a¢ T1 â\9e¡[h, o] T2 â\86\92 (T1 = T2 â\86\92 â\8a¥) â\86\92 â¦\83G, Lâ¦\84 â\8a¢ â¬\8a*[h, o] T2) →
- â¦\83G, Lâ¦\84 â\8a¢ â¬\8a*[h, o] T1.
+ (â\88\80T2. â¦\83G, Lâ¦\84 â\8a¢ T1 â¬\88[h] T2 â\86\92 (T1 â\89¡[h, o] T2 â\86\92 â\8a¥) â\86\92 â¦\83G, Lâ¦\84 â\8a¢ â¬\88[h, o] ð\9d\90\92â¦\83T2â¦\84) →
+ â¦\83G, Lâ¦\84 â\8a¢ â¬\88[h, o] ð\9d\90\92â¦\83T1â¦\84.
/4 width=1 by SN_intro/ qed.
-lemma csx_cpx_trans: ∀h,o,G,L,T1. ⦃G, L⦄ ⊢ ⬊*[h, o] T1 →
- ∀T2. ⦃G, L⦄ ⊢ T1 ➡[h, o] T2 → ⦃G, L⦄ ⊢ ⬊*[h, o] T2.
-#h #o #G #L #T1 #H @(csx_ind … H) -T1 #T1 #HT1 #IHT1 #T2 #HLT12
-elim (eq_term_dec T1 T2) #HT12 destruct /3 width=4 by/
-qed-.
-
-(* Basic_1: was just: sn3_nf2 *)
-lemma cnx_csx: ∀h,o,G,L,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃T⦄ → ⦃G, L⦄ ⊢ ⬊*[h, o] T.
-/2 width=1 by NF_to_SN/ qed.
-
-lemma csx_sort: ∀h,o,G,L,s. ⦃G, L⦄ ⊢ ⬊*[h, o] ⋆s.
+lemma csx_sort: ∀h,o,G,L,s. ⦃G, L⦄ ⊢ ⬈[h, o] 𝐒⦃⋆s⦄.
#h #o #G #L #s elim (deg_total h o s)
-#d generalize in match s; -s @(nat_ind_plus … d) -d /3 width=6 by cnx_csx, cnx_sort/
-#d #IHd #s #Hkd lapply (deg_next_SO … Hkd) -Hkd
-#Hkd @csx_intro #X #H #HX elim (cpx_inv_sort1 … H) -H
-[ #H destruct elim HX //
-| -HX * #d0 #_ #H destruct -d0 /2 width=1 by/
-]
-qed.
-
-(* Basic_1: was just: sn3_cast *)
-lemma csx_cast: ∀h,o,G,L,W. ⦃G, L⦄ ⊢ ⬊*[h, o] W →
- ∀T. ⦃G, L⦄ ⊢ ⬊*[h, o] T → ⦃G, L⦄ ⊢ ⬊*[h, o] ⓝW.T.
-#h #o #G #L #W #HW @(csx_ind … HW) -W #W #HW #IHW #T #HT @(csx_ind … HT) -T #T #HT #IHT
-@csx_intro #X #H1 #H2
-elim (cpx_inv_cast1 … H1) -H1
-[ * #W0 #T0 #HLW0 #HLT0 #H destruct
- elim (eq_false_inv_tpair_sn … H2) -H2
- [ /3 width=3 by csx_cpx_trans/
- | -HLW0 * #H destruct /3 width=1 by/
- ]
-|2,3: /3 width=3 by csx_cpx_trans/
+#d generalize in match s; -s elim d -d
+[ #s1 #Hs1 @csx_intro #X #H #HX elim HX -HX
+ elim (cpx_inv_sort1 … H) -H #H destruct //
+ /3 width=3 by tdeq_sort, deg_next/
+| #d #IH #s #Hsd lapply (deg_next_SO … Hsd) -Hsd
+ #Hsd @csx_intro #X #H #HX
+ elim (cpx_inv_sort1 … H) -H #H destruct /2 width=1 by/
+ elim HX //
]
qed.
(* Basic forward lemmas *****************************************************)
-fact csx_fwd_pair_sn_aux: â\88\80h,o,G,L,U. â¦\83G, Lâ¦\84 â\8a¢ â¬\8a*[h, o] U →
- â\88\80I,V,T. U = â\91¡{I}V.T â\86\92 â¦\83G, Lâ¦\84 â\8a¢ â¬\8a*[h, o] V.
+fact csx_fwd_pair_sn_aux: â\88\80h,o,G,L,U. â¦\83G, Lâ¦\84 â\8a¢ â¬\88[h, o] ð\9d\90\92â¦\83Uâ¦\84 →
+ â\88\80I,V,T. U = â\91¡{I}V.T â\86\92 â¦\83G, Lâ¦\84 â\8a¢ â¬\88[h, o] ð\9d\90\92â¦\83Vâ¦\84.
#h #o #G #L #U #H elim H -H #U0 #_ #IH #I #V #T #H destruct
@csx_intro #V2 #HLV2 #HV2
@(IH (②{I}V2.T)) -IH /2 width=3 by cpx_pair_sn/ -HLV2
-#H destruct /2 width=1 by/
+#H elim (tdeq_inv_pair … H) -H /2 width=1 by/
qed-.
(* Basic_1: was just: sn3_gen_head *)
-lemma csx_fwd_pair_sn: â\88\80h,o,I,G,L,V,T. â¦\83G, Lâ¦\84 â\8a¢ â¬\8a*[h, o] â\91¡{I}V.T â\86\92 â¦\83G, Lâ¦\84 â\8a¢ â¬\8a*[h, o] V.
+lemma csx_fwd_pair_sn: â\88\80h,o,I,G,L,V,T. â¦\83G, Lâ¦\84 â\8a¢ â¬\88[h, o] ð\9d\90\92â¦\83â\91¡{I}V.Tâ¦\84 â\86\92 â¦\83G, Lâ¦\84 â\8a¢ â¬\88[h, o] ð\9d\90\92â¦\83Vâ¦\84.
/2 width=5 by csx_fwd_pair_sn_aux/ qed-.
-fact csx_fwd_bind_dx_aux: â\88\80h,o,G,L,U. â¦\83G, Lâ¦\84 â\8a¢ â¬\8a*[h, o] U →
- ∀a,I,V,T. U = ⓑ{a,I}V.T → ⦃G, L.ⓑ{I}V⦄ ⊢ ⬊*[h, o] T.
-#h #o #G #L #U #H elim H -H #U0 #_ #IH #a #I #V #T #H destruct
+fact csx_fwd_bind_dx_aux: â\88\80h,o,G,L,U. â¦\83G, Lâ¦\84 â\8a¢ â¬\88[h, o] ð\9d\90\92â¦\83Uâ¦\84 →
+ ∀p,I,V,T. U = ⓑ{p,I}V.T → ⦃G, L.ⓑ{I}V⦄ ⊢ ⬈[h, o] 𝐒⦃T⦄.
+#h #o #G #L #U #H elim H -H #U0 #_ #IH #p #I #V #T #H destruct
@csx_intro #T2 #HLT2 #HT2
-@(IH (ⓑ{a,I}V.T2)) -IH /2 width=3 by cpx_bind/ -HLT2
-#H destruct /2 width=1 by/
+@(IH (ⓑ{p,I}V.T2)) -IH /2 width=3 by cpx_bind/ -HLT2
+#H elim (tdeq_inv_pair … H) -H /2 width=1 by/
qed-.
(* Basic_1: was just: sn3_gen_bind *)
-lemma csx_fwd_bind_dx: ∀h,o,a,I,G,L,V,T. ⦃G, L⦄ ⊢ ⬊*[h, o] ⓑ{a,I}V.T → ⦃G, L.ⓑ{I}V⦄ ⊢ ⬊*[h, o] T.
+lemma csx_fwd_bind_dx: ∀h,o,p,I,G,L,V,T. ⦃G, L⦄ ⊢ ⬈[h, o] 𝐒⦃ⓑ{p,I}V.T⦄ → ⦃G, L.ⓑ{I}V⦄ ⊢ ⬈[h, o] 𝐒⦃T⦄.
/2 width=4 by csx_fwd_bind_dx_aux/ qed-.
-fact csx_fwd_flat_dx_aux: â\88\80h,o,G,L,U. â¦\83G, Lâ¦\84 â\8a¢ â¬\8a*[h, o] U →
- â\88\80I,V,T. U = â\93\95{I}V.T â\86\92 â¦\83G, Lâ¦\84 â\8a¢ â¬\8a*[h, o] T.
+fact csx_fwd_flat_dx_aux: â\88\80h,o,G,L,U. â¦\83G, Lâ¦\84 â\8a¢ â¬\88[h, o] ð\9d\90\92â¦\83Uâ¦\84 →
+ â\88\80I,V,T. U = â\93\95{I}V.T â\86\92 â¦\83G, Lâ¦\84 â\8a¢ â¬\88[h, o] ð\9d\90\92â¦\83Tâ¦\84.
#h #o #G #L #U #H elim H -H #U0 #_ #IH #I #V #T #H destruct
@csx_intro #T2 #HLT2 #HT2
@(IH (ⓕ{I}V.T2)) -IH /2 width=3 by cpx_flat/ -HLT2
-#H destruct /2 width=1 by/
+#H elim (tdeq_inv_pair … H) -H /2 width=1 by/
qed-.
(* Basic_1: was just: sn3_gen_flat *)
-lemma csx_fwd_flat_dx: â\88\80h,o,I,G,L,V,T. â¦\83G, Lâ¦\84 â\8a¢ â¬\8a*[h, o] â\93\95{I}V.T â\86\92 â¦\83G, Lâ¦\84 â\8a¢ â¬\8a*[h, o] T.
+lemma csx_fwd_flat_dx: â\88\80h,o,I,G,L,V,T. â¦\83G, Lâ¦\84 â\8a¢ â¬\88[h, o] ð\9d\90\92â¦\83â\93\95{I}V.Tâ¦\84 â\86\92 â¦\83G, Lâ¦\84 â\8a¢ â¬\88[h, o] ð\9d\90\92â¦\83Tâ¦\84.
/2 width=5 by csx_fwd_flat_dx_aux/ qed-.
-lemma csx_fwd_bind: ∀h,o,a,I,G,L,V,T. ⦃G, L⦄ ⊢ ⬊*[h, o] ⓑ{a,I}V.T →
- â¦\83G, Lâ¦\84 â\8a¢ â¬\8a*[h, o] V â\88§ â¦\83G, L.â\93\91{I}Vâ¦\84 â\8a¢ â¬\8a*[h, o] T.
+lemma csx_fwd_bind: ∀h,o,p,I,G,L,V,T. ⦃G, L⦄ ⊢ ⬈[h, o] 𝐒⦃ⓑ{p,I}V.T⦄ →
+ â¦\83G, Lâ¦\84 â\8a¢ â¬\88[h, o] ð\9d\90\92â¦\83Vâ¦\84 â\88§ â¦\83G, L.â\93\91{I}Vâ¦\84 â\8a¢ â¬\88[h, o] ð\9d\90\92â¦\83Tâ¦\84.
/3 width=3 by csx_fwd_pair_sn, csx_fwd_bind_dx, conj/ qed-.
-lemma csx_fwd_flat: â\88\80h,o,I,G,L,V,T. â¦\83G, Lâ¦\84 â\8a¢ â¬\8a*[h, o] â\93\95{I}V.T →
- â¦\83G, Lâ¦\84 â\8a¢ â¬\8a*[h, o] V â\88§ â¦\83G, Lâ¦\84 â\8a¢ â¬\8a*[h, o] T.
+lemma csx_fwd_flat: â\88\80h,o,I,G,L,V,T. â¦\83G, Lâ¦\84 â\8a¢ â¬\88[h, o] ð\9d\90\92â¦\83â\93\95{I}V.Tâ¦\84 →
+ â¦\83G, Lâ¦\84 â\8a¢ â¬\88[h, o] ð\9d\90\92â¦\83Vâ¦\84 â\88§ â¦\83G, Lâ¦\84 â\8a¢ â¬\88[h, o] ð\9d\90\92â¦\83Tâ¦\84.
/3 width=3 by csx_fwd_pair_sn, csx_fwd_flat_dx, conj/ qed-.
(* Basic_1: removed theorems 14:
definition cdeq: ∀h. sd h → relation3 lenv term term ≝
λh,o,L. tdeq h o.
-(* Basic properties *********************************************************)
-
-lemma tdeq_refl: ∀h,o. reflexive … (tdeq h o).
-#h #o #T elim T -T /2 width=1 by tdeq_pair/
-* /2 width=1 by tdeq_lref, tdeq_gref/
-#s elim (deg_total h o s) /2 width=3 by tdeq_sort/
-qed.
-
-lemma tdeq_sym: ∀h,o. symmetric … (tdeq h o).
-#h #o #T1 #T2 #H elim H -T1 -T2
-/2 width=3 by tdeq_sort, tdeq_lref, tdeq_gref, tdeq_pair/
-qed-.
-
(* Basic inversion lemmas ***************************************************)
fact tdeq_inv_sort1_aux: ∀h,o,X,Y. X ≡[h, o] Y → ∀s1. X = ⋆s1 →
lemma tdeq_inv_sort1_deg: ∀h,o,Y,s1. ⋆s1 ≡[h, o] Y → ∀d. deg h o s1 d →
∃∃s2. deg h o s2 d & Y = ⋆s2.
#h #o #Y #s1 #H #d #Hs1 elim (tdeq_inv_sort1 … H) -H
-#s2 #x #Hx <(deg_mono h o … Hx … Hs1) -s1 -d /2 width=3 by ex2_intro/
+#s2 #x #Hx <(deg_mono h o … Hx … Hs1) -s1 -d /2 width=3 by ex2_intro/
+qed-.
+
+lemma tdeq_inv_sort_deg: ∀h,o,s1,s2. ⋆s1 ≡[h, o] ⋆s2 →
+ ∀d1,d2. deg h o s1 d1 → deg h o s2 d2 →
+ d1 = d2.
+#h #o #s1 #y #H #d1 #d2 #Hs1 #Hy
+elim (tdeq_inv_sort1_deg … H … Hs1) -s1 #s2 #Hs2 #H destruct
+<(deg_mono h o … Hy … Hs2) -s2 -d1 //
qed-.
lemma tdeq_inv_pair: ∀h,o,I1,I2,V1,V2,T1,T2. ②{I1}V1.T1 ≡[h, o] ②{I2}V2.T2 →
#h #o * #x #Y #H [ elim (tdeq_inv_sort1 … H) -H ]
/3 width=4 by tdeq_inv_gref1, tdeq_inv_lref1, ex_intro/
qed-.
+
+(* Basic properties *********************************************************)
+
+lemma tdeq_refl: ∀h,o. reflexive … (tdeq h o).
+#h #o #T elim T -T /2 width=1 by tdeq_pair/
+* /2 width=1 by tdeq_lref, tdeq_gref/
+#s elim (deg_total h o s) /2 width=3 by tdeq_sort/
+qed.
+
+lemma tdeq_sym: ∀h,o. symmetric … (tdeq h o).
+#h #o #T1 #T2 #H elim H -T1 -T2
+/2 width=3 by tdeq_sort, tdeq_lref, tdeq_gref, tdeq_pair/
+qed-.
+
+lemma tdeq_dec: ∀h,o,T1,T2. Decidable (tdeq h o T1 T2).
+#h #o #T1 elim T1 -T1 [ * #s1 | #I1 #V1 #T1 #IHV #IHT ] * [1,3,5,7: * #s2 |*: #I2 #V2 #T2 ]
+[ elim (deg_total h o s1) #d1 #H1
+ elim (deg_total h o s2) #d2 #H2
+ elim (eq_nat_dec d1 d2) #Hd12 destruct /3 width=3 by tdeq_sort, or_introl/
+ @or_intror #H
+ lapply (tdeq_inv_sort_deg … H … H1 H2) -H -H1 -H2 /2 width=1 by/
+|2,3,13:
+ @or_intror #H
+ elim (tdeq_inv_sort1 … H) -H #x1 #x2 #_ #_ #H destruct
+|4,6,14:
+ @or_intror #H
+ lapply (tdeq_inv_lref1 … H) -H #H destruct
+|5:
+ elim (eq_nat_dec s1 s2) #Hs12 destruct /2 width=1 by or_introl/
+ @or_intror #H
+ lapply (tdeq_inv_lref1 … H) -H #H destruct /2 width=1 by/
+|7,8,15:
+ @or_intror #H
+ lapply (tdeq_inv_gref1 … H) -H #H destruct
+|9:
+ elim (eq_nat_dec s1 s2) #Hs12 destruct /2 width=1 by or_introl/
+ @or_intror #H
+ lapply (tdeq_inv_gref1 … H) -H #H destruct /2 width=1 by/
+|10,11,12:
+ @or_intror #H
+ elim (tdeq_inv_pair1 … H) -H #X1 #X2 #_ #_ #H destruct
+|16:
+ elim (eq_item2_dec I1 I2) #HI12 destruct
+ [ elim (IHV V2) -IHV #HV12
+ elim (IHT T2) -IHT #HT12
+ [ /3 width=1 by tdeq_pair, or_introl/ ]
+ ]
+ @or_intror #H
+ elim (tdeq_inv_pair … H) -H /2 width=1 by/
+]
+qed-.