]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/contribs/ng_assembly/freescale/bool.ma
new ng freescale, no external dependencies
[helm.git] / helm / software / matita / contribs / ng_assembly / freescale / bool.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 (* ********************************************************************** *)
16 (*                           Progetto FreeScale                           *)
17 (*                                                                        *)
18 (* Sviluppato da:                                                         *)
19 (*   Cosimo Oliboni, oliboni@cs.unibo.it                                  *)
20 (*                                                                        *)
21 (* Questo materiale fa parte della tesi:                                  *)
22 (*   "Formalizzazione Interattiva dei Microcontroller a 8bit FreeScale"   *)
23 (*                                                                        *)
24 (*                    data ultima modifica 15/11/2007                     *)
25 (* ********************************************************************** *)
26
27 include "freescale/pts.ma".
28
29 (* ******** *)
30 (* BOOLEANI *)
31 (* ******** *)
32
33 ninductive bool : Type ≝ 
34   true : bool
35 | false : bool.
36
37 ndefinition bool_ind : ΠP:bool → Prop.P true → P false → Πb:bool.P b ≝
38 λP:bool → Prop.λp:P true.λp1:P false.λb:bool.
39  match b with [ true ⇒ p | false ⇒ p1 ].
40
41 ndefinition bool_rec : ΠP:bool → Set.P true → P false → Πb:bool.P b ≝
42 λP:bool → Set.λp:P true.λp1:P false.λb:bool.
43  match b with [ true ⇒ p | false ⇒ p1 ].
44
45 ndefinition bool_rect : ΠP:bool → Type.P true → P false → Πb:bool.P b ≝
46 λP:bool → Type.λp:P true.λp1:P false.λb:bool.
47  match b with [ true ⇒ p | false ⇒ p1 ].
48
49 (* operatori booleani *)
50
51 ndefinition eq_bool ≝
52 λb1,b2:bool.match b1 with
53  [ true ⇒ match b2 with [ true ⇒ true | false ⇒ false ]
54  | false ⇒ match b2 with [ true ⇒ false | false ⇒ true ]
55  ].
56
57 ndefinition not_bool ≝
58 λb:bool.match b with [ true ⇒ false | false ⇒ true ].
59
60 ndefinition and_bool ≝
61 λb1,b2:bool.match b1 with
62  [ true ⇒ b2 | false ⇒ false ].
63
64 ndefinition or_bool ≝
65 λb1,b2:bool.match b1 with
66  [ true ⇒ true | false ⇒ b2 ].
67
68 ndefinition xor_bool ≝
69 λb1,b2:bool.match b1 with
70  [ true ⇒ not_bool b2
71  | false ⇒ b2 ].
72
73 (* \ominus *)
74 notation "hvbox(⊖ a)" non associative with precedence 36
75  for @{ 'not_bool $a }.
76 interpretation "not_bool" 'not_bool x = (not_bool x).
77
78 (* \otimes *)
79 notation "hvbox(a break ⊗ b)" left associative with precedence 35
80  for @{ 'and_bool $a $b }.
81 interpretation "and_bool" 'and_bool x y = (and_bool x y).
82
83 (* \oplus *)
84 notation "hvbox(a break ⊕ b)" left associative with precedence 34
85  for @{ 'or_bool $a $b }.
86 interpretation "or_bool" 'or_bool x y = (or_bool x y).
87
88 (* \odot *)
89 notation "hvbox(a break ⊙ b)" left associative with precedence 33
90  for @{ 'xor_bool $a $b }.
91 interpretation "xor_bool" 'xor_bool x y = (xor_bool x y).
92
93 ndefinition boolRelation : Type → Type ≝
94 λA:Type.A → A → bool.