]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/static_2/etc/scl/scl.etc
more additions and corrections for the article
[helm.git] / matita / matita / contribs / lambdadelta / static_2 / etc / scl / scl.etc
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 "static_2/notation/relations/clearsn_3.ma".
16 include "static_2/syntax/cext2.ma".
17 include "static_2/relocation/sex.ma".
18
19 (* CLEAR FOR LOCAL ENVIRONMENTS ON SELECTED ENTRIES *************************)
20
21 definition ccl: relation3 lenv bind bind ≝ λL,I1,I2. BUnit Void = I2.
22
23 definition scl: rtmap → relation lenv ≝ sex ccl (cext2 ceq).
24
25 interpretation
26   "clear (local environment)"
27   'ClearSn f L1 L2 = (scl f L1 L2).
28
29 (* Basic eliminators ********************************************************)
30
31 lemma scl_ind (Q:rtmap→relation lenv): 
32       (∀f. Q f (⋆) (⋆)) →
33       (∀f,I,K1,K2. K1 ⊐ⓧ[f] K2 → Q f K1 K2 → Q (⫯f) (K1.ⓘ{I}) (K2.ⓘ{I})) →
34       (∀f,I,K1,K2. K1 ⊐ⓧ[f] K2 → Q f K1 K2 → Q (↑f) (K1.ⓘ{I}) (K2.ⓧ)) →
35       ∀f,L1,L2. L1 ⊐ⓧ[f] L2 → Q f L1 L2.
36 #Q #IH1 #IH2 #IH3 #f #L1 #L2 #H elim H -f -L1 -L2 
37 [ //
38 | #f #I1 #I2 #K1 #K2 #HK #H #IH destruct /2 by/
39 | #f #I1 #I2 #K1 #K2 #HK * #I [| #V1 #V2 #H ] #IH destruct /2 by/
40 ]
41 qed-.
42
43 (* Basic inversion lemmas ***************************************************)
44
45 lemma scl_inv_atom_sn: ∀g,L2. ⋆ ⊐ⓧ[g] L2 → L2 = ⋆.
46 /2 width=4 by sex_inv_atom1/ qed-.
47
48 lemma scl_inv_push_sn: ∀f,I,K1,L2. K1.ⓘ{I} ⊐ⓧ[⫯f] L2 →
49                        ∃∃K2. K1 ⊐ⓧ[f] K2 & L2 = K2.ⓘ{I}.
50 #f #I #K1 #L2 #H
51 elim (sex_inv_push1 … H) -H #J #K2 #HK12 *
52 /2 width=3 by ex2_intro/
53 qed-.
54
55 lemma scl_inv_next_sn: ∀f,I,K1,L2. K1.ⓘ{I} ⊐ⓧ[↑f] L2 →
56                        ∃∃K2. K1 ⊐ⓧ[f] K2 & L2 = K2.ⓧ.
57 #f #I #K1 #L2 #H
58 elim (sex_inv_next1 … H) -H
59 /2 width=3 by ex2_intro/
60 qed-.
61
62 (* Advanced inversion lemmas ************************************************)
63
64 lemma scl_inv_bind_sn_gen: ∀g,I,K1,L2. K1.ⓘ{I} ⊐ⓧ[g] L2 →
65                            ∨∨ ∃∃f,K2. K1 ⊐ⓧ[f] K2 & g = ⫯f & L2 = K2.ⓘ{I}
66                             | ∃∃f,K2. K1 ⊐ⓧ[f] K2 & g = ↑f & L2 = K2.ⓧ.
67 #g #I #K1 #L2 #H
68 elim (pn_split g) * #f #Hf destruct
69 [ elim (scl_inv_push_sn … H) -H
70 | elim (scl_inv_next_sn … H) -H
71 ]
72 /3 width=5 by ex3_2_intro, or_intror, or_introl/
73 qed-.
74
75 (* Advanced forward lemmas **************************************************)
76
77 lemma scl_fwd_bind_sn: ∀g,I1,K1,L2. K1.ⓘ{I1} ⊐ⓧ[g] L2 →
78                        ∃∃I2,K2. K1 ⊐ⓧ[⫱g] K2 & L2 = K2.ⓘ{I2}.
79 #g #I1 #K1 #L2
80 elim (pn_split g) * #f #Hf destruct #H
81 [ elim (scl_inv_push_sn … H) -H
82 | elim (scl_inv_next_sn … H) -H
83 ]
84 /2 width=4 by ex2_2_intro/
85 qed-.
86
87 (* Basic properties *********************************************************)
88
89 lemma scl_atom: ∀f. ⋆ ⊐ⓧ[f] ⋆.
90 /by sex_atom/ qed.
91
92 lemma scl_push: ∀f,K1,K2. K1 ⊐ⓧ[f] K2 → ∀I. K1.ⓘ{I} ⊐ⓧ[⫯f] K2.ⓘ{I}.
93 #f #K1 #K2 #H * /3 width=1 by sex_push, ext2_unit, ext2_pair/
94 qed.
95
96 lemma scl_next: ∀f,K1,K2. K1 ⊐ⓧ[f] K2 → ∀I. K1.ⓘ{I} ⊐ⓧ[↑f] K2.ⓧ.
97 /2 width=1 by sex_next/ qed.
98
99 lemma scl_eq_repl_back: ∀L1,L2. eq_repl_back … (λf. L1 ⊐ⓧ[f] L2).
100 /2 width=3 by sex_eq_repl_back/ qed-.
101
102 lemma scl_eq_repl_fwd: ∀L1,L2. eq_repl_fwd … (λf. L1 ⊐ⓧ[f] L2).
103 /2 width=3 by sex_eq_repl_fwd/ qed-.
104
105 (* Advanced properties ******************************************************)
106
107 lemma scl_refl: ∀f. 𝐈⦃f⦄ → reflexive … (scl f).
108 #f #Hf #L elim L -L
109 /3 width=3 by scl_eq_repl_back, scl_push, eq_push_inv_isid/
110 qed.