7
data _≡_ {A : Set} (a : A) : A → Set where
10
plus : Nat → Nat → Nat
12
plus (S n) m = S (plus n m)
14
data Addable (τ : Set) : Set where
15
addable : (τ → τ → τ) → Addable τ
17
plus' : {τ : Set} → Addable τ → τ → τ → τ
22
module AddableM {τ : Set} {a : ⊤} (a : Addable τ) where
27
open module AddableIFS {t : Set} {a : ⊤} {{r : Addable t}} = AddableM {t} r
29
data CommAddable (τ : Set) {a : ⊤} : Set where
30
commAddable : (addable : Addable τ) → ((a b : τ) → (a + b) ≡ (b + a)) → CommAddable τ
33
addableCA' : {τ : Set} (ca : CommAddable τ) → Addable τ
34
addableCA' (commAddable a _) = a
36
comm' : {τ : Set} (ca : CommAddable τ) →
37
let a = addableCA' ca in (a b : τ) → (a + b) ≡ (b + a)
38
comm' (commAddable _ c) = c
40
module CommAddableM {τ : Set} {a : ⊤} (ca : CommAddable τ) where
42
addableCA = addableCA' ca
44
comm : (a b : τ) → (a + b) ≡ (b + a)
50
postulate commPlus : (a b : Nat) → plus a b ≡ plus b a
52
commNatAdd : CommAddable Nat
53
commNatAdd = commAddable natAdd commPlus
55
open CommAddableM {{...}}
60
a : {x y : Nat} → (S (S Z) + (x + y)) ≡ ((x + y) + S (S Z))
61
a {x}{y} = comm (S (S Z)) (x + y)