]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2A/reduction/crr.ma
update in binararies for λδ
[helm.git] / matita / matita / contribs / lambdadelta / basic_2A / reduction / crr.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_2A/notation/relations/predreducible_3.ma".
16 include "basic_2A/grammar/genv.ma".
17 include "basic_2A/substitution/drop.ma".
18
19 (* REDUCIBLE TERMS FOR CONTEXT-SENSITIVE REDUCTION **************************)
20
21 (* reducible binary items *)
22 definition ri2: predicate item2 ≝
23                 λI. I = Bind2 true Abbr ∨ I = Flat2 Cast.
24
25 (* irreducible binary binders *)
26 definition ib2: relation2 bool bind2 ≝
27                 λa,I. I = Abst ∨ Bind2 a I = Bind2 false Abbr.
28
29 (* activate genv *)
30 inductive crr (G:genv): relation2 lenv term ≝
31 | crr_delta  : ∀L,K,V,i. ⬇[i] L ≡ K.ⓓV → crr G L (#i)
32 | crr_appl_sn: ∀L,V,T. crr G L V → crr G L (ⓐV.T)
33 | crr_appl_dx: ∀L,V,T. crr G L T → crr G L (ⓐV.T)
34 | crr_ri2    : ∀I,L,V,T. ri2 I → crr G L (②{I}V.T)
35 | crr_ib2_sn : ∀a,I,L,V,T. ib2 a I → crr G L V → crr G L (ⓑ{a,I}V.T)
36 | crr_ib2_dx : ∀a,I,L,V,T. ib2 a I → crr G (L.ⓑ{I}V) T → crr G L (ⓑ{a,I}V.T)
37 | crr_beta   : ∀a,L,V,W,T. crr G L (ⓐV.ⓛ{a}W.T)
38 | crr_theta  : ∀a,L,V,W,T. crr G L (ⓐV.ⓓ{a}W.T)
39 .
40
41 interpretation
42    "reducibility for context-sensitive reduction (term)"
43    'PRedReducible G L T = (crr G L T).
44
45 (* Basic inversion lemmas ***************************************************)
46
47 fact crr_inv_sort_aux: ∀G,L,T,k. ⦃G, L⦄ ⊢ ➡ 𝐑⦃T⦄ → T = ⋆k → ⊥.
48 #G #L #T #k0 * -L -T
49 [ #L #K #V #i #HLK #H destruct
50 | #L #V #T #_ #H destruct
51 | #L #V #T #_ #H destruct
52 | #I #L #V #T #_ #H destruct
53 | #a #I #L #V #T #_ #_ #H destruct
54 | #a #I #L #V #T #_ #_ #H destruct
55 | #a #L #V #W #T #H destruct
56 | #a #L #V #W #T #H destruct
57 ]
58 qed-.
59
60 lemma crr_inv_sort: ∀G,L,k. ⦃G, L⦄ ⊢ ➡ 𝐑⦃⋆k⦄ → ⊥.
61 /2 width=6 by crr_inv_sort_aux/ qed-.
62
63 fact crr_inv_lref_aux: ∀G,L,T,i. ⦃G, L⦄ ⊢ ➡ 𝐑⦃T⦄ → T = #i →
64                        ∃∃K,V. ⬇[i] L ≡ K.ⓓV.
65 #G #L #T #j * -L -T
66 [ #L #K #V #i #HLK #H destruct /2 width=3 by ex1_2_intro/
67 | #L #V #T #_ #H destruct
68 | #L #V #T #_ #H destruct
69 | #I #L #V #T #_ #H destruct
70 | #a #I #L #V #T #_ #_ #H destruct
71 | #a #I #L #V #T #_ #_ #H destruct
72 | #a #L #V #W #T #H destruct
73 | #a #L #V #W #T #H destruct
74 ]
75 qed-.
76
77 lemma crr_inv_lref: ∀G,L,i. ⦃G, L⦄ ⊢ ➡ 𝐑⦃#i⦄ → ∃∃K,V. ⬇[i] L ≡ K.ⓓV.
78 /2 width=4 by crr_inv_lref_aux/ qed-.
79
80 fact crr_inv_gref_aux: ∀G,L,T,p. ⦃G, L⦄ ⊢ ➡ 𝐑⦃T⦄ → T = §p → ⊥.
81 #G #L #T #q * -L -T
82 [ #L #K #V #i #HLK #H destruct
83 | #L #V #T #_ #H destruct
84 | #L #V #T #_ #H destruct
85 | #I #L #V #T #_ #H destruct
86 | #a #I #L #V #T #_ #_ #H destruct
87 | #a #I #L #V #T #_ #_ #H destruct
88 | #a #L #V #W #T #H destruct
89 | #a #L #V #W #T #H destruct
90 ]
91 qed-.
92
93 lemma crr_inv_gref: ∀G,L,p. ⦃G, L⦄ ⊢ ➡ 𝐑⦃§p⦄ → ⊥.
94 /2 width=6 by crr_inv_gref_aux/ qed-.
95
96 lemma trr_inv_atom: ∀G,I. ⦃G, ⋆⦄ ⊢ ➡ 𝐑⦃⓪{I}⦄ → ⊥.
97 #G * #i #H
98 [ elim (crr_inv_sort … H)
99 | elim (crr_inv_lref … H) -H #L #V #H
100   elim (drop_inv_atom1 … H) -H #H destruct
101 | elim (crr_inv_gref … H)
102 ]
103 qed-.
104
105 fact crr_inv_ib2_aux: ∀a,I,G,L,W,U,T. ib2 a I → ⦃G, L⦄ ⊢ ➡ 𝐑⦃T⦄ → T = ⓑ{a,I}W.U →
106                       ⦃G, L⦄ ⊢ ➡ 𝐑⦃W⦄ ∨ ⦃G, L.ⓑ{I}W⦄ ⊢ ➡ 𝐑⦃U⦄.
107 #G #b #J #L #W0 #U #T #HI * -L -T
108 [ #L #K #V #i #_ #H destruct
109 | #L #V #T #_ #H destruct
110 | #L #V #T #_ #H destruct
111 | #I #L #V #T #H1 #H2 destruct
112   elim H1 -H1 #H destruct
113   elim HI -HI #H destruct
114 | #a #I #L #V #T #_ #HV #H destruct /2 width=1 by or_introl/
115 | #a #I #L #V #T #_ #HT #H destruct /2 width=1 by or_intror/
116 | #a #L #V #W #T #H destruct
117 | #a #L #V #W #T #H destruct
118 ]
119 qed-.
120
121 lemma crr_inv_ib2: ∀a,I,G,L,W,T. ib2 a I → ⦃G, L⦄ ⊢ ➡ 𝐑⦃ⓑ{a,I}W.T⦄ →
122                    ⦃G, L⦄ ⊢ ➡ 𝐑⦃W⦄ ∨ ⦃G, L.ⓑ{I}W⦄ ⊢ ➡ 𝐑⦃T⦄.
123 /2 width=5 by crr_inv_ib2_aux/ qed-.
124
125 fact crr_inv_appl_aux: ∀G,L,W,U,T. ⦃G, L⦄ ⊢ ➡ 𝐑⦃T⦄ → T = ⓐW.U →
126                        ∨∨ ⦃G, L⦄ ⊢ ➡ 𝐑⦃W⦄ | ⦃G, L⦄ ⊢ ➡ 𝐑⦃U⦄ | (𝐒⦃U⦄ → ⊥).
127 #G #L #W0 #U #T * -L -T
128 [ #L #K #V #i #_ #H destruct
129 | #L #V #T #HV #H destruct /2 width=1 by or3_intro0/
130 | #L #V #T #HT #H destruct /2 width=1 by or3_intro1/
131 | #I #L #V #T #H1 #H2 destruct
132   elim H1 -H1 #H destruct
133 | #a #I #L #V #T #_ #_ #H destruct
134 | #a #I #L #V #T #_ #_ #H destruct
135 | #a #L #V #W #T #H destruct
136   @or3_intro2 #H elim (simple_inv_bind … H)
137 | #a #L #V #W #T #H destruct
138   @or3_intro2 #H elim (simple_inv_bind … H)
139 ]
140 qed-.
141
142 lemma crr_inv_appl: ∀G,L,V,T. ⦃G, L⦄ ⊢ ➡ 𝐑⦃ⓐV.T⦄ →
143                               ∨∨ ⦃G, L⦄ ⊢ ➡ 𝐑⦃V⦄ | ⦃G, L⦄ ⊢ ➡ 𝐑⦃T⦄ | (𝐒⦃T⦄ → ⊥).
144 /2 width=3 by crr_inv_appl_aux/ qed-.