@@ -3,6 +3,12 @@ module Data.Bool.Extra
33%access public export
44%default total
55
6+notInvolutive : (x : Bool) -> not (not x) = x
7+notInvolutive True = Refl
8+notInvolutive False = Refl
9+
10+-- AND
11+
612andSameNeutral : (x : Bool) -> x && x = x
713andSameNeutral False = Refl
814andSameNeutral True = Refl
@@ -15,6 +21,20 @@ andTrueNeutral : (x : Bool) -> x && True = x
1521andTrueNeutral False = Refl
1622andTrueNeutral True = Refl
1723
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+
1838orSameNeutral : (x : Bool) -> x || x = x
1939orSameNeutral False = Refl
2040orSameNeutral True = Refl
@@ -27,6 +47,36 @@ orTrueTrue : (x : Bool) -> x || True = True
2747orTrueTrue False = Refl
2848orTrueTrue True = Refl
2949
30−orSameAndRightNeutral : (x, right : Bool) -> x || (x && right) = x
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
3165orSameAndRightNeutral False _ = Refl
32−orSameAndRightNeutral True _ = 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