]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambda_delta/basic_2/reducibility/crf.ma
- we introduced the pointer_step rc in the perspective of proving
[helm.git] / matita / matita / contribs / lambda_delta / basic_2 / reducibility / crf.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/substitution/ldrop.ma".
16
17 (* CONTEXT-SENSITIVE REDUCIBLE TERMS ****************************************)
18
19 (* reducible binary items *)
20 definition ri2: item2 → Prop ≝
21                 λI. I = Bind2 true Abbr ∨ I = Flat2 Cast.
22
23 (* irreducible binary binders *)
24 definition ib2: bool → bind2 → Prop ≝
25                 λa,I. I = Abst ∨ Bind2 a I = Bind2 false Abbr.
26
27 (* reducible terms *)
28 inductive crf: lenv → predicate term ≝
29 | crf_delta  : ∀L,K,V,i. ⇩[0, i] L ≡ K.ⓓV → crf L (#i)
30 | crf_appl_sn: ∀L,V,T. crf L V → crf L (ⓐV. T)
31 | crf_appl_dx: ∀L,V,T. crf L T → crf L (ⓐV. T)
32 | crf_ri2    : ∀I,L,V,T. ri2 I → crf L (②{I}V. T)
33 | crf_ib2_sn : ∀a,I,L,V,T. ib2 a I → crf L V → crf L (ⓑ{a,I}V. T)
34 | crf_ib2_dx : ∀a,I,L,V,T. ib2 a I → crf (L.ⓑ{I}V) T → crf L (ⓑ{a,I}V. T)
35 | crf_beta   : ∀a,L,V,W,T. crf L (ⓐV. ⓛ{a}W. T)
36 | crf_theta  : ∀a,L,V,W,T. crf L (ⓐV. ⓓ{a}W. T)
37 .
38
39 interpretation
40    "context-sensitive reducibility (term)"
41    'Reducible L T = (crf L T).
42
43 (* Basic inversion lemmas ***************************************************)
44
45 fact trf_inv_atom_aux: ∀I,L,T. L ⊢ 𝐑⦃T⦄ → L = ⋆ → T = ⓪{I} → ⊥.
46 #I #L #T * -L -T
47 [ #L #K #V #i #HLK #H1 #H2 destruct
48   lapply (ldrop_inv_atom1 … HLK) -HLK #H destruct
49 | #L #V #T #_ #_ #H destruct
50 | #L #V #T #_ #_ #H destruct
51 | #J #L #V #T #_ #_ #H destruct
52 | #a #J #L #V #T #_ #_ #_ #H destruct
53 | #a #J #L #V #T #_ #_ #_ #H destruct
54 | #a #L #V #W #T #_ #H destruct
55 | #a #L #V #W #T #_ #H destruct
56 ]
57 qed.
58
59 lemma trf_inv_atom: ∀I. ⋆ ⊢ 𝐑⦃⓪{I}⦄ → ⊥.
60 /2 width=6/ qed-.
61
62 fact trf_inv_lref_aux: ∀L,T. L ⊢ 𝐑⦃T⦄ → ∀i. T = #i → ∃∃K,V. ⇩[0, i] L ≡ K.ⓓV.
63 #L #T * -L -T
64 [ #L #K #V #j #HLK #i #H destruct /2 width=3/
65 | #L #V #T #_ #i #H destruct
66 | #L #V #T #_ #i #H destruct
67 | #J #L #V #T #_ #i #H destruct
68 | #a #J #L #V #T #_ #_ #i #H destruct
69 | #a #J #L #V #T #_ #_ #i #H destruct
70 | #a #L #V #W #T #i #H destruct
71 | #a #L #V #W #T #i #H destruct
72 ]
73 qed.
74
75 lemma trf_inv_lref: ∀L,i. L ⊢ 𝐑⦃#i⦄ → ∃∃K,V. ⇩[0, i] L ≡ K.ⓓV.
76 /2 width=3/ qed-.
77
78 fact crf_inv_ib2_aux: ∀a,I,L,W,U,T. ib2 a I → L ⊢ 𝐑⦃T⦄ → T = ⓑ{a,I}W. U →
79                       L ⊢ 𝐑⦃W⦄ ∨ L.ⓑ{I}W ⊢ 𝐑⦃U⦄.
80 #a #I #L #W #U #T #HI * -T
81 [ #L #K #V #i #_ #H destruct
82 | #L #V #T #_ #H destruct
83 | #L #V #T #_ #H destruct
84 | #J #L #V #T #H1 #H2 destruct
85   elim H1 -H1 #H destruct
86   elim HI -HI #H destruct
87 | #b #J #L #V #T #_ #HV #H destruct /2 width=1/
88 | #b #J #L #V #T #_ #HT #H destruct /2 width=1/
89 | #b #L #V #W #T #H destruct
90 | #b #L #V #W #T #H destruct
91 ]
92 qed.
93
94 lemma crf_inv_ib2: ∀a,I,L,W,T. ib2 a I → L ⊢ 𝐑⦃ⓑ{a,I}W.T⦄ →
95                    L ⊢ 𝐑⦃W⦄ ∨ L.ⓑ{I}W ⊢ 𝐑⦃T⦄.
96 /2 width=5/ qed-.
97
98 fact crf_inv_appl_aux: ∀L,W,U,T. L ⊢ 𝐑⦃T⦄ → T = ⓐW. U →
99                        ∨∨ L ⊢ 𝐑⦃W⦄ | L ⊢ 𝐑⦃U⦄ | (𝐒⦃U⦄ → ⊥).
100 #L #W #U #T * -T
101 [ #L #K #V #i #_ #H destruct
102 | #L #V #T #HV #H destruct /2 width=1/
103 | #L #V #T #HT #H destruct /2 width=1/
104 | #J #L #V #T #H1 #H2 destruct
105   elim H1 -H1 #H destruct
106 | #a #I #L #V #T #_ #_ #H destruct
107 | #a #I #L #V #T #_ #_ #H destruct
108 | #a #L #V #W0 #T #H destruct
109   @or3_intro2 #H elim (simple_inv_bind … H)
110 | #a #L #V #W0 #T #H destruct
111   @or3_intro2 #H elim (simple_inv_bind … H)
112 ]
113 qed.
114
115 lemma crf_inv_appl: ∀L,V,T. L ⊢ 𝐑⦃ⓐV.T⦄ → ∨∨ L ⊢ 𝐑⦃V⦄ | L ⊢ 𝐑⦃T⦄ | (𝐒⦃T⦄ → ⊥).
116 /2 width=3/ qed-.