|
| 1 | +||| This is a backward-compatibility module. |
| 2 | +||| |
| 3 | +||| This module's original contents were moved to `Data.Bool`. |
| 4 | +||| It's okay to add something new to this module but it seems to be good |
| 5 | +||| to leave a public import of the `Data.Bool` module. |
1 | 6 | module Data.Bool.Extra |
2 | 7 |
|
3 | | -%access public export |
4 | | -%default total |
5 | | - |
6 | | -notInvolutive : (x : Bool) -> not (not x) = x |
7 | | -notInvolutive True = Refl |
8 | | -notInvolutive False = Refl |
9 | | - |
10 | | --- AND |
11 | | - |
12 | | -andSameNeutral : (x : Bool) -> x && x = x |
13 | | -andSameNeutral False = Refl |
14 | | -andSameNeutral True = Refl |
15 | | - |
16 | | -andFalseFalse : (x : Bool) -> x && False = False |
17 | | -andFalseFalse False = Refl |
18 | | -andFalseFalse True = Refl |
19 | | - |
20 | | -andTrueNeutral : (x : Bool) -> x && True = x |
21 | | -andTrueNeutral False = Refl |
22 | | -andTrueNeutral True = Refl |
23 | | - |
24 | | -andAssociative : (x, y, z : Bool) -> x && (y && z) = (x && y) && z |
25 | | -andAssociative True _ _ = Refl |
26 | | -andAssociative False _ _ = Refl |
27 | | - |
28 | | -andCommutative : (x, y : Bool) -> x && y = y && x |
29 | | -andCommutative x True = andTrueNeutral x |
30 | | -andCommutative x False = andFalseFalse x |
31 | | - |
32 | | -andNotFalse : (x : Bool) -> x && not x = False |
33 | | -andNotFalse False = Refl |
34 | | -andNotFalse True = Refl |
35 | | - |
36 | | --- OR |
37 | | - |
38 | | -orSameNeutral : (x : Bool) -> x || x = x |
39 | | -orSameNeutral False = Refl |
40 | | -orSameNeutral True = Refl |
41 | | - |
42 | | -orFalseNeutral : (x : Bool) -> x || False = x |
43 | | -orFalseNeutral False = Refl |
44 | | -orFalseNeutral True = Refl |
45 | | - |
46 | | -orTrueTrue : (x : Bool) -> x || True = True |
47 | | -orTrueTrue False = Refl |
48 | | -orTrueTrue True = Refl |
49 | | - |
50 | | -orAssociative : (x, y, z : Bool) -> x || (y || z) = (x || y) || z |
51 | | -orAssociative True _ _ = Refl |
52 | | -orAssociative False _ _ = Refl |
53 | | - |
54 | | -orCommutative : (x, y : Bool) -> x || y = y || x |
55 | | -orCommutative x True = orTrueTrue x |
56 | | -orCommutative x False = orFalseNeutral x |
57 | | - |
58 | | -orNotTrue : (x : Bool) -> x || not x = True |
59 | | -orNotTrue False = Refl |
60 | | -orNotTrue True = Refl |
61 | | - |
62 | | --- interaction & De Morgan's laws |
63 | | - |
64 | | -orSameAndRightNeutral : (x, y : Bool) -> x || (x && y) = x |
65 | | -orSameAndRightNeutral False _ = Refl |
66 | | -orSameAndRightNeutral True _ = Refl |
67 | | - |
68 | | -andDistribOrR : (x, y, z : Bool) -> x && (y || z) = (x && y) || (x && z) |
69 | | -andDistribOrR False _ _ = Refl |
70 | | -andDistribOrR True _ _ = Refl |
71 | | - |
72 | | -orDistribAndR : (x, y, z : Bool) -> x || (y && z) = (x || y) && (x || z) |
73 | | -orDistribAndR False _ _ = Refl |
74 | | -orDistribAndR True _ _ = Refl |
75 | | - |
76 | | -notAndIsOr : (x, y : Bool) -> not (x && y) = not x || not y |
77 | | -notAndIsOr False _ = Refl |
78 | | -notAndIsOr True _ = Refl |
79 | | - |
80 | | -notOrIsAnd : (x, y : Bool) -> not (x || y) = not x && not y |
81 | | -notOrIsAnd False _ = Refl |
82 | | -notOrIsAnd True _ = Refl |
| 8 | +import public Data.Bool |
0 commit comments