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 "terms/term.ma".
16 include "subterms/subterms.ma".
18 (* PROJECTIONS **************************************************************)
20 (* Note: the boolean subset of subterms *)
21 let rec boolean b M on M ≝ match M with
23 | Abst A ⇒ {b}𝛌.(boolean b A)
24 | Appl B A ⇒ {b}@(boolean b B).(boolean b A)
27 interpretation "boolean subset (subterms)"
28 'ProjectUp b M = (boolean b M).
30 notation "hvbox( { term 46 b } ⇑ break term 46 M)"
31 non associative with precedence 46
32 for @{ 'ProjectUp $b $M }.
34 lemma boolean_inv_vref: ∀j,b0,b,M. {b}⇑ M = {b0}#j → b = b0 ∧ M = #j.
36 [ #i #H destruct /2 width=1/
42 lemma boolean_inv_abst: ∀U,b0,b,M. {b}⇑ M = {b0}𝛌.U →
43 ∃∃C. b = b0 & {b}⇑C = U & M = 𝛌.C.
46 | #A #H destruct /2 width=3/
51 lemma boolean_inv_appl: ∀W,U,b0,b,M. {b}⇑ M = {b0}@W.U →
52 ∃∃D,C. b = b0 & {b}⇑D = W & {b}⇑C = U & M = @D.C.
53 #W #U #b0 #b * normalize
56 | #B #A #H destruct /2 width=5/
60 (* Note: the carrier (underlying term) of a subset of subterms *)
61 let rec carrier F on F ≝ match F with
63 | SAbst _ T ⇒ 𝛌.(carrier T)
64 | SAppl _ V T ⇒ @(carrier V).(carrier T)
67 interpretation "carrier (subterms)"
68 'ProjectDown F = (carrier F).
70 notation "hvbox(⇓ term 46 F)"
71 non associative with precedence 46
72 for @{ 'ProjectDown $F }.
74 lemma carrier_inv_vref: ∀j,F. ⇓F = #j → ∃b. F = {b}#j.
76 [ #b #i #H destruct /2 width=2/
78 | #b #V #T #H destruct
82 lemma carrier_inv_abst: ∀C,F. ⇓F = 𝛌.C → ∃∃b,U. ⇓U = C & F = {b}𝛌.U.
85 | #b #T #H destruct /2 width=4/
86 | #b #V #T #H destruct
90 lemma carrier_inv_appl: ∀D,C,F. ⇓F = @D.C →
91 ∃∃b,W,U. ⇓W = D & ⇓U = C & F = {b}@W.U.
95 | #b #V #T #H destruct /2 width=6/
99 definition mk_boolean: bool → subterms → subterms ≝
102 interpretation "make boolean (subterms)"
103 'ProjectSame b F = (mk_boolean b F).
105 notation "hvbox( { term 46 b } ⇕ break term 46 F)"
106 non associative with precedence 46
107 for @{ 'ProjectSame $b $F }.
109 lemma mk_boolean_inv_vref: ∀j,b0,b,F. {b}⇕ F = {b0}#j →
110 ∃∃b1. b = b0 & F = {b1}#j.
112 elim (boolean_inv_vref … H) -H #H0 #H
113 elim (carrier_inv_vref … H) -H /2 width=2/
116 lemma mk_boolean_inv_abst: ∀U,b0,b,F. {b}⇕ F = {b0}𝛌.U →
117 ∃∃b1,T. b = b0 & {b}⇕T = U & F = {b1}𝛌.T.
119 elim (boolean_inv_abst … H) -H #C #H0 #H1 #H
120 elim (carrier_inv_abst … H) -H #b1 #U1 #H3 destruct /2 width=4/
123 lemma mk_boolean_inv_appl: ∀W,U,b0,b,F. {b}⇕ F = {b0}@W.U →
124 ∃∃b1,V,T. b = b0 & {b}⇕V = W & {b}⇕T = U & F = {b1}@V.T.
126 elim (boolean_inv_appl … H) -H #D #C #H0 #H1 #H2 #H
127 elim (carrier_inv_appl … H) -H #b1 #W1 #U1 #H3 #H4 destruct /2 width=6/