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 "basic_2/notation/relations/lrsubeqc_2.ma".
16 include "basic_2/grammar/lenv.ma".
18 (* RESTRICTED REFINEMENT FOR LOCAL ENVIRONMENTS *****************************)
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)
27 "restricted refinement (local environment)"
28 'LRSubEqC L1 L2 = (lsubr L1 L2).
30 (* Basic properties *********************************************************)
32 lemma lsubr_refl: ∀L. L ⫃ L.
33 #L elim L -L /2 width=1 by lsubr_atom, lsubr_pair/
36 (* Basic inversion lemmas ***************************************************)
38 fact lsubr_inv_atom1_aux: ∀L1,L2. L1 ⫃ L2 → L1 = ⋆ → L2 = ⋆.
40 [ #I #L1 #L2 #V #_ #H destruct
41 | #L1 #L2 #V #W #_ #H destruct
45 lemma lsubr_inv_atom1: ∀L2. ⋆ ⫃ L2 → L2 = ⋆.
46 /2 width=3 by lsubr_inv_atom1_aux/ qed-.
48 fact lsubr_inv_abst1_aux: ∀L1,L2. L1 ⫃ L2 → ∀K1,W. L1 = K1.ⓛW →
49 L2 = ⋆ ∨ ∃∃K2. K1 ⫃ K2 & L2 = K2.ⓛW.
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
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-.
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.
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/
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-.
76 (* Advanced inversion lemmas ************************************************)
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
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/
95 (* Basic forward lemmas *****************************************************)
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/