]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/ng_assembly2/num/bool.ma
mod change (-x)
[helm.git] / matita / matita / contribs / ng_assembly2 / num / 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: Ing. Cosimo Oliboni, oliboni@cs.unibo.it              *)
19 (*   Sviluppo: 2008-2010                                                  *)
20 (*                                                                        *)
21 (* ********************************************************************** *)
22
23 include "common/theory.ma".
24
25 (* ******** *)
26 (* BOOLEANI *)
27 (* ******** *)
28
29 ninductive bool : Type ≝ 
30   true : bool
31 | false : bool.
32
33 (* operatori booleani *)
34 ndefinition eq_bool ≝
35 λb1,b2:bool.match b1 with
36  [ true ⇒ match b2 with [ true ⇒ true | false ⇒ false ]
37  | false ⇒ match b2 with [ true ⇒ false | false ⇒ true ]
38  ].
39
40 ndefinition not_bool ≝
41 λb:bool.match b with [ true ⇒ false | false ⇒ true ].
42
43 ndefinition and_bool ≝
44 λb1,b2:bool.match b1 with
45  [ true ⇒ b2 | false ⇒ false ].
46
47 ndefinition or_bool ≝
48 λb1,b2:bool.match b1 with
49  [ true ⇒ true | false ⇒ b2 ].
50
51 ndefinition xor_bool ≝
52 λb1,b2:bool.match b1 with
53  [ true ⇒ not_bool b2
54  | false ⇒ b2 ].
55
56 (* \ominus *)
57 notation "hvbox(⊖ a)" non associative with precedence 36
58  for @{ 'not_bool $a }.
59 interpretation "not_bool" 'not_bool x = (not_bool x).
60
61 (* \otimes *)
62 notation "hvbox(a break ⊗ b)" left associative with precedence 35
63  for @{ 'and_bool $a $b }.
64 interpretation "and_bool" 'and_bool x y = (and_bool x y).
65
66 (* \oplus *)
67 notation "hvbox(a break ⊕ b)" left associative with precedence 34
68  for @{ 'or_bool $a $b }.
69 interpretation "or_bool" 'or_bool x y = (or_bool x y).
70
71 (* \odot *)
72 notation "hvbox(a break ⊙ b)" left associative with precedence 33
73  for @{ 'xor_bool $a $b }.
74 interpretation "xor_bool" 'xor_bool x y = (xor_bool x y).
75
76 (* iteratore sugli esadecimali *)
77 ndefinition forall_bool ≝ λP.P true ⊗ P false.
78
79 ndefinition boolRelation : Type → Type ≝
80 λA:Type.A → A → bool.