module Algebra.Monoid.Reasoning {β} (M : Monoid β) where
Reasoning combinators for monoidsπ
open Monoid-on (M .snd) renaming (_β_ to _*_ ; identity to 1m) private variable a b c d e f f' g g' h h' i w x y z : β M β
id-comm : a * 1m β‘ 1m * a id-comm = idr β sym idl id-comm-sym : 1m * a β‘ a * 1m id-comm-sym = idl β sym idr module _ (p : x β‘ 1m) where eliml : x * a β‘ a eliml = apβ _*_ p refl β idl elimr : a * x β‘ a elimr = apβ _*_ refl p β idr introl : a β‘ x * a introl = sym eliml intror : a β‘ a * x intror = sym elimr module _ (p : x * y β‘ z) where pulll : x * (y * a) β‘ z * a pulll = associative β apβ _*_ p refl pullr : (a * x) * y β‘ a * z pullr = sym associative β apβ _*_ refl p module _ (p : z β‘ x * y) where pushl : z * a β‘ x * (y * a) pushl = sym (pulll (sym p)) pushr : a * z β‘ (a * x) * y pushr = sym (pullr (sym p)) module _ (p : w * x β‘ y * z) where extendl : w * (x * a) β‘ y * (z * a) extendl = pulll refl β apβ _*_ p refl β pullr refl extendr : (a * w) * x β‘ (a * y) * z extendr = pullr refl β apβ _*_ refl p β pulll refl module _ (p : x * y β‘ 1m) where cancell : x * (y * a) β‘ a cancell = pulll p β idl cancelr : (a * x) * y β‘ a cancelr = pullr p β idr insertl : a β‘ x * (y * a) insertl = sym cancell insertr : a β‘ (a * x) * y insertr = sym cancelr lswizzle : g β‘ h * i β f * h β‘ 1m β f * g β‘ i lswizzle p q = apβ _*_ refl p β cancell q rswizzle : g β‘ i * h β h * f β‘ 1m β g * f β‘ i rswizzle p q = apβ _*_ p refl β cancelr q swizzle : f * g β‘ h * i β g * g' β‘ 1m β h' * h β‘ 1m β h' * f β‘ i * g' swizzle p q r = lswizzle (sym (associative β rswizzle (sym p) q)) r