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/grammar/item.ma".
17 (* TERMS ********************************************************************)
20 inductive term: Type[0] ≝
21 | TAtom: item0 → term (* atomic item construction *)
22 | TPair: item2 → term → term → term (* binary item construction *)
25 interpretation "term construction (atomic)"
28 interpretation "term construction (binary)"
29 'SnItem2 I T1 T2 = (TPair I T1 T2).
31 interpretation "term binding construction (binary)"
32 'SnBind2 a I T1 T2 = (TPair (Bind2 a I) T1 T2).
34 interpretation "term positive binding construction (binary)"
35 'SnBind2Pos I T1 T2 = (TPair (Bind2 true I) T1 T2).
37 interpretation "term negative binding construction (binary)"
38 'SnBind2Neg I T1 T2 = (TPair (Bind2 false I) T1 T2).
40 interpretation "term flat construction (binary)"
41 'SnFlat2 I T1 T2 = (TPair (Flat2 I) T1 T2).
43 interpretation "sort (term)"
44 'Star k = (TAtom (Sort k)).
46 interpretation "local reference (term)"
47 'LRef i = (TAtom (LRef i)).
49 interpretation "global reference (term)"
50 'GRef p = (TAtom (GRef p)).
52 interpretation "abbreviation (term)"
53 'SnAbbr a T1 T2 = (TPair (Bind2 a Abbr) T1 T2).
55 interpretation "positive abbreviation (term)"
56 'SnAbbrPos T1 T2 = (TPair (Bind2 true Abbr) T1 T2).
58 interpretation "negative abbreviation (term)"
59 'SnAbbrNeg T1 T2 = (TPair (Bind2 false Abbr) T1 T2).
61 interpretation "abstraction (term)"
62 'SnAbst a T1 T2 = (TPair (Bind2 a Abst) T1 T2).
64 interpretation "positive abstraction (term)"
65 'SnAbstPos T1 T2 = (TPair (Bind2 true Abst) T1 T2).
67 interpretation "negative abstraction (term)"
68 'SnAbstNeg T1 T2 = (TPair (Bind2 false Abst) T1 T2).
70 interpretation "application (term)"
71 'SnAppl T1 T2 = (TPair (Flat2 Appl) T1 T2).
73 interpretation "native type annotation (term)"
74 'SnCast T1 T2 = (TPair (Flat2 Cast) T1 T2).
76 (* Basic properties *********************************************************)
78 (* Basic_1: was: term_dec *)
79 axiom term_eq_dec: ∀T1,T2:term. Decidable (T1 = T2).
81 (* Basic inversion lemmas ***************************************************)
83 lemma discr_tpair_xy_x: ∀I,T,V. ②{I} V. T = V → ⊥.
86 | #J #W #U #IHW #_ #H destruct
87 -H >e0 in e1; normalize (**) (* destruct: one quality is not simplified, the destucted equality is not erased *)
92 (* Basic_1: was: thead_x_y_y *)
93 lemma discr_tpair_xy_y: ∀I,V,T. ②{I} V. T = T → ⊥.
96 | #J #W #U #_ #IHU #H destruct
97 -H (**) (* destruct: the destucted equality is not erased *)
102 lemma eq_false_inv_tpair_sn: ∀I,V1,T1,V2,T2.
103 (②{I} V1. T1 = ②{I} V2. T2 → ⊥) →
104 (V1 = V2 → ⊥) ∨ (V1 = V2 ∧ (T1 = T2 → ⊥)).
105 #I #V1 #T1 #V2 #T2 #H
106 elim (term_eq_dec V1 V2) /3 width=1/ #HV12 destruct
107 @or_intror @conj // #HT12 destruct /2 width=1/
110 lemma eq_false_inv_tpair_dx: ∀I,V1,T1,V2,T2.
111 (②{I} V1. T1 = ②{I} V2. T2 → ⊥) →
112 (T1 = T2 → ⊥) ∨ (T1 = T2 ∧ (V1 = V2 → ⊥)).
113 #I #V1 #T1 #V2 #T2 #H
114 elim (term_eq_dec T1 T2) /3 width=1/ #HT12 destruct
115 @or_intror @conj // #HT12 destruct /2 width=1/
118 lemma eq_false_inv_beta: ∀a,V1,V2,W1,W2,T1,T2.
119 (ⓐV1. ⓛ{a}W1. T1 = ⓐV2. ⓛ{a}W2 .T2 → ⊥) →
121 (W1 = W2 ∧ (ⓓ{a}V1. T1 = ⓓ{a}V2. T2 → ⊥)).
122 #a #V1 #V2 #W1 #W2 #T1 #T2 #H
123 elim (eq_false_inv_tpair_sn … H) -H
124 [ #HV12 elim (term_eq_dec W1 W2) /3 width=1/
125 #H destruct @or_intror @conj // #H destruct /2 width=1/
127 elim (eq_false_inv_tpair_sn … H2) -H2 /3 width=1/
129 @or_intror @conj // #H destruct /2 width=1/
133 (* Basic_1: removed theorems 3:
134 not_void_abst not_abbr_void not_abst_void