Skip to content

Commit

Permalink
Move properties of if_then_else_ from Haskell.Law to Haskell.Law.Bool
Browse files Browse the repository at this point in the history
  • Loading branch information
jespercockx committed Dec 19, 2023
1 parent fd2ca48 commit b8eaf97
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
9 changes: 0 additions & 9 deletions lib/Haskell/Law.agda
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,3 @@ module Haskell.Law where
open import Haskell.Prim
open import Haskell.Prim.Bool

ifFlip : (b) (t e : a) (if b then t else e) ≡ (if not b then e else t)
ifFlip False _ _ = refl
ifFlip True _ _ = refl

ifTrueEqThen : (b : Bool) {thn els : a} b ≡ True (if b then thn else els) ≡ thn
ifTrueEqThen .True refl = refl

ifFalseEqElse : (b : Bool) {thn els : a} b ≡ False (if b then thn else els) ≡ els
ifFalseEqElse .False refl = refl
13 changes: 13 additions & 0 deletions lib/Haskell/Law/Bool.agda
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,16 @@ not-not True = refl

not-involution : (a b : Bool) a ≡ not b not a ≡ b
not-involution .(not b) b refl = not-not b

--------------------------------------------------
-- if_then_else_

ifFlip : (b) (t e : a) (if b then t else e) ≡ (if not b then e else t)
ifFlip False _ _ = refl
ifFlip True _ _ = refl

ifTrueEqThen : (b : Bool) {thn els : a} b ≡ True (if b then thn else els) ≡ thn
ifTrueEqThen .True refl = refl

ifFalseEqElse : (b : Bool) {thn els : a} b ≡ False (if b then thn else els) ≡ els
ifFalseEqElse .False refl = refl
1 change: 0 additions & 1 deletion lib/Haskell/Law/Ord/Maybe.agda
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ open import Haskell.Prim.Eq
open import Haskell.Prim.Maybe
open import Haskell.Prim.Ord

open import Haskell.Law
open import Haskell.Law.Bool
open import Haskell.Law.Eq
open import Haskell.Law.Equality hiding ( trustMe )
Expand Down

0 comments on commit b8eaf97

Please sign in to comment.