Last active
September 17, 2020 02:58
-
-
Save Kazark/ec5bd50aebb84b874aa8c2052bab3bb9 to your computer and use it in GitHub Desktop.
Revisions
-
Kazark revised this gist
Sep 17, 2020 . No changes.There are no files selected for viewing
-
Kazark created this gist
Sep 12, 2020 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,34 @@ module Alg where open import Data.Nat using (ℕ; zero; suc) import Relation.Binary.PropositionalEquality as Eq open Eq using (_≡_) open import Data.List using (List; _∷_; []) open import Data.Product using (∃-syntax; -,_) NOp : ℕ → Set → Set NOp zero a = a NOp (suc arity) a = a → NOp arity a Op : Set -> Set Op a = ∃[ n ](NOp n a) op : ∀{n : ℕ}{a : Set} → NOp n a → Op a op = -,_ record Algebra : Set₁ where constructor ⟨_,_,_⟩ field type : Set ops : List (Op type) laws : List Set monoid : ∀{a : Set} → a → (a → a → a) → Algebra monoid {a} neutral _∙_ = ⟨ a , op neutral ∷ op _∙_ ∷ [] , (∀{x : a} → x ∙ neutral ≡ x) ∷ (∀{x : a} → neutral ∙ x ≡ x) ∷ (∀{x y z : a} → (x ∙ y) ∙ z ≡ x ∙ (y ∙ z)) ∷ [] ⟩