CDM Semirings
Total Page:16
File Type:pdf, Size:1020Kb
CDM 1 Semirings and Rings Semirings Klaus Sutner Polynomials: Applications Carnegie Mellon University 30-semi-rings 2017/12/15 23:16 Polynomials: Definition Roots Semirings 3 Example Some standard examples of semirings are the following. The ring of integers Z, +, , 0, 1 is a semiring under the standard operations of addition and A semiring is a structure X, , , 0, 1 that satisfies the following conditions: h ∗ i h ⊕ ⊗ i multiplication. More generally any ring is a semiring; the additive monoid here is a group. 1 X, , 0 and X, , 1 are monoids, the former is commutative. h ⊕ i h ⊗ i 2 Operation distributes over on the left and right: Example ⊗ ⊕ x (y z) = (x y) (x z) and (y z) x = (y x) (z x). The Boolean semiring B = 0, 1 , , , 0, 1 where the operations are logical ⊗ ⊕ ⊗ ⊕ ⊗ ⊕ ⊗ ⊗ ⊕ ⊗ h { } ∨ ∧ i ’or’ and ’and’. 3 0 is a null (or annihilator) with respect to : x 0 = 0 x = 0. ⊗ ⊗ ⊗ Example (The Relation Semiring) A semiring is commutative if x y = y x and idempotent if x x = x. The semiring of all binary relations over a set A has set union as the ⊗ ⊗ ⊕ R additive operation, and relational composition as the multiplicative operation. 0 is the empty relation, and 1 is the identity relation. Example (The Language Semiring) Example (Matrix Semirings) ? The semiring (Σ) of all languages over Σ is the algebra P(Σ ), , , , ε . It L h ∪ · ∅ i is easy to check that all the equations for a semiring are satisfied by (Σ). Let S = S, , , 0, 1 be a semiring. The operations and naturally h ⊕ ⊗ i ⊕ n,n ⊗ L n Note that one can introduce a metric on (Σ) by setting dist(L, K) := 2− extend to n by n matrices over S. One can show that S , , , 0, 1 is L h ⊕ ⊗ i where n is minimal such that L Σn = K Σn for L = K and dist(L, L) = 0. again a semiring. Here 0 and 1 are the appropriate null and identity matrices ∩ 6 ∩ 6 It is not hard to see that (Σ) is a complete metric space with respect to this over S. L distance function. Matrix semirings will be of importance to us later. To describe the behavior of a finite state machine one can often use homomorphisms of the form Example (Tropical Semiring) h :Σ? Sn,n where Sn,n stands for the monoid of n n matrices over S → ? × The tropical semiring is defined by TS = N , min, +, , 0 . It is used with multiplication. Since Σ is free, any such homomorphism can be specified h ∪ {∞} ∞ i by a list of matrices h(a), a Σ. for example in Dijkstra’s algorithm for minimal cost paths. We will encounter it ∈ in chapter ?? in our discussion of the finite power property. Exercise Verify all the examples given above are indeed semirings. Exercise (Fusion Semiring) Exercise Show that all the following structures are semirings. Recall the partial operation of fusion on words. We have extended fusion to languages as usual (note that fusion on languages is a total operation). Show 1 R + , min, +, , 0 , that the structure (Γ∗), , , , Γ is a semiring, the fusion semiring over Γ. h ∪ { ∞} ∞ i h P ∪ • ∅ i 2 R , max, +, , 0 , h ∪ {−∞} −∞ i 3 x R 0 x 1 , max, , 0, 1 , { ∈ ≤ ≤ } ≥ 4 R 0 + , max, min, 0, . h ≥ ∪ { ∞} ∞ i Star Semirings and Closed Semirings 9 We can define the star operation in terms of an infinitary operation i 0 1 2 x∗ = x = x + x + x + ... i 0 X≥ Note that this approach does not quite fit into the equational framework used Consider again the semiring of all binary relations on a set A. The to describe the other algebras. Here is a more precise definition. Suppose S is R multiplicative operation here is composition of relations. As we have seen, an idempotent semiring with an additional infinitary operation i I ai which is ∈ there is important operation closely related to composition: transitive closure. defined for any family (ai i I) of elements in S where I is an arbitrary index | ∈ P How about adding a unary operation ∗ to the semiring that denotes transitive set. S is a closed semiring iff this infinite summation operation behaves closure? properly with respect to finite sums, distributivity and reordering of the arguments. More precisely, we require This additional unary operation also occurs in other semirings. For example, in the semiring (Σ) of all languages over some alphabet, there is the Kleene star L operation, that is of central importance in language theory. As it turns out, the ai = a1 + ... + an, star operation will allow us to solve linear equations of the form x = a x + b. i [n] · X∈ ( ai)( bj ) = aibj , i I j J (i,j) I J X∈ X∈ X∈ × ai = ( ai), i I j J i I X∈ X∈ X∈ j We will denote semirings with a star operation by X, +, , ∗, 0, 1 . For a more h · i detailed description of closed semirings and star semirings see [?, ?]. where in the last equation I is the disjoint union of the sets Ij . The star operation in a closed semiring is then defined as above. We can then verify Exercise equations such as Show that the collection of all Boolean n by n matrices forms a closed semiring. Think about the case n = 1 first. (x + y)∗ = (x∗y)∗x∗, (xy)∗ = 1 + x(yx)∗y, Exercise It is easy to check that (Σ) is in fact a closed semiring, since plus here Verify the equations given above in (Σ). Solve the equation x = a x + b over L L · corresponds to set theoretic union and can naturally be expanded to infinitely ( a, b ). L { } many arguments. Note that in this case we also have the super idempotency property: ai = a if for all i I: ai = a. It follows that (x∗)∗ = x∗ and Exercise ∈ 1∗ = 1. P Show that in a closed semiring with super idempotency we have (x∗)∗ = x∗ and 1∗ = 1. Also show that these equations hold in any closed semiring satisfying (x + y)∗ = (x∗y)∗x∗ and (xy)∗ = 1 + x(yx)∗y. Rings 13 Rings 14 Definition A ring is an algebraic structure of the form A ring is a semiring where the additive monoid is an Abelian group. A field is a = R, +, , 0, 1 ring where in addition the multiplicative monoid is Abelian, and is essentially a R h · i group: X 0 , , 1 is a group. h − { } ⊗ i where 1 Note that one cannot give a reasonable definition of 0− , which is why 0 is R, +, 0 is a commutative group (additive group), h i excluded from the multiplicative group of a field. R, , 1 is a monoid (not necessarily commutative), Thus, in a field one has a good chance to solve polynomial equations such as h · i x2 5x + 3 = 0. Note, though, that we cannot hope to solve all such − multiplication distributes over addition: equations in all fields: over the real numbers, x2 + 1 = 0 has no solution (but is has a solution over C, the algebraic completion of the reals). x (y + z) = x y + x z · · · (y + z) x = y x + z x · · · Commutative Rings 15 Examples: Rings 16 Example (Integers) The integers Z, +, , 0, 1 with the usual addition and multiplication for a h ∗ i Note that we need two distributive laws since multiplication is not assumed to ring. be commutative. If multiplication is commutative the ring itself is called commutative. Example (Modular Numbers) One can relax the conditions a bit and deal with rings without a 1: for The integers modulo n, Zn, +, , 0, 1 with the usual addition and h ∗ i example, 2Z is a ring without 1. Instead of a multiplicative monoid one has a multiplication form a ring. If n is prime, this ring is actually a field. In semigroup. particular there is a two-element field consisting just of 0 and 1. Note that these fields are finite. For our purposes there is no need for this. Example (Standard Fields) The rationals Q, the reals R, the complex numbers C. Examples: Rings 17 Annihilators, Inverses and Units 18 Example (Univariate Polynomials) Definition A ring element a is an annihilator if for all x: xa = ax = a. Given a ring R we can construct a new ring by considering all polynomials with coefficients in R, written R[x] where x indicates the “unknown” or “variable”. An inverse u0 of a ring element u is any element such that uu0 = u0u = 1. For example, Z[x] is the ring of all polynomials with integer coefficients. A ring element u is called a unit if it has an inverse u0. Example (Matrix Rings) Proposition Another important way to construct rings is to consider square matrices with 0 is an annihilator in any ring. coefficients in a ground ring R. n,n For example, R denotes the ring of all n by n matrices with real coefficients. Proof. Note that a0 = a(0 + 0) = a0 + a0, done by cancellation in the Note that this ring is not commutative unless n = 1. additive group. 2 Inverses 19 Integral Domains 20 We are interested in rings that have lots of units. One obstruction to having a Note that an annihilator cannot be a unit. multiplicative inverse is described in the next definition. For suppose aa0 = 1. We have xa = a, so that x = 1, contradiction. Definition A ring element a = 0 is a zero divisor if there exist b, c = 0 such that The multiplicative 1 in a ring is uniquely determined: 1 = 1 10 = 10.