MagmaWithUnit¶
naalgc.spad line 44 [edit on github]
MagmaWithUnit is the class of multiplicative monads with unit, i.e. sets with a binary operation and a unit element. Axioms leftIdentity(“*”:(%,%)->
%,1) 1*x=x rightIdentity(“*”:(%,%)->
%,1) x*1=x Common Additional Axioms unitsKnown—if “recip” says “failed”, that PROVES input wasn't
a unit
- 1: %
1 returns the unit element, denoted by 1.
- ^: (%, NonNegativeInteger) -> %
a^n
returns then
-
th power ofa
, defined by repeated squaring.- ^: (%, PositiveInteger) -> %
from Magma
- coerce: % -> OutputForm
from CoercibleTo OutputForm
- latex: % -> String
from SetCategory
- leftPower: (%, NonNegativeInteger) -> %
leftPower(a, n)
returns then
-
th left power ofa
, i.e.leftPower(a, n) := a * leftPower(a, n-1)
andleftPower(a, 0) := 1
.- leftPower: (%, PositiveInteger) -> %
from Magma
- leftRecip: % -> Union(%, failed)
leftRecip(a)
returns an element, which is a left inverse ofa
, or"failed"
if such an element doesn't
exist or cannot be determined (see unitsKnown).
- one?: % -> Boolean
one?(a)
tests whethera
is the unit 1.
- recip: % -> Union(%, failed)
recip(a)
returns an element, which is both a left and a right inverse ofa
, or"failed"
if such an element doesn't
exist or cannot be determined (see unitsKnown).
- rightPower: (%, NonNegativeInteger) -> %
rightPower(a, n)
returns then
-
th right power ofa
, i.e.rightPower(a, n) := rightPower(a, n-1) * a
andrightPower(a, 0) := 1
.- rightPower: (%, PositiveInteger) -> %
from Magma
- rightRecip: % -> Union(%, failed)
rightRecip(a)
returns an element, which is a right inverse ofa
, or"failed"
if such an element doesn't
exist or cannot be determined (see unitsKnown).
- sample: %
sample yields
a value of type %