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 I T1 T2 = (TPair (Bind2 I) T1 T2).
34 interpretation "term flat construction (binary)"
35 'SnFlat2 I T1 T2 = (TPair (Flat2 I) T1 T2).
37 interpretation "sort (term)"
38 'Star k = (TAtom (Sort k)).
40 interpretation "local reference (term)"
41 'LRef i = (TAtom (LRef i)).
43 interpretation "global reference (term)"
44 'GRef p = (TAtom (GRef p)).
46 interpretation "abbreviation (term)"
47 'SnAbbr T1 T2 = (TPair (Bind2 Abbr) T1 T2).
49 interpretation "abstraction (term)"
50 'SnAbst T1 T2 = (TPair (Bind2 Abst) T1 T2).
52 interpretation "application (term)"
53 'SnAppl T1 T2 = (TPair (Flat2 Appl) T1 T2).
55 interpretation "native type annotation (term)"
56 'SnCast T1 T2 = (TPair (Flat2 Cast) T1 T2).
58 (* Basic properties *********************************************************)
60 (* Basic_1: was: term_dec *)
61 axiom term_eq_dec: ∀T1,T2:term. Decidable (T1 = T2).
63 (* Basic inversion lemmas ***************************************************)
65 lemma discr_tpair_xy_x: ∀I,T,V. ②{I} V. T = V → False.
68 | #J #W #U #IHW #_ #H destruct
69 -H >e0 in e1; normalize (**) (* destruct: one quality is not simplified, the destucted equality is not erased *)
74 (* Basic_1: was: thead_x_y_y *)
75 lemma discr_tpair_xy_y: ∀I,V,T. ②{I} V. T = T → False.
78 | #J #W #U #_ #IHU #H destruct
79 -H (**) (* destruct: the destucted equality is not erased *)
84 lemma eq_false_inv_tpair: ∀I,V1,T1,V2,T2.
85 (②{I} V1. T1 = ②{I} V2. T2 → False) →
86 (V1 = V2 → False) ∨ (V1 = V2 ∧ (T1 = T2 → False)).
88 elim (term_eq_dec V1 V2) /3 width=1/ #HV12 destruct
89 @or_intror @conj // #HT12 destruct /2 width=1/
92 (* Basic_1: removed theorems 3:
93 not_void_abst not_abbr_void not_abst_void