1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| A.Asperti, C.Sacerdoti Coen, *)
8 (* ||A|| E.Tassi, S.Zacchiroli *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU Lesser General Public License Version 2.1 *)
13 (**************************************************************************)
15 (* ********************************************************************** *)
16 (* Progetto FreeScale *)
19 (* Cosimo Oliboni, oliboni@cs.unibo.it *)
21 (* Questo materiale fa parte della tesi: *)
22 (* "Formalizzazione Interattiva dei Microcontroller a 8bit FreeScale" *)
24 (* data ultima modifica 15/11/2007 *)
25 (* ********************************************************************** *)
27 include "freescale/pts.ma".
29 (* ********************************** *)
30 (* SOTTOINSIEME MINIMALE DELLA TEORIA *)
31 (* ********************************** *)
33 ninductive True: Prop ≝
36 ndefinition True_ind : ΠP:Prop.P → True → P ≝
38 match H with [ I ⇒ p ].
40 ndefinition True_rec : ΠP:Set.P → True → P ≝
42 match H with [ I ⇒ p ].
44 ndefinition True_rect : ΠP:Type.P → True → P ≝
46 match H with [ I ⇒ p ].
48 ninductive False: Prop ≝.
50 ndefinition False_ind : ΠP:Prop.False → P ≝
52 match H in False return λH1:False.P with [].
54 ndefinition False_rec : ΠP:Set.False → P ≝
56 match H in False return λH1:False.P with [].
58 ndefinition False_rect : ΠP:Type.False → P ≝
60 match H in False return λH1:False.P with [].
62 ndefinition Not: Prop → Prop ≝
65 interpretation "logical not" 'not x = (Not x).
67 nlemma absurd : ∀A,C:Prop.A → ¬A → C.
74 nlemma not_to_not : ∀A,B:Prop. (A → B) → ¬B →¬A.
81 ninductive And (A,B:Prop) : Prop ≝
82 conj : A → B → (And A B).
84 ndefinition And_ind : ΠA,B:Prop.ΠP:Prop.(A → B → P) → And A B → P ≝
85 λA,B:Prop.λP:Prop.λf:A → B → P.λH:And A B.
86 match H with [conj H1 H2 ⇒ f H1 H2 ].
88 ndefinition And_rec : ΠA,B:Prop.ΠP:Set.(A → B → P) → And A B → P ≝
89 λA,B:Prop.λP:Set.λf:A → B → P.λH:And A B.
90 match H with [conj H1 H2 ⇒ f H1 H2 ].
92 ndefinition And_rect : ΠA,B:Prop.ΠP:Type.(A → B → P) → And A B → P ≝
93 λA,B:Prop.λP:Type.λf:A → B → P.λH:And A B.
94 match H with [conj H1 H2 ⇒ f H1 H2 ].
96 interpretation "logical and" 'and x y = (And x y).
98 nlemma proj1: ∀A,B:Prop.A ∧ B → A.
100 napply (And_ind A B ?? H);
105 nlemma proj2: ∀A,B:Prop.A ∧ B → B.
107 napply (And_ind A B ?? H);
112 ninductive Or (A,B:Prop) : Prop ≝
113 or_introl : A → (Or A B)
114 | or_intror : B → (Or A B).
116 ndefinition Or_ind : ΠA,B:Prop.ΠP:Prop.(A → P) → (B → P) → Or A B → P ≝
117 λA,B:Prop.λP:Prop.λf1:A → P.λf2:B → P.λH:Or A B.
118 match H with [ or_introl H1 ⇒ f1 H1 | or_intror H1 ⇒ f2 H1 ].
120 interpretation "logical or" 'or x y = (Or x y).
122 ndefinition decidable : Prop → Prop ≝ λA:Prop.A ∨ ¬A.
124 ninductive ex (A:Type) (Q:A → Prop) : Prop ≝
125 ex_intro: ∀x:A.Q x → ex A Q.
127 ndefinition ex_ind : ΠA:Type.ΠQ:A → Prop.ΠP:Prop.(Πa:A.Q a → P) → ex A Q → P ≝
128 λA:Type.λQ:A → Prop.λP:Prop.λf:(Πa:A.Q a → P).λH:ex A Q.
129 match H with [ ex_intro H1 H2 ⇒ f H1 H2 ].
131 interpretation "exists" 'exists x = (ex ? x).
133 ninductive ex2 (A:Type) (Q,R:A → Prop) : Prop ≝
134 ex_intro2: ∀x:A.Q x → R x → ex2 A Q R.
136 ndefinition ex2_ind : ΠA:Type.ΠQ,R:A → Prop.ΠP:Prop.(Πa:A.Q a → R a → P) → ex2 A Q R → P ≝
137 λA:Type.λQ,R:A → Prop.λP:Prop.λf:(Πa:A.Q a → R a → P).λH:ex2 A Q R.
138 match H with [ ex_intro2 H1 H2 H3 ⇒ f H1 H2 H3 ].
141 λA,B.(A -> B) ∧ (B -> A).
143 ndefinition relation : Type → Type ≝
144 λA:Type.A → A → Prop.
146 ndefinition reflexive : ∀A:Type.∀R:relation A.Prop ≝
149 ndefinition symmetric : ∀A:Type.∀R:relation A.Prop ≝
150 λA.λR.∀x,y:A.R x y → R y x.
152 ndefinition transitive : ∀A:Type.∀R:relation A.Prop ≝
153 λA.λR.∀x,y,z:A.R x y → R y z → R x z.
155 ndefinition irreflexive : ∀A:Type.∀R:relation A.Prop ≝
156 λA.λR.∀x:A.¬ (R x x).
158 ndefinition cotransitive : ∀A:Type.∀R:relation A.Prop ≝
159 λA.λR.∀x,y:A.R x y → ∀z:A. R x z ∨ R z y.
161 ndefinition tight_apart : ∀A:Type.∀eq,ap:relation A.Prop ≝
162 λA.λeq,ap.∀x,y:A. (¬ (ap x y) → eq x y) ∧ (eq x y → ¬ (ap x y)).
164 ndefinition antisymmetric : ∀A:Type.∀R:relation A.Prop ≝
165 λA.λR.∀x,y:A.R x y → ¬ (R y x).
167 ninductive eq (A:Type) (x:A) : A → Prop ≝
170 ndefinition eq_ind : ΠA:Type.Πx:A.ΠP:A → Prop.P x → Πa:A.eq A x a → P a ≝
171 λA:Type.λx:A.λP:A → Prop.λp:P x.λa:A.λH:eq A x a.
172 match H with [refl_eq ⇒ p ].
174 ndefinition eq_rec : ΠA:Type.Πx:A.ΠP:A → Set.P x → Πa:A.eq A x a → P a ≝
175 λA:Type.λx:A.λP:A → Set.λp:P x.λa:A.λH:eq A x a.
176 match H with [refl_eq ⇒ p ].
178 ndefinition eq_rect : ΠA:Type.Πx:A.ΠP:A → Type.P x → Πa:A.eq A x a → P a ≝
179 λA:Type.λx:A.λP:A → Type.λp:P x.λa:A.λH:eq A x a.
180 match H with [refl_eq ⇒ p ].
182 interpretation "leibnitz's equality" 'eq t x y = (eq t x y).
184 interpretation "leibnitz's non-equality" 'neq t x y = (Not (eq t x y)).
186 nlemma symmetric_eq: ∀A:Type. symmetric A (eq A).
194 nlemma eq_elim_r: ∀A:Type.∀x:A.∀P:A → Prop.P x → ∀y:A.y=x → P y.
195 #A; #x; #P; #H; #y; #H1;
196 napply (eq_ind ? x ? H y ?);
201 ndefinition relationT : Type → Type → Type ≝
204 ndefinition symmetricT: ∀A,T:Type.∀R:relationT A T.Prop ≝
205 λA,T.λR.∀x,y:A.R x y = R y x.