mathlib3 documentation

algebra.order.kleene

Kleene Algebras #

THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.

This file defines idempotent semirings and Kleene algebras, which are used extensively in the theory of computation.

An idempotent semiring is a semiring whose addition is idempotent. An idempotent semiring is naturally a semilattice by setting a ≤ b if a + b = b.

A Kleene algebra is an idempotent semiring equipped with an additional unary operator , the Kleene star.

Main declarations #

Notation #

a∗ is notation for kstar a in locale computability.

References #

TODO #

Instances for add_opposite, mul_opposite, ulift, subsemiring, subring, subalgebra.

Tags #

kleene algebra, idempotent semiring

@[instance]
def idem_semiring.to_semiring (α : Type u) [self : idem_semiring α] :
@[class]
structure idem_semiring (α : Type u) :

An idempotent semiring is a semiring with the additional property that addition is idempotent.

Instances of this typeclass
Instances of other typeclasses for idem_semiring
  • idem_semiring.has_sizeof_inst
@[instance]
@[class]
structure idem_comm_semiring (α : Type u) :

An idempotent commutative semiring is a commutative semiring with the additional property that addition is idempotent.

Instances of this typeclass
Instances of other typeclasses for idem_comm_semiring
  • idem_comm_semiring.has_sizeof_inst
@[class]
structure has_kstar (α : Type u_5) :
Type u_5
  • kstar : α α

Notation typeclass for the Kleene star .

Instances of this typeclass
Instances of other typeclasses for has_kstar
  • has_kstar.has_sizeof_inst
@[instance]
@[class]
structure kleene_algebra (α : Type u_5) :
Type u_5

A Kleene Algebra is an idempotent semiring with an additional unary operator kstar (for Kleene star) that satisfies the following properties:

  • 1 + a * a∗ ≤ a∗
  • 1 + a∗ * a ≤ a∗
  • If a * c + b ≤ c, then a∗ * b ≤ c
  • If c * a + b ≤ c, then b * a∗ ≤ c
Instances of this typeclass
Instances of other typeclasses for kleene_algebra
  • kleene_algebra.has_sizeof_inst
@[instance]
def kleene_algebra.to_has_kstar (α : Type u_5) [self : kleene_algebra α] :
@[protected, instance]
Equations
@[reducible]
def idem_semiring.of_semiring {α : Type u_1} [semiring α] (h : (a : α), a + a = a) :

Construct an idempotent semiring from an idempotent addition.

Equations
@[simp]
theorem add_eq_sup {α : Type u_1} [idem_semiring α] (a b : α) :
a + b = a b
theorem add_idem {α : Type u_1} [idem_semiring α] (a : α) :
a + a = a
theorem nsmul_eq_self {α : Type u_1} [idem_semiring α] {n : } (hn : n 0) (a : α) :
n a = a
theorem add_eq_left_iff_le {α : Type u_1} [idem_semiring α] {a b : α} :
a + b = a b a
theorem add_eq_right_iff_le {α : Type u_1} [idem_semiring α] {a b : α} :
a + b = b a b
theorem has_le.le.add_eq_left {α : Type u_1} [idem_semiring α] {a b : α} :
b a a + b = a

Alias of the reverse direction of add_eq_left_iff_le.

theorem has_le.le.add_eq_right {α : Type u_1} [idem_semiring α] {a b : α} :
a b a + b = b

Alias of the reverse direction of add_eq_right_iff_le.

theorem add_le_iff {α : Type u_1} [idem_semiring α] {a b c : α} :
a + b c a c b c
theorem add_le {α : Type u_1} [idem_semiring α] {a b c : α} (ha : a c) (hb : b c) :
a + b c
@[simp]
theorem one_le_kstar {α : Type u_1} [kleene_algebra α] {a : α} :
theorem mul_kstar_le_kstar {α : Type u_1} [kleene_algebra α] {a : α} :
theorem kstar_mul_le_kstar {α : Type u_1} [kleene_algebra α] {a : α} :
theorem mul_kstar_le_self {α : Type u_1} [kleene_algebra α] {a b : α} :
theorem kstar_mul_le_self {α : Type u_1} [kleene_algebra α] {a b : α} :
theorem mul_kstar_le {α : Type u_1} [kleene_algebra α] {a b c : α} (hb : b c) (ha : c * a c) :
theorem kstar_mul_le {α : Type u_1} [kleene_algebra α] {a b c : α} (hb : b c) (ha : a * c c) :
theorem kstar_le_of_mul_le_left {α : Type u_1} [kleene_algebra α] {a b : α} (hb : 1 b) :
theorem kstar_le_of_mul_le_right {α : Type u_1} [kleene_algebra α] {a b : α} (hb : 1 b) :
@[simp]
theorem le_kstar {α : Type u_1} [kleene_algebra α] {a : α} :
@[simp]
theorem kstar_eq_one {α : Type u_1} [kleene_algebra α] {a : α} :
@[simp]
theorem kstar_zero {α : Type u_1} [kleene_algebra α] :
@[simp]
theorem kstar_one {α : Type u_1} [kleene_algebra α] :
@[simp]
@[simp]
theorem kstar_eq_self {α : Type u_1} [kleene_algebra α] {a : α} :
has_kstar.kstar a = a a * a = a 1 a
@[simp]
theorem kstar_idem {α : Type u_1} [kleene_algebra α] (a : α) :
@[simp]
theorem pow_le_kstar {α : Type u_1} [kleene_algebra α] {a : α} {n : } :
theorem prod.kstar_def {α : Type u_1} {β : Type u_2} [kleene_algebra α] [kleene_algebra β] (a : α × β) :
@[simp]
theorem prod.fst_kstar {α : Type u_1} {β : Type u_2} [kleene_algebra α] [kleene_algebra β] (a : α × β) :
@[simp]
theorem prod.snd_kstar {α : Type u_1} {β : Type u_2} [kleene_algebra α] [kleene_algebra β] (a : α × β) :
theorem pi.kstar_def {ι : Type u_3} {π : ι Type u_4} [Π (i : ι), kleene_algebra (π i)] (a : Π (i : ι), π i) :
has_kstar.kstar a = λ (i : ι), has_kstar.kstar (a i)
@[simp]
theorem pi.kstar_apply {ι : Type u_3} {π : ι Type u_4} [Π (i : ι), kleene_algebra (π i)] (a : Π (i : ι), π i) (i : ι) :
@[protected, reducible]
def function.injective.idem_semiring {α : Type u_1} {β : Type u_2} [idem_semiring α] [has_zero β] [has_one β] [has_add β] [has_mul β] [has_pow β ] [has_smul β] [has_nat_cast β] [has_sup β] [has_bot β] (f : β α) (hf : function.injective f) (zero : f 0 = 0) (one : f 1 = 1) (add : (x y : β), f (x + y) = f x + f y) (mul : (x y : β), f (x * y) = f x * f y) (nsmul : (x : β) (n : ), f (n x) = n f x) (npow : (x : β) (n : ), f (x ^ n) = f x ^ n) (nat_cast : (n : ), f n = n) (sup : (a b : β), f (a b) = f a f b) (bot : f = ) :

Pullback an idem_semiring instance along an injective function.

Equations
@[protected, reducible]
def function.injective.idem_comm_semiring {α : Type u_1} {β : Type u_2} [idem_comm_semiring α] [has_zero β] [has_one β] [has_add β] [has_mul β] [has_pow β ] [has_smul β] [has_nat_cast β] [has_sup β] [has_bot β] (f : β α) (hf : function.injective f) (zero : f 0 = 0) (one : f 1 = 1) (add : (x y : β), f (x + y) = f x + f y) (mul : (x y : β), f (x * y) = f x * f y) (nsmul : (x : β) (n : ), f (n x) = n f x) (npow : (x : β) (n : ), f (x ^ n) = f x ^ n) (nat_cast : (n : ), f n = n) (sup : (a b : β), f (a b) = f a f b) (bot : f = ) :

Pullback an idem_comm_semiring instance along an injective function.

Equations
@[protected, reducible]
def function.injective.kleene_algebra {α : Type u_1} {β : Type u_2} [kleene_algebra α] [has_zero β] [has_one β] [has_add β] [has_mul β] [has_pow β ] [has_smul β] [has_nat_cast β] [has_sup β] [has_bot β] [has_kstar β] (f : β α) (hf : function.injective f) (zero : f 0 = 0) (one : f 1 = 1) (add : (x y : β), f (x + y) = f x + f y) (mul : (x y : β), f (x * y) = f x * f y) (nsmul : (x : β) (n : ), f (n x) = n f x) (npow : (x : β) (n : ), f (x ^ n) = f x ^ n) (nat_cast : (n : ), f n = n) (sup : (a b : β), f (a b) = f a f b) (bot : f = ) (kstar : (a : β), f (has_kstar.kstar a) = has_kstar.kstar (f a)) :

Pullback an idem_comm_semiring instance along an injective function.

Equations