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/substitution/ldrop.ma".
17 (* CONTEXT-SENSITIVE REDUCIBLE TERMS ****************************************)
19 (* reducible binary items *)
20 definition ri2: item2 → Prop ≝
21 λI. I = Bind2 true Abbr ∨ I = Flat2 Cast.
23 (* irreducible binary binders *)
24 definition ib2: bool → bind2 → Prop ≝
25 λa,I. I = Abst ∨ Bind2 a I = Bind2 false Abbr.
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)
40 "context-sensitive reducibility (term)"
41 'Reducible L T = (crf L T).
43 (* Basic inversion lemmas ***************************************************)
45 fact trf_inv_atom_aux: ∀I,L,T. L ⊢ 𝐑⦃T⦄ → L = ⋆ → T = ⓪{I} → ⊥.
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
59 lemma trf_inv_atom: ∀I. ⋆ ⊢ 𝐑⦃⓪{I}⦄ → ⊥.
62 fact trf_inv_lref_aux: ∀L,T. L ⊢ 𝐑⦃T⦄ → ∀i. T = #i → ∃∃K,V. ⇩[0, i] L ≡ K.ⓓV.
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
75 lemma trf_inv_lref: ∀L,i. L ⊢ 𝐑⦃#i⦄ → ∃∃K,V. ⇩[0, i] L ≡ K.ⓓV.
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
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⦄.
98 fact crf_inv_appl_aux: ∀L,W,U,T. L ⊢ 𝐑⦃T⦄ → T = ⓐW. U →
99 ∨∨ L ⊢ 𝐑⦃W⦄ | L ⊢ 𝐑⦃U⦄ | (𝐒⦃U⦄ → ⊥).
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)
115 lemma crf_inv_appl: ∀L,V,T. L ⊢ 𝐑⦃ⓐV.T⦄ → ∨∨ L ⊢ 𝐑⦃V⦄ | L ⊢ 𝐑⦃T⦄ | (𝐒⦃T⦄ → ⊥).