]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/delayed_updating/syntax/prototerm_constructors.ma
8bffdb64ae0555df03894b6793f712f21b92e81a
[helm.git] / matita / matita / contribs / lambdadelta / delayed_updating / syntax / prototerm_constructors.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 "delayed_updating/syntax/prototerm.ma".
16 include "delayed_updating/notation/functions/m_hook_1.ma".
17 include "delayed_updating/notation/functions/hash_1.ma".
18 include "delayed_updating/notation/functions/tau_2.ma".
19 include "delayed_updating/notation/functions/tau_3.ma".
20 include "delayed_updating/notation/functions/lamda_1.ma".
21 include "delayed_updating/notation/functions/at_2.ma".
22
23 (* CONSTRUCTORS FOR PROTOTERM ***********************************************)
24
25 definition prototerm_node_0 (l): prototerm ≝
26            λp. l◗𝐞 = p.
27
28 definition prototerm_node_1 (l): prototerm → prototerm ≝
29            λt,p. ∃∃q. q ϵ t & l◗q = p.
30
31 definition prototerm_node_1_2 (l1) (l2): prototerm → prototerm ≝
32            λt,p. ∃∃q. q ϵ t & l1◗l2◗q = p.
33
34 definition prototerm_node_2 (l1) (l2): prototerm → prototerm → prototerm ≝
35            λt1,t2,p.
36            ∨∨ ∃∃q. q ϵ t1 & l1◗q = p
37             | ∃∃q. q ϵ t2 & l2◗q = p.
38
39 interpretation
40   "mark (prototerm)"
41   'MHook t = (prototerm_node_1 label_m t).
42
43 interpretation
44   "outer variable reference by depth (prototerm)"
45   'Hash k = (prototerm_node_0 (label_d k)).
46
47 interpretation
48   "inner variable reference by depth (prototerm)"
49   'Tau k t = (prototerm_node_1_2 (label_d k) label_m t).
50
51 interpretation
52   "inner variable reference by depth with offset (prototerm)"
53   'Tau k d t = (prototerm_node_1_2 (label_d2 k d) label_m t).
54
55 interpretation
56   "name-free functional abstraction (prototerm)"
57   'Lamda t = (prototerm_node_1 label_L t).
58
59 interpretation
60   "application (prototerm)"
61   'At u t = (prototerm_node_2 label_S label_A u t).
62
63 (* Basic constructions *******************************************************)
64
65 lemma in_comp_iref (t) (q) (k):
66       q ϵ t → 𝗱k◗𝗺◗q ϵ 𝛕k.t.
67 /2 width=3 by ex2_intro/ qed.
68
69 lemma in_comp_iref2 (t) (q) (k) (d):
70       q ϵ t → 𝗱❨k,d❩◗𝗺◗q ϵ 𝛕❨k,d❩.t.
71 /2 width=3 by ex2_intro/ qed.
72
73 (* Basic inversions *********************************************************)
74
75 lemma in_comp_inv_iref (t) (p) (k):
76       p ϵ 𝛕k.t →
77       ∃∃q. 𝗱k◗𝗺◗q = p & q ϵ t.
78 #t #p #k * #q #Hq #Hp
79 /2 width=3 by ex2_intro/
80 qed-.
81
82 lemma in_comp_inv_iref2 (t) (p) (k) (d):
83       p ϵ 𝛕❨k,d❩.t →
84       ∃∃q. 𝗱❨k,d❩◗𝗺◗q = p & q ϵ t.
85 #t #p #k #d * #q #Hq #Hp
86 /2 width=3 by ex2_intro/
87 qed-.
88
89 (* COMMENT
90 lemma prototerm_in_root_inv_lcons_oref:
91       ∀p,l,n. l◗p ϵ ▵#n →
92       ∧∧ 𝗱n = l & 𝐞 = p.
93 #p #l #n * #q
94 <list_append_lcons_sn #H0 destruct -H0
95 elim (eq_inv_list_empty_append … e0) -e0 #H0 #_
96 /2 width=1 by conj/
97 qed-.
98
99 lemma prototerm_in_root_inv_lcons_iref:
100       ∀t,p,l,n. l◗p ϵ ▵𝛕n.t →
101       ∧∧ 𝗱n = l & p ϵ ▵ɱ.t.
102 #t #p #l #n * #q * #r #Hr
103 <list_append_lcons_sn #H0 destruct -H0
104 /4 width=4 by ex2_intro, ex_intro, conj/
105 qed-.
106
107 lemma prototerm_in_root_inv_lcons_mark:
108       ∀t,p,l. l◗p ϵ ▵ɱ.t →
109       ∧∧ 𝗺 = l & p ϵ ▵t.
110 #t #p #l * #q * #r #Hr
111 <list_append_lcons_sn #H0 destruct
112 /3 width=2 by ex_intro, conj/
113 qed-.
114
115 lemma prototerm_in_root_inv_lcons_abst:
116       ∀t,p,l. l◗p ϵ ▵𝛌.t →
117       ∧∧ 𝗟 = l & p ϵ ▵t.
118 #t #p #l * #q * #r #Hr
119 <list_append_lcons_sn #H0 destruct
120 /3 width=2 by ex_intro, conj/
121 qed-.
122
123 lemma prototerm_in_root_inv_lcons_appl:
124       ∀u,t,p,l. l◗p ϵ ▵@u.t →
125       ∨∨ ∧∧ 𝗦 = l & p ϵ ▵u
126        | ∧∧ 𝗔 = l & p ϵ ▵t.
127 #u #t #p #l * #q * * #r #Hr
128 <list_append_lcons_sn #H0 destruct
129 /4 width=2 by ex_intro, or_introl, or_intror, conj/
130 qed-.
131 *)