1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 include "ground/lib/star.ma".
16 include "basic_2A/substitution/lpx_sn.ma".
18 (* SN POINTWISE EXTENSION OF A CONTEXT-SENSITIVE REALTION FOR TERMS *********)
20 (* Properties on transitive_closure *****************************************)
22 lemma TC_lpx_sn_pair_refl: ∀R. (∀L. reflexive … (R L)) →
23 ∀L1,L2. TC … (lpx_sn R) L1 L2 →
24 ∀I,V. TC … (lpx_sn R) (L1. ⓑ{I} V) (L2. ⓑ{I} V).
25 #R #HR #L1 #L2 #H @(TC_star_ind … L2 H) -L2
26 [ /2 width=1 by lpx_sn_refl/
27 | /3 width=1 by TC_reflexive, lpx_sn_refl/
28 | /3 width=5 by lpx_sn_pair, step/
32 lemma TC_lpx_sn_pair: ∀R. (∀L. reflexive … (R L)) →
33 ∀I,L1,L2. TC … (lpx_sn R) L1 L2 →
34 ∀V1,V2. CTC … R L1 V1 V2 →
35 TC … (lpx_sn R) (L1. ⓑ{I} V1) (L2. ⓑ{I} V2).
36 #R #HR #I #L1 #L2 #HL12 #V1 #V2 #H @(TC_star_ind_dx … V1 H) -V1 //
37 [ /2 width=1 by TC_lpx_sn_pair_refl/
38 | /4 width=3 by TC_strap, lpx_sn_pair, lpx_sn_refl/
42 lemma lpx_sn_LTC_TC_lpx_sn: ∀R. (∀L. reflexive … (R L)) →
43 ∀L1,L2. lpx_sn (CTC … R) L1 L2 →
44 TC … (lpx_sn R) L1 L2.
45 #R #HR #L1 #L2 #H elim H -L1 -L2
46 /2 width=1 by TC_lpx_sn_pair, lpx_sn_atom, inj/
49 (* Inversion lemmas on transitive closure ***********************************)
51 lemma TC_lpx_sn_inv_atom2: ∀R,L1. TC … (lpx_sn R) L1 (⋆) → L1 = ⋆.
52 #R #L1 #H @(TC_ind_dx … L1 H) -L1
53 [ /2 width=2 by lpx_sn_inv_atom2/
54 | #L1 #L #HL1 #_ #IHL2 destruct /2 width=2 by lpx_sn_inv_atom2/
58 lemma TC_lpx_sn_inv_pair2: ∀R. s_rs_transitive … R (λ_. lpx_sn R) →
59 ∀I,L1,K2,V2. TC … (lpx_sn R) L1 (K2.ⓑ{I}V2) →
60 ∃∃K1,V1. TC … (lpx_sn R) K1 K2 & CTC … R K1 V1 V2 & L1 = K1. ⓑ{I} V1.
61 #R #HR #I #L1 #K2 #V2 #H @(TC_ind_dx … L1 H) -L1
62 [ #L1 #H elim (lpx_sn_inv_pair2 … H) -H /3 width=5 by inj, ex3_2_intro/
63 | #L1 #L #HL1 #_ * #K #V #HK2 #HV2 #H destruct
64 elim (lpx_sn_inv_pair2 … HL1) -HL1 #K1 #V1 #HK1 #HV1 #H destruct
65 lapply (HR … HV2 … HK1) -HR -HV2 /3 width=5 by TC_strap, ex3_2_intro/
69 lemma TC_lpx_sn_ind: ∀R. s_rs_transitive … R (λ_. lpx_sn R) →
73 TC … (lpx_sn R) K1 K2 → CTC … R K1 V1 V2 →
74 S K1 K2 → S (K1.ⓑ{I}V1) (K2.ⓑ{I}V2)
76 ∀L2,L1. TC … (lpx_sn R) L1 L2 → S L1 L2.
77 #R #HR #S #IH1 #IH2 #L2 elim L2 -L2
78 [ #X #H >(TC_lpx_sn_inv_atom2 … H) -X //
79 | #L2 #I #V2 #IHL2 #X #H
80 elim (TC_lpx_sn_inv_pair2 … H) // -H -HR
81 #L1 #V1 #HL12 #HV12 #H destruct /3 width=1 by/
85 lemma TC_lpx_sn_inv_atom1: ∀R,L2. TC … (lpx_sn R) (⋆) L2 → L2 = ⋆.
87 [ /2 width=2 by lpx_sn_inv_atom1/
88 | #L #L2 #_ #HL2 #IHL1 destruct /2 width=2 by lpx_sn_inv_atom1/
92 fact TC_lpx_sn_inv_pair1_aux: ∀R. s_rs_transitive … R (λ_. lpx_sn R) →
93 ∀L1,L2. TC … (lpx_sn R) L1 L2 →
94 ∀I,K1,V1. L1 = K1.ⓑ{I}V1 →
95 ∃∃K2,V2. TC … (lpx_sn R) K1 K2 & CTC … R K1 V1 V2 & L2 = K2. ⓑ{I} V2.
96 #R #HR #L1 #L2 #H @(TC_lpx_sn_ind … H) // -HR -L1 -L2
97 [ #J #K #W #H destruct
98 | #I #L1 #L2 #V1 #V2 #HL12 #HV12 #_ #J #K #W #H destruct /2 width=5 by ex3_2_intro/
102 lemma TC_lpx_sn_inv_pair1: ∀R. s_rs_transitive … R (λ_. lpx_sn R) →
103 ∀I,K1,L2,V1. TC … (lpx_sn R) (K1.ⓑ{I}V1) L2 →
104 ∃∃K2,V2. TC … (lpx_sn R) K1 K2 & CTC … R K1 V1 V2 & L2 = K2. ⓑ{I} V2.
105 /2 width=3 by TC_lpx_sn_inv_pair1_aux/ qed-.
107 lemma TC_lpx_sn_inv_lpx_sn_LTC: ∀R. s_rs_transitive … R (λ_. lpx_sn R) →
108 ∀L1,L2. TC … (lpx_sn R) L1 L2 →
109 lpx_sn (CTC … R) L1 L2.
110 /3 width=4 by TC_lpx_sn_ind, lpx_sn_pair/ qed-.
112 (* Forward lemmas on transitive closure *************************************)
114 lemma TC_lpx_sn_fwd_length: ∀R,L1,L2. TC … (lpx_sn R) L1 L2 → |L1| = |L2|.
115 #R #L1 #L2 #H elim H -L2
116 [ #L2 #HL12 >(lpx_sn_fwd_length … HL12) -HL12 //
117 | #L #L2 #_ #HL2 #IHL1
118 >IHL1 -L1 >(lpx_sn_fwd_length … HL2) -HL2 //