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