X-Git-Url: http://matita.cs.unibo.it/gitweb/?p=helm.git;a=blobdiff_plain;f=matita%2Fmatita%2Fcontribs%2Flambdadelta%2Fstatic_2%2Fsyntax%2Fteqx.ma;h=ed581c5be2f804d0fd0bcfdda75871aeec35da23;hp=3986d32a43fae55e08341230403af27601dfd247;hb=b118146b97959e6a6dde18fdd014b8e1e676a2d1;hpb=613d8642b1154dde0c026cbdcd96568910198251 diff --git a/matita/matita/contribs/lambdadelta/static_2/syntax/teqx.ma b/matita/matita/contribs/lambdadelta/static_2/syntax/teqx.ma index 3986d32a4..ed581c5be 100644 --- a/matita/matita/contribs/lambdadelta/static_2/syntax/teqx.ma +++ b/matita/matita/contribs/lambdadelta/static_2/syntax/teqx.ma @@ -12,174 +12,109 @@ (* *) (**************************************************************************) -include "ground/xoa/ex_3_2.ma". -include "static_2/notation/relations/stareq_2.ma". -include "static_2/syntax/term.ma". +include "static_2/notation/relations/approxeq_2.ma". +include "static_2/syntax/teqg.ma". (* SORT-IRRELEVANT EQUIVALENCE ON TERMS *************************************) -inductive teqx: relation term ≝ -| teqx_sort: ∀s1,s2. teqx (⋆s1) (⋆s2) -| teqx_lref: ∀i. teqx (#i) (#i) -| teqx_gref: ∀l. teqx (§l) (§l) -| teqx_pair: ∀I,V1,V2,T1,T2. teqx V1 V2 → teqx T1 T2 → teqx (②[I]V1.T1) (②[I]V2.T2) -. +definition sfull: relation2 nat nat ≝ + λs1,s2. ⊤. + +definition teqx: relation term ≝ + teqg sfull. interpretation - "context-free sort-irrelevant equivalence (term)" - 'StarEq T1 T2 = (teqx T1 T2). + "context-free sort-irrelevant equivalence (term)" + 'ApproxEq T1 T2 = (teqx T1 T2). (* Basic properties *********************************************************) -lemma teqx_refl: reflexive … teqx. -#T elim T -T /2 width=1 by teqx_pair/ -* /2 width=1 by teqx_lref, teqx_gref/ -qed. - -lemma teqx_sym: symmetric … teqx. -#T1 #T2 #H elim H -T1 -T2 -/2 width=3 by teqx_sort, teqx_lref, teqx_gref, teqx_pair/ -qed-. - -(* Basic inversion lemmas ***************************************************) +lemma sfull_dec: + ∀s1,s2. Decidable (sfull s1 s2). +/2 width=1 by or_introl/ qed. -fact teqx_inv_sort1_aux: ∀X,Y. X ≛ Y → ∀s1. X = ⋆s1 → - ∃s2. Y = ⋆s2. -#X #Y * -X -Y -[ #s1 #s2 #s #H destruct /2 width=2 by ex_intro/ -| #i #s #H destruct -| #l #s #H destruct -| #I #V1 #V2 #T1 #T2 #_ #_ #s #H destruct -] -qed-. +lemma teqx_pair: + ∀V1,V2. V1 ≅ V2 → ∀T1,T2. T1 ≅ T2 → + ∀I. ②[I]V1.T1 ≅ ②[I]V2.T2. +/2 width=1 by teqg_pair/ qed. -lemma teqx_inv_sort1: ∀Y,s1. ⋆s1 ≛ Y → - ∃s2. Y = ⋆s2. -/2 width=4 by teqx_inv_sort1_aux/ qed-. +lemma teqx_refl: + reflexive … teqx. +/2 width=1 by teqg_refl/ qed. -fact teqx_inv_lref1_aux: ∀X,Y. X ≛ Y → ∀i. X = #i → Y = #i. -#X #Y * -X -Y // -[ #s1 #s2 #j #H destruct -| #I #V1 #V2 #T1 #T2 #_ #_ #j #H destruct -] -qed-. +lemma teqx_sym: + symmetric … teqx. +/2 width=1 by teqg_sym/ qed-. -lemma teqx_inv_lref1: ∀Y,i. #i ≛ Y → Y = #i. -/2 width=5 by teqx_inv_lref1_aux/ qed-. +lemma teqg_teqx (S): + ∀T1,T2. T1 ≛[S] T2 → T1 ≅ T2. +/2 width=3 by teqg_co/ qed. -fact teqx_inv_gref1_aux: ∀X,Y. X ≛ Y → ∀l. X = §l → Y = §l. -#X #Y * -X -Y // -[ #s1 #s2 #k #H destruct -| #I #V1 #V2 #T1 #T2 #_ #_ #k #H destruct -] -qed-. +(* Basic inversion lemmas ***************************************************) -lemma teqx_inv_gref1: ∀Y,l. §l ≛ Y → Y = §l. -/2 width=5 by teqx_inv_gref1_aux/ qed-. - -fact teqx_inv_pair1_aux: ∀X,Y. X ≛ Y → ∀I,V1,T1. X = ②[I]V1.T1 → - ∃∃V2,T2. V1 ≛ V2 & T1 ≛ T2 & Y = ②[I]V2.T2. -#X #Y * -X -Y -[ #s1 #s2 #J #W1 #U1 #H destruct -| #i #J #W1 #U1 #H destruct -| #l #J #W1 #U1 #H destruct -| #I #V1 #V2 #T1 #T2 #HV #HT #J #W1 #U1 #H destruct /2 width=5 by ex3_2_intro/ -] +lemma teqx_inv_sort1: + ∀X2,s1. ⋆s1 ≅ X2 → + ∃s2. X2 = ⋆s2. +#X1 #s1 #H elim (teqg_inv_sort1 … H) -H /2 width=2 by ex_intro/ qed-. - -lemma teqx_inv_pair1: ∀I,V1,T1,Y. ②[I]V1.T1 ≛ Y → - ∃∃V2,T2. V1 ≛ V2 & T1 ≛ T2 & Y = ②[I]V2.T2. -/2 width=3 by teqx_inv_pair1_aux/ qed-. - -lemma teqx_inv_sort2: ∀X1,s2. X1 ≛ ⋆s2 → - ∃s1. X1 = ⋆s1. -#X1 #s2 #H -elim (teqx_inv_sort1 X1 s2) -/2 width=2 by teqx_sym, ex_intro/ +(* +lemma teqx_inv_lref1: + ∀X,i. #i ≅ X → X = #i. +/2 width=5 by teqg_inv_lref1/ qed-. + +lemma teqx_inv_gref1: + ∀X,l. §l ≅ X → X = §l. +/2 width=5 by teqg_inv_gref1/ qed-. +*) +lemma teqx_inv_pair1: + ∀I,V1,T1,X2. ②[I]V1.T1 ≅ X2 → + ∃∃V2,T2. V1 ≅ V2 & T1 ≅ T2 & X2 = ②[I]V2.T2. +/2 width=3 by teqg_inv_pair1/ qed-. + +lemma teqx_inv_sort2: + ∀X1,s2. X1 ≅ ⋆s2 → + ∃s1. X1 = ⋆s1. +#X1 #s2 #H elim (teqg_inv_sort2 … H) -H /2 width=2 by ex_intro/ qed-. -lemma teqx_inv_pair2: ∀I,X1,V2,T2. X1 ≛ ②[I]V2.T2 → - ∃∃V1,T1. V1 ≛ V2 & T1 ≛ T2 & X1 = ②[I]V1.T1. -#I #X1 #V2 #T2 #H -elim (teqx_inv_pair1 I V2 T2 X1) -[ #V1 #T1 #HV #HT #H destruct ] -/3 width=5 by teqx_sym, ex3_2_intro/ -qed-. +lemma teqx_inv_pair2: + ∀I,X1,V2,T2. X1 ≅ ②[I]V2.T2 → + ∃∃V1,T1. V1 ≅ V2 & T1 ≅ T2 & X1 = ②[I]V1.T1. +/2 width=1 by teqg_inv_pair2/ qed-. (* Advanced inversion lemmas ************************************************) -lemma teqx_inv_pair: ∀I1,I2,V1,V2,T1,T2. ②[I1]V1.T1 ≛ ②[I2]V2.T2 → - ∧∧ I1 = I2 & V1 ≛ V2 & T1 ≛ T2. -#I1 #I2 #V1 #V2 #T1 #T2 #H elim (teqx_inv_pair1 … H) -H -#V0 #T0 #HV #HT #H destruct /2 width=1 by and3_intro/ -qed-. - -lemma teqx_inv_pair_xy_x: ∀I,V,T. ②[I]V.T ≛ V → ⊥. -#I #V elim V -V -[ #J #T #H elim (teqx_inv_pair1 … H) -H #X #Y #_ #_ #H destruct -| #J #X #Y #IHX #_ #T #H elim (teqx_inv_pair … H) -H #H #HY #_ destruct /2 width=2 by/ -] -qed-. - -lemma teqx_inv_pair_xy_y: ∀I,T,V. ②[I]V.T ≛ T → ⊥. -#I #T elim T -T -[ #J #V #H elim (teqx_inv_pair1 … H) -H #X #Y #_ #_ #H destruct -| #J #X #Y #_ #IHY #V #H elim (teqx_inv_pair … H) -H #H #_ #HY destruct /2 width=2 by/ -] -qed-. - +lemma teqx_inv_pair: + ∀I1,I2,V1,V2,T1,T2. ②[I1]V1.T1 ≅ ②[I2]V2.T2 → + ∧∧ I1 = I2 & V1 ≅ V2 & T1 ≅ T2. +/2 width=1 by teqg_inv_pair/ qed-. +(* +lemma teqx_inv_pair_xy_x: + ∀I,V,T. ②[I]V.T ≅ V → ⊥. +/2 width=5 by teqg_inv_pair_xy_x/ qed-. + +lemma teqx_inv_pair_xy_y: + ∀I,T,V. ②[I]V.T ≅ T → ⊥. +/2 width=5 by teqg_inv_pair_xy_y/ qed-. +*) (* Basic forward lemmas *****************************************************) - -lemma teqx_fwd_atom1: ∀I,Y. ⓪[I] ≛ Y → ∃J. Y = ⓪[J]. -* #x #Y #H [ elim (teqx_inv_sort1 … H) -H ] -/3 width=4 by teqx_inv_gref1, teqx_inv_lref1, ex_intro/ -qed-. - +(* +lemma teqx_fwd_atom1: + ∀I,Y. ⓪[I] ≅ Y → ∃J. Y = ⓪[J]. +/2 width=3 by teqg_fwd_atom1/ qed-. +*) (* Advanced properties ******************************************************) -lemma teqx_dec: ∀T1,T2. Decidable (T1 ≛ T2). -#T1 elim T1 -T1 [ * #s1 | #I1 #V1 #T1 #IHV #IHT ] * [1,3,5,7: * #s2 |*: #I2 #V2 #T2 ] -[ /3 width=1 by teqx_sort, or_introl/ -|2,3,13: - @or_intror #H - elim (teqx_inv_sort1 … H) -H #x #H destruct -|4,6,14: - @or_intror #H - lapply (teqx_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 (teqx_inv_lref1 … H) -H #H destruct /2 width=1 by/ -|7,8,15: - @or_intror #H - lapply (teqx_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 (teqx_inv_gref1 … H) -H #H destruct /2 width=1 by/ -|10,11,12: - @or_intror #H - elim (teqx_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 teqx_pair, or_introl/ ] - ] - @or_intror #H - elim (teqx_inv_pair … H) -H /2 width=1 by/ -] -qed-. +lemma teqx_dec: + ∀T1,T2. Decidable (T1 ≅ T2). +/3 width=1 by teqg_dec, or_introl/ qed-. (* Negated inversion lemmas *************************************************) -lemma tneqx_inv_pair: ∀I1,I2,V1,V2,T1,T2. - (②[I1]V1.T1 ≛ ②[I2]V2.T2 → ⊥) → - ∨∨ I1 = I2 → ⊥ - | (V1 ≛ V2 → ⊥) - | (T1 ≛ T2 → ⊥). -#I1 #I2 #V1 #V2 #T1 #T2 #H12 -elim (eq_item2_dec I1 I2) /3 width=1 by or3_intro0/ #H destruct -elim (teqx_dec V1 V2) /3 width=1 by or3_intro1/ -elim (teqx_dec T1 T2) /4 width=1 by teqx_pair, or3_intro2/ -qed-. +lemma tneqx_inv_pair: + ∀I1,I2,V1,V2,T1,T2. + (②[I1]V1.T1 ≅ ②[I2]V2.T2 → ⊥) → + ∨∨ I1 = I2 → ⊥ + | (V1 ≅ V2 → ⊥) + | (T1 ≅ T2 → ⊥). +/3 width=1 by tneqg_inv_pair, or_introl/ qed-.