]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2A/substitution/lpx_sn.ma
milestone update in ground_2 and basic_2A
[helm.git] / matita / matita / contribs / lambdadelta / basic_2A / substitution / lpx_sn.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_2/xoa/ex_3_2.ma".
16 include "basic_2A/grammar/lenv_length.ma".
17
18 (* SN POINTWISE EXTENSION OF A CONTEXT-SENSITIVE REALTION FOR TERMS *********)
19
20 inductive lpx_sn (R:relation3 lenv term term): relation lenv ≝
21 | lpx_sn_atom: lpx_sn R (⋆) (⋆)
22 | lpx_sn_pair: ∀I,K1,K2,V1,V2.
23                lpx_sn R K1 K2 → R K1 V1 V2 →
24                lpx_sn R (K1. ⓑ{I} V1) (K2. ⓑ{I} V2)
25 .
26
27 (* Basic properties *********************************************************)
28
29 lemma lpx_sn_refl: ∀R. (∀L. reflexive ? (R L)) → reflexive … (lpx_sn R).
30 #R #HR #L elim L -L /2 width=1 by lpx_sn_atom, lpx_sn_pair/
31 qed-.
32
33 (* Basic inversion lemmas ***************************************************)
34
35 fact lpx_sn_inv_atom1_aux: ∀R,L1,L2. lpx_sn R L1 L2 → L1 = ⋆ → L2 = ⋆.
36 #R #L1 #L2 * -L1 -L2
37 [ //
38 | #I #K1 #K2 #V1 #V2 #_ #_ #H destruct
39 ]
40 qed-.
41
42 lemma lpx_sn_inv_atom1: ∀R,L2. lpx_sn R (⋆) L2 → L2 = ⋆.
43 /2 width=4 by lpx_sn_inv_atom1_aux/ qed-.
44
45 fact lpx_sn_inv_pair1_aux: ∀R,L1,L2. lpx_sn R L1 L2 → ∀I,K1,V1. L1 = K1. ⓑ{I} V1 →
46                            ∃∃K2,V2. lpx_sn R K1 K2 & R K1 V1 V2 & L2 = K2. ⓑ{I} V2.
47 #R #L1 #L2 * -L1 -L2
48 [ #J #K1 #V1 #H destruct
49 | #I #K1 #K2 #V1 #V2 #HK12 #HV12 #J #L #W #H destruct /2 width=5 by ex3_2_intro/
50 ]
51 qed-.
52
53 lemma lpx_sn_inv_pair1: ∀R,I,K1,V1,L2. lpx_sn R (K1. ⓑ{I} V1) L2 →
54                         ∃∃K2,V2. lpx_sn R K1 K2 & R K1 V1 V2 & L2 = K2. ⓑ{I} V2.
55 /2 width=3 by lpx_sn_inv_pair1_aux/ qed-.
56
57 fact lpx_sn_inv_atom2_aux: ∀R,L1,L2. lpx_sn R L1 L2 → L2 = ⋆ → L1 = ⋆.
58 #R #L1 #L2 * -L1 -L2
59 [ //
60 | #I #K1 #K2 #V1 #V2 #_ #_ #H destruct
61 ]
62 qed-.
63
64 lemma lpx_sn_inv_atom2: ∀R,L1. lpx_sn R L1 (⋆) → L1 = ⋆.
65 /2 width=4 by lpx_sn_inv_atom2_aux/ qed-.
66
67 fact lpx_sn_inv_pair2_aux: ∀R,L1,L2. lpx_sn R L1 L2 → ∀I,K2,V2. L2 = K2. ⓑ{I} V2 →
68                            ∃∃K1,V1. lpx_sn R K1 K2 & R K1 V1 V2 & L1 = K1. ⓑ{I} V1.
69 #R #L1 #L2 * -L1 -L2
70 [ #J #K2 #V2 #H destruct
71 | #I #K1 #K2 #V1 #V2 #HK12 #HV12 #J #K #W #H destruct /2 width=5 by ex3_2_intro/
72 ]
73 qed-.
74
75 lemma lpx_sn_inv_pair2: ∀R,I,L1,K2,V2. lpx_sn R L1 (K2. ⓑ{I} V2) →
76                         ∃∃K1,V1. lpx_sn R K1 K2 & R K1 V1 V2 & L1 = K1. ⓑ{I} V1.
77 /2 width=3 by lpx_sn_inv_pair2_aux/ qed-.
78
79 lemma lpx_sn_inv_pair: ∀R,I1,I2,L1,L2,V1,V2.
80                        lpx_sn R (L1.ⓑ{I1}V1) (L2.ⓑ{I2}V2) →
81                        ∧∧ lpx_sn R L1 L2 & R L1 V1 V2 & I1 = I2.
82 #R #I1 #I2 #L1 #L2 #V1 #V2 #H elim (lpx_sn_inv_pair1 … H) -H
83 #L0 #V0 #HL10 #HV10 #H destruct /2 width=1 by and3_intro/
84 qed-.
85
86 (* Basic forward lemmas *****************************************************)
87
88 lemma lpx_sn_fwd_length: ∀R,L1,L2. lpx_sn R L1 L2 → |L1| = |L2|.
89 #R #L1 #L2 #H elim H -L1 -L2 normalize //
90 qed-.