]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/static/lsubr.ma
advances towards confluence of reduction in local environments ...
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / static / lsubr.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 "basic_2/notation/relations/lrsubeqc_2.ma".
16 include "basic_2/grammar/lenv.ma".
17
18 (* RESTRICTED REFINEMENT FOR LOCAL ENVIRONMENTS *****************************)
19
20 inductive lsubr: relation lenv ≝
21 | lsubr_atom: ∀L. lsubr L (⋆)
22 | lsubr_pair: ∀I,L1,L2,V. lsubr L1 L2 → lsubr (L1.ⓑ{I}V) (L2.ⓑ{I}V)
23 | lsubr_beta: ∀L1,L2,V,W. lsubr L1 L2 → lsubr (L1.ⓓⓝW.V) (L2.ⓛW)
24 .
25
26 interpretation
27   "restricted refinement (local environment)"
28   'LRSubEqC L1 L2 = (lsubr L1 L2).
29
30 (* Basic properties *********************************************************)
31
32 lemma lsubr_refl: ∀L. L ⫃ L.
33 #L elim L -L /2 width=1 by lsubr_atom, lsubr_pair/
34 qed.
35
36 (* Basic inversion lemmas ***************************************************)
37
38 fact lsubr_inv_atom1_aux: ∀L1,L2. L1 ⫃ L2 → L1 = ⋆ → L2 = ⋆.
39 #L1 #L2 * -L1 -L2 //
40 [ #I #L1 #L2 #V #_ #H destruct
41 | #L1 #L2 #V #W #_ #H destruct
42 ]
43 qed-.
44
45 lemma lsubr_inv_atom1: ∀L2. ⋆ ⫃ L2 → L2 = ⋆.
46 /2 width=3 by lsubr_inv_atom1_aux/ qed-.
47
48 fact lsubr_inv_abst1_aux: ∀L1,L2. L1 ⫃ L2 → ∀K1,W. L1 = K1.ⓛW →
49                           L2 = ⋆ ∨ ∃∃K2. K1 ⫃ K2 & L2 = K2.ⓛW.
50 #L1 #L2 * -L1 -L2
51 [ #L #K1 #W #H destruct /2 width=1 by or_introl/
52 | #I #L1 #L2 #V #HL12 #K1 #W #H destruct /3 width=3 by ex2_intro, or_intror/
53 | #L1 #L2 #V1 #V2 #_ #K1 #W #H destruct
54 ]
55 qed-.
56
57 lemma lsubr_inv_abst1: ∀K1,L2,W. K1.ⓛW ⫃ L2 →
58                        L2 = ⋆ ∨ ∃∃K2. K1 ⫃ K2 & L2 = K2.ⓛW.
59 /2 width=3 by lsubr_inv_abst1_aux/ qed-.
60
61 fact lsubr_inv_pair2_aux: ∀L1,L2. L1 ⫃ L2 → ∀I,K2,W. L2 = K2.ⓑ{I}W →
62                           (∃∃K1. K1 ⫃ K2 & L1 = K1.ⓑ{I}W) ∨
63                           ∃∃K1,V. K1 ⫃ K2 & L1 = K1.ⓓⓝW.V & I = Abst.
64 #L1 #L2 * -L1 -L2
65 [ #L #J #K2 #W #H destruct
66 | #I #L1 #L2 #V #HL12 #J #K2 #W #H destruct /3 width=3 by ex2_intro, or_introl/
67 | #L1 #L2 #V1 #V2 #HL12 #J #K2 #W #H destruct /3 width=4 by ex3_2_intro, or_intror/
68 ]
69 qed-.
70
71 lemma lsubr_inv_pair2: ∀I,L1,K2,W. L1 ⫃ K2.ⓑ{I}W →
72                        (∃∃K1. K1 ⫃ K2 & L1 = K1.ⓑ{I}W) ∨
73                        ∃∃K1,V1. K1 ⫃ K2 & L1 = K1.ⓓⓝW.V1 & I = Abst.
74 /2 width=3 by lsubr_inv_pair2_aux/ qed-.
75
76 (* Advanced inversion lemmas ************************************************)
77
78 lemma lsubr_inv_abbr2: ∀L1,K2,V. L1 ⫃ K2.ⓓV →
79                        ∃∃K1. K1 ⫃ K2 & L1 = K1.ⓓV.
80 #L1 #K2 #V #H elim (lsubr_inv_pair2 … H) -H *
81 [ #K1 #HK12 #H destruct /2 width=3 by ex2_intro/
82 | #K1 #V1 #_ #_ #H destruct
83 ]
84 qed-.
85
86 lemma lsubr_inv_abst2: ∀L1,K2,W. L1 ⫃ K2.ⓛW →
87                        (∃∃K1. K1 ⫃ K2 & L1 = K1.ⓛW) ∨
88                        ∃∃K1,V. K1 ⫃ K2 & L1 = K1.ⓓⓝW.V.
89 #L1 #K2 #W #H elim (lsubr_inv_pair2 … H) -H *
90 [ #K1 #HK12 #H destruct /3 width=3 by ex2_intro, or_introl/
91 | #K1 #V1 #HK12 #H #_ destruct /3 width=4 by ex2_2_intro, or_intror/
92 ]
93 qed-.
94
95 (* Basic forward lemmas *****************************************************)
96
97 lemma lsubr_fwd_pair2: ∀I2,L1,K2,V2. L1 ⫃ K2.ⓑ{I2}V2 →
98                        ∃∃I1,K1,V1. K1 ⫃ K2 & L1 = K1.ⓑ{I1}V1.
99 #I2 #L1 #K2 #V2 #H elim (lsubr_inv_pair2 … H) -H *
100 [ #K1 #HK12 #H destruct /3 width=5 by ex2_3_intro/
101 | #K1 #V1 #HK12 #H1 #H2 destruct /3 width=5 by ex2_3_intro/
102 ]
103 qed-.