Skip to content

Commit cbc3c9f

Browse files
committed
Eq Char proof
1 parent d2efc39 commit cbc3c9f

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

lib/Haskell/Law/Eq.agda

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module Haskell.Law.Eq where
22

3+
open import Haskell.Law.Eq.Char public
34
open import Haskell.Law.Eq.Def public
45
open import Haskell.Law.Eq.Bool public
56
open import Haskell.Law.Eq.Either public

lib/Haskell/Law/Eq/Char.agda

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
module Haskell.Law.Eq.Char where
2+
3+
open import Agda.Builtin.Char.Properties renaming (primCharToNatInjective to c2n-injective)
4+
5+
open import Haskell.Prim
6+
open import Haskell.Prim.Eq
7+
8+
open import Haskell.Extra.Dec
9+
10+
open import Haskell.Law.Eq.Def
11+
open import Haskell.Law.Eq.Nat
12+
open import Haskell.Law.Equality
13+
14+
instance
15+
iLawfulEqChar : IsLawfulEq Char
16+
iLawfulEqChar .isEquality x y with (c2n x) in h₁ | (c2n y) in h₂
17+
... | a | b = mapReflects { a ≡ b } { x ≡ y } { eqNat a b }
18+
(λ h c2n-injective x y $ sym $ trans (trans h₂ $ sym h) (sym h₁))
19+
(λ h trans (sym $ trans (cong c2n (sym h)) h₁) h₂)
20+
(isEquality a b)

lib/Haskell/Law/Eq/Def.agda

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,3 @@ eqNegation = refl
6868

6969
postulate instance
7070
iLawfulEqDouble : IsLawfulEq Double
71-
72-
iLawfulEqChar : IsLawfulEq Char

0 commit comments

Comments
 (0)