# MagmaWithUnit¶

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.
- *: (%, %) -> %
- from Magma
- =: (%, %) -> Boolean
- from BasicType

- ^: (%, NonNegativeInteger) -> %
`a^n`

returns the`n`

`-`

th power of`a`

, defined by repeated squaring.- ^: (%, PositiveInteger) -> %
- from Magma
- ~=: (%, %) -> Boolean
- from BasicType
- coerce: % -> OutputForm
- from CoercibleTo OutputForm
- hash: % -> SingleInteger
- from SetCategory
- hashUpdate!: (HashState, %) -> HashState
- from SetCategory
- latex: % -> String
- from SetCategory

- leftPower: (%, NonNegativeInteger) -> %
`leftPower(a, n)`

returns the`n`

`-`

th left power of`a`

, i.e.`leftPower(a, n) := a * leftPower(a, n-1)`

and`leftPower(a, 0) := 1`

.- leftPower: (%, PositiveInteger) -> %
- from Magma

- leftRecip: % -> Union(%, failed)
`leftRecip(a)`

returns an element, which is a left inverse of`a`

, or`"failed"`

if such an element doesn`'t`

exist or cannot be determined (see unitsKnown).

- one?: % -> Boolean
`one?(a)`

tests whether`a`

is the unit 1.

- recip: % -> Union(%, failed)
`recip(a)`

returns an element, which is both a left and a right inverse of`a`

, or`"failed"`

if such an element doesn`'t`

exist or cannot be determined (see unitsKnown).

- rightPower: (%, NonNegativeInteger) -> %
`rightPower(a, n)`

returns the`n`

`-`

th right power of`a`

, i.e.`rightPower(a, n) := rightPower(a, n-1) * a`

and`rightPower(a, 0) := 1`

.- rightPower: (%, PositiveInteger) -> %
- from Magma

- rightRecip: % -> Union(%, failed)
`rightRecip(a)`

returns an element, which is a right inverse of`a`

, or`"failed"`

if such an element doesn`'t`

exist or cannot be determined (see unitsKnown).

- sample: %
`sample yields`

a value of type %