]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/grammar/term.ma
9e7d860b4348b631df54670b7b8b1c301882cc9c
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / grammar / term.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 "basic_2/grammar/item.ma".
16
17 (* TERMS ********************************************************************)
18
19 (* terms *)
20 inductive term: Type[0] ≝
21   | TAtom: item0 → term               (* atomic item construction *)
22   | TPair: item2 → term → term → term (* binary item construction *)
23 .
24
25 interpretation "term construction (atomic)"
26    'Item0 I = (TAtom I).
27
28 interpretation "term construction (binary)"
29    'SnItem2 I T1 T2 = (TPair I T1 T2).
30
31 interpretation "term binding construction (binary)"
32    'SnBind2 a I T1 T2 = (TPair (Bind2 a I) T1 T2).
33
34 interpretation "term positive binding construction (binary)"
35    'SnBind2Pos I T1 T2 = (TPair (Bind2 true I) T1 T2).
36
37 interpretation "term negative binding construction (binary)"
38    'SnBind2Neg I T1 T2 = (TPair (Bind2 false I) T1 T2).
39
40 interpretation "term flat construction (binary)"
41    'SnFlat2 I T1 T2 = (TPair (Flat2 I) T1 T2).
42
43 interpretation "sort (term)"
44    'Star k = (TAtom (Sort k)).
45
46 interpretation "local reference (term)"
47    'LRef i = (TAtom (LRef i)).
48
49 interpretation "global reference (term)"
50    'GRef p = (TAtom (GRef p)).
51
52 interpretation "abbreviation (term)"
53    'SnAbbr a T1 T2 = (TPair (Bind2 a Abbr) T1 T2).
54
55 interpretation "positive abbreviation (term)"
56    'SnAbbrPos T1 T2 = (TPair (Bind2 true Abbr) T1 T2).
57
58 interpretation "negative abbreviation (term)"
59    'SnAbbrNeg T1 T2 = (TPair (Bind2 false Abbr) T1 T2).
60
61 interpretation "abstraction (term)"
62    'SnAbst a T1 T2 = (TPair (Bind2 a Abst) T1 T2).
63
64 interpretation "positive abstraction (term)"
65    'SnAbstPos T1 T2 = (TPair (Bind2 true Abst) T1 T2).
66
67 interpretation "negative abstraction (term)"
68    'SnAbstNeg T1 T2 = (TPair (Bind2 false Abst) T1 T2).
69
70 interpretation "application (term)"
71    'SnAppl T1 T2 = (TPair (Flat2 Appl) T1 T2).
72
73 interpretation "native type annotation (term)"
74    'SnCast T1 T2 = (TPair (Flat2 Cast) T1 T2).
75
76 (* Basic properties *********************************************************)
77
78 (* Basic_1: was: term_dec *)
79 axiom term_eq_dec: ∀T1,T2:term. Decidable (T1 = T2).
80
81 (* Basic inversion lemmas ***************************************************)
82
83 lemma discr_tpair_xy_x: ∀I,T,V. ②{I} V. T = V → ⊥.
84 #I #T #V elim V -V
85 [ #J #H destruct
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 *)
88   /2 width=1/
89 ]
90 qed-.
91
92 (* Basic_1: was: thead_x_y_y *)
93 lemma discr_tpair_xy_y: ∀I,V,T. ②{I} V. T = T → ⊥.
94 #I #V #T elim T -T
95 [ #J #H destruct
96 | #J #W #U #_ #IHU #H destruct
97   -H (**) (* destruct: the destucted equality is not erased *)
98   /2 width=1/
99 ]
100 qed-.
101
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/
108 qed-.
109
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/
116 qed-.
117
118 (* Basic_1: removed theorems 3:
119             not_void_abst not_abbr_void not_abst_void
120 *)