]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/static_2/relocation/sex_sex.ma
a92cf28c1ead5f1a28274416a987a6ad6917e5f6
[helm.git] / matita / matita / contribs / lambdadelta / static_2 / relocation / sex_sex.ma
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.cs.unibo.it                             *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 include "ground/relocation/rtmap_sand.ma".
16 include "static_2/relocation/drops.ma".
17
18 (* GENERIC ENTRYWISE EXTENSION OF CONTEXT-SENSITIVE REALTIONS FOR TERMS *****)
19
20 (* Main properties **********************************************************)
21
22 theorem sex_trans_gen (RN1) (RP1) (RN2) (RP2) (RN) (RP):
23         ∀L1,f.
24         (∀g,I,K,n. ⇩[n] L1 ≘ K.ⓘ[I] → ↑g = ⫰*[n] f → R_pw_transitive_sex RN1 RN2 RN RN1 RP1 g K I) →
25         (∀g,I,K,n. ⇩[n] L1 ≘ K.ⓘ[I] → ⫯g = ⫰*[n] f → R_pw_transitive_sex RP1 RP2 RP RN1 RP1 g K I) →
26         ∀L0. L1 ⪤[RN1,RP1,f] L0 →
27         ∀L2. L0 ⪤[RN2,RP2,f] L2 →
28         L1 ⪤[RN,RP,f] L2.
29 #RN1 #RP1 #RN2 #RP2 #RN #RP #L1 elim L1 -L1
30 [ #f #_ #_ #L0 #H1 #L2 #H2
31   lapply (sex_inv_atom1 … H1) -H1 #H destruct
32   lapply (sex_inv_atom1 … H2) -H2 #H destruct
33   /2 width=1 by sex_atom/
34 | #K1 #I1 #IH #f elim (pn_split f) * #g #H destruct
35   #HN #HP #L0 #H1 #L2 #H2
36   [ elim (sex_inv_push1 … H1) -H1 #I0 #K0 #HK10 #HI10 #H destruct
37     elim (sex_inv_push1 … H2) -H2 #I2 #K2 #HK02 #HI02 #H destruct
38     lapply (HP … 0 … HI10 … HK10 … HI02) -HI10 -HI02 /2 width=2 by drops_refl/ #HI12
39     lapply (IH … HK10 … HK02) -IH -K0 /3 width=3 by sex_push, drops_drop/
40   | elim (sex_inv_next1 … H1) -H1 #I0 #K0 #HK10 #HI10 #H destruct
41     elim (sex_inv_next1 … H2) -H2 #I2 #K2 #HK02 #HI02 #H destruct
42     lapply (HN … 0 … HI10 … HK10 … HI02) -HI10 -HI02 /2 width=2 by drops_refl/ #HI12
43     lapply (IH … HK10 … HK02) -IH -K0 /3 width=3 by sex_next, drops_drop/
44   ]
45 ]
46 qed-.
47
48 theorem sex_trans (RN) (RP) (f):
49         (∀g,I,K. R_pw_transitive_sex RN RN RN RN RP g K I) →
50         (∀g,I,K. R_pw_transitive_sex RP RP RP RN RP g K I) →
51         Transitive … (sex RN RP f).
52 /2 width=9 by sex_trans_gen/ qed-.
53
54 theorem sex_trans_id_cfull (R1) (R2) (R3):
55         ∀L1,L,f. L1 ⪤[R1,cfull,f] L → 𝐈❪f❫ →
56         ∀L2. L ⪤[R2,cfull,f] L2 → L1 ⪤[R3,cfull,f] L2.
57 #R1 #R2 #R3 #L1 #L #f #H elim H -L1 -L -f
58 [ #f #Hf #L2 #H >(sex_inv_atom1 … H) -L2 // ]
59 #f #I1 #I #K1 #K #HK1 #_ #IH #Hf #L2 #H
60 [ elim (isid_inv_next … Hf) | lapply (isid_inv_push … Hf ??) ] -Hf [5: |*: // ] #Hf
61 elim (sex_inv_push1 … H) -H #I2 #K2 #HK2 #_ #H destruct
62 /3 width=1 by sex_push/
63 qed-.
64
65 theorem sex_conf (RN1) (RP1) (RN2) (RP2):
66         ∀L,f.
67         (∀g,I,K,n. ⇩[n] L ≘ K.ⓘ[I] → ↑g = ⫰*[n] f → R_pw_confluent2_sex RN1 RN2 RN1 RP1 RN2 RP2 g K I) →
68         (∀g,I,K,n. ⇩[n] L ≘ K.ⓘ[I] → ⫯g = ⫰*[n] f → R_pw_confluent2_sex RP1 RP2 RN1 RP1 RN2 RP2 g K I) →
69         pw_confluent2 … (sex RN1 RP1 f) (sex RN2 RP2 f) L.
70 #RN1 #RP1 #RN2 #RP2 #L elim L -L
71 [ #f #_ #_ #L1 #H1 #L2 #H2 >(sex_inv_atom1 … H1) >(sex_inv_atom1 … H2) -H2 -H1
72   /2 width=3 by sex_atom, ex2_intro/
73 | #L #I0 #IH #f elim (pn_split f) * #g #H destruct
74   #HN #HP #Y1 #H1 #Y2 #H2
75   [ elim (sex_inv_push1 … H1) -H1 #I1 #L1 #HL1 #HI01 #H destruct
76     elim (sex_inv_push1 … H2) -H2 #I2 #L2 #HL2 #HI02 #H destruct
77     elim (HP … 0 … HI01 … HI02 … HL1 … HL2) -HI01 -HI02 /2 width=2 by drops_refl/ #I #HI1 #HI2
78     elim (IH … HL1 … HL2) -IH -HL1 -HL2 /3 width=5 by drops_drop, sex_push, ex2_intro/
79   | elim (sex_inv_next1 … H1) -H1 #I1 #L1 #HL1 #HI01 #H destruct
80     elim (sex_inv_next1 … H2) -H2 #I2 #L2 #HL2 #HI02 #H destruct
81     elim (HN … 0 … HI01 … HI02 … HL1 … HL2) -HI01 -HI02 /2 width=2 by drops_refl/ #I #HI1 #HI2
82     elim (IH … HL1 … HL2) -IH -HL1 -HL2 /3 width=5 by drops_drop, sex_next, ex2_intro/
83   ]
84 ]
85 qed-.
86
87 lemma sex_repl (RN) (RP) (SN) (SP) (L1) (f):
88       (∀g,I,K1,n. ⇩[n] L1 ≘ K1.ⓘ[I] → ↑g = ⫰*[n] f → R_pw_replace3_sex … RN SN RN RP SN SP g K1 I) →
89       (∀g,I,K1,n. ⇩[n] L1 ≘ K1.ⓘ[I] → ⫯g = ⫰*[n] f → R_pw_replace3_sex … RP SP RN RP SN SP g K1 I) →
90       ∀L2. L1 ⪤[RN,RP,f] L2 → ∀K1. L1 ⪤[SN,SP,f] K1 →
91       ∀K2. L2 ⪤[SN,SP,f] K2 → K1 ⪤[RN,RP,f] K2.
92 #RN #RP #SN #SP #L1 elim L1 -L1
93 [ #f #_ #_ #Y #HY #Y1 #HY1 #Y2 #HY2
94   lapply (sex_inv_atom1 … HY) -HY #H destruct
95   lapply (sex_inv_atom1 … HY1) -HY1 #H destruct
96   lapply (sex_inv_atom1 … HY2) -HY2 #H destruct //
97 | #L1 #I1 #IH #f elim (pn_split f) * #g #H destruct
98   #HN #HP #Y #HY #Y1 #HY1 #Y2 #HY2
99   [ elim (sex_inv_push1 … HY) -HY #I2 #L2 #HL12 #HI12 #H destruct
100     elim (sex_inv_push1 … HY1) -HY1 #J1 #K1 #HLK1 #HIJ1 #H destruct
101     elim (sex_inv_push1 … HY2) -HY2 #J2 #K2 #HLK2 #HIJ2 #H destruct
102     /5 width=13 by sex_push, drops_refl, drops_drop/
103   | elim (sex_inv_next1 … HY) -HY #I2 #L2 #HL12 #HI12 #H destruct
104     elim (sex_inv_next1 … HY1) -HY1 #J1 #K1 #HLK1 #HIJ1 #H destruct
105     elim (sex_inv_next1 … HY2) -HY2 #J2 #K2 #HLK2 #HIJ2 #H destruct
106     /5 width=13 by sex_next, drops_refl, drops_drop/
107   ]
108 ]
109 qed-.
110
111 theorem sex_canc_sn (RN) (RP):
112         ∀f. Transitive … (sex RN RP f) → symmetric … (sex RN RP f) →
113         left_cancellable … (sex RN RP f).
114 /3 width=3 by/ qed-.
115
116 theorem sex_canc_dx (RN) (RP):
117         ∀f. Transitive … (sex RN RP f) → symmetric … (sex RN RP f) →
118         right_cancellable … (sex RN RP f).
119 /3 width=3 by/ qed-.
120
121 lemma sex_meet (RN) (RP) (L1) (L2):
122       ∀f1. L1 ⪤[RN,RP,f1] L2 →
123       ∀f2. L1 ⪤[RN,RP,f2] L2 →
124       ∀f. f1 ⋒ f2 ≘ f → L1 ⪤[RN,RP,f] L2.
125 #RN #RP #L1 #L2 #f1 #H elim H -f1 -L1 -L2 //
126 #f1 #I1 #I2 #L1 #L2 #_ #HI12 #IH #f2 #H #f #Hf
127 elim (pn_split f2) * #g2 #H2 destruct
128 try elim (sex_inv_push … H) try elim (sex_inv_next … H) -H
129 [ elim (sand_inv_npx … Hf) | elim (sand_inv_nnx … Hf)
130 | elim (sand_inv_ppx … Hf) | elim (sand_inv_pnx … Hf)
131 ] -Hf /3 width=5 by sex_next, sex_push/
132 qed-.
133
134 lemma sex_join (RN) (RP) (L1) (L2):
135       ∀f1. L1 ⪤[RN,RP,f1] L2 →
136       ∀f2. L1 ⪤[RN,RP,f2] L2 →
137       ∀f. f1 ⋓ f2 ≘ f → L1 ⪤[RN,RP,f] L2.
138 #RN #RP #L1 #L2 #f1 #H elim H -f1 -L1 -L2 //
139 #f1 #I1 #I2 #L1 #L2 #_ #HI12 #IH #f2 #H #f #Hf
140 elim (pn_split f2) * #g2 #H2 destruct
141 try elim (sex_inv_push … H) try elim (sex_inv_next … H) -H
142 [ elim (sor_inv_npx … Hf) | elim (sor_inv_nnx … Hf)
143 | elim (sor_inv_ppx … Hf) | elim (sor_inv_pnx … Hf)
144 ] -Hf /3 width=5 by sex_next, sex_push/
145 qed-.