Dom::SemiRing – constructor of semirings

Dom::SemiRing(Coefficient=coefficient, ...) creates a semiring domain.

→ Examples

Details:

Creating Elements

Dom::SemiRing(Coefficient = coefficient, <Prop = prop, Plus = plus, Zero = zero, Negate = negate, Mult = mult, One = one, Invert = invert, Divide = divide, Star = star, Categ = categ>)

Parameters:

coefficient

a set of elements, given as a domain, a set, or a list of domains and sets.

prop

a property given by a type.

plus

the addition of the semiring, given as a function.

zero

the neutral element for the addition of the semiring which must verify the property (if it is a parameter) and, in this case, it must also be a coefficient.

negate

opposites of the semiring, given as a function.

mult

the multiplication of the semiring, given as a function.

one

the neutral element for the multiplication of the semiring; it must verify the property (if it is a parameter) and, in this case, it must also be a coefficient.

invert

inverses of the semiring, given as a function.

divide

the division of the semiring, given as a function.

star

the star of the semiring, given as a function.

categ

a category inheriting from Cat::SemiRing.

Superdomain

Dom::BaseDomain

Categories

Cat::SemiRing

Axioms

Ax::canonicalRep, Ax::normalRep

Related Domains:

Entries

"zero"

the neutral element for the addition of the semiring.

"one"

the neutral element for the multiplication of the semiring.

Mathematical Methods

_plus – addition of semiring values

(Dom::SemiRing(Coefficient = coefficient, <Prop = prop, Plus = plus, Zero = zero, Negate = negate, Mult = mult, One = one, Invert = invert, Divide = divide, Star = star, Categ = categ>))::_plus(dom math, ...)

The operation math realizes the addition of the semiring values math.

This method overloads the function _plus.

_mult – multiplication of semiring values

(Dom::SemiRing(Coefficient = coefficient, <Prop = prop, Plus = plus, Zero = zero, Negate = negate, Mult = mult, One = one, Invert = invert, Divide = divide, Star = star, Categ = categ>))::_mult(dom math, ...)

The operation math realizes the multiplication of the semiring values math.

This method overloads the function _mult.

_negate – opposite of a semiring value

(Dom::SemiRing(Coefficient = coefficient, <Prop = prop, Plus = plus, Zero = zero, Negate = negate, Mult = mult, One = one, Invert = invert, Divide = divide, Star = star, Categ = categ>))::_negate(dom math, ...)

math represents the opposite of a semiring value math if it exists, FAIL otherwise.

This method overloads the function _negate.

_invert – inverse of a semiring value

(Dom::SemiRing(Coefficient = coefficient, <Prop = prop, Plus = plus, Zero = zero, Negate = negate, Mult = mult, One = one, Invert = invert, Divide = divide, Star = star, Categ = categ>))::_invert(dom math, ...)

math represents the inverse of a semiring value math if it exists, FAIL otherwise.

This method overloads the function _invert.

_divide – division of a semiring

(Dom::SemiRing(Coefficient = coefficient, <Prop = prop, Plus = plus, Zero = zero, Negate = negate, Mult = mult, One = one, Invert = invert, Divide = divide, Star = star, Categ = categ>))::_divide(dom math, ...)

The operation math realizes the division of the semiring values math.

This method overloads the function _divide.

_power – power of a semiring value

(Dom::SemiRing(Coefficient = coefficient, <Prop = prop, Plus = plus, Zero = zero, Negate = negate, Mult = mult, One = one, Invert = invert, Divide = divide, Star = star, Categ = categ>))::_power(dom a, Dom::Integer n)

The nth power math of a semiring value a.

This method overloads the function _power.

Conversion Methods

changeCoeffRing – conversion of a semiring value into another semiring value

(Dom::SemiRing(Coefficient = coefficient, <Prop = prop, Plus = plus, Zero = zero, Negate = negate, Mult = mult, One = one, Invert = invert, Divide = divide, Star = star, Categ = categ>))::changeCoeffRing(dom a, any T)

The conversion of a into a semiring T. Currently, only a conversion into a type of scalars.

Example 1:

This example shows how to create the boolean semiring:

Bplus := (x, y) -> (if bool(x = 1) or bool(y = 1) then

    1

  else

    0

  end_if) :

Bmult := (x, y) -> (if bool(x = 1) and bool(y = 1) then

    1

  else

    0

  end_if) :

Bstar := x -> 1 :

B := Dom::SemiRing(Coefficient = {0, 1}, Plus = Bplus, Zero = 0, Mult = Bmult, One = 1, Star = Bstar) :

B(1) + B(1) ;

math

Example 2:

We can overload Dom::Rational with a method star:

Q := Dom::Rational :

s := x -> (if x = 1 then

    FAIL

  else

    1/(1 - x)

  end_if) :

Qs := Dom::SemiRing(Coefficient = Q, Star = s, Categ = Cat::Field) :

Qs::star(Qs(1/2)) ;

math

Changes in MuPAD 3.1

New Function.