The areas / V04. Order and lattices
Mathlib.Algebra.Order.Kleene
80 declarations. Mathlib docs · Source
Kleene algebras
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, such that (informally) a∗ = 1 + a + a * a + a * a * a + ...
Main declarations
IdemSemiring: Idempotent semiringIdemCommSemiring: Idempotent commutative semiringKleeneAlgebra: Kleene algebra
Notation
a∗ is notation for kstar a in scope Computability.
References
- [D. Kozen, A completeness theorem for Kleene algebras and the algebra of regular events][kozen1994]
- https://planetmath.org/idempotentsemiring
- https://encyclopediaofmath.org/wiki/Idempotent_semi-ring
- https://planetmath.org/kleene_algebra
TODO
Instances for AddOpposite, MulOpposite, ULift, Subsemiring, Subring, Subalgebra.
Tags
kleene algebra, idempotent semiring
def IdemCommSemiring.ctorIdx E1 #
{α : Type u_5} → IdemCommSemiring α → ℕ
def KStar.ctorIdx E1 #
{α : Type u_5} → KStar α → ℕ
def KleeneAlgebra.ctorIdx E1 #
{α : Type u_5} → KleeneAlgebra α → ℕ
def IdemSemiring.ctorIdx E1 #
{α : Type u_5} → IdemSemiring α → ℕ
class IdemSemiring E3 #
Type u_5 → Type u_5
An idempotent semiring is a semiring with the additional property that addition is idempotent.
instance IdemSemiring.toOrderBot E0 #
{α : Type u_5} → [self : IdemSemiring α] → OrderBot α
instance IdemSemiring.toSemilatticeSup E0 #
{α : Type u_5} → [self : IdemSemiring α] → SemilatticeSup α
ctor IdemSemiring.mk E0 #
{α : Type u_5} →
[toSemiring : Semiring α] →
[toSemilatticeSup : SemilatticeSup α] →
[toOrderBot : OrderBot α] →
autoParam (∀ (a b : α), a + b = a ⊔ b) IdemSemiring.add_eq_sup._autoParam → IdemSemiring α
instance IdemSemiring.toSemiring E0 #
{α : Type u_5} → [self : IdemSemiring α] → Semiring α
theorem IdemSemiring.add_eq_sup E1 #
∀ {α : Type u_5} [self : IdemSemiring α] (a b : α), a + b = a ⊔ b
class IdemCommSemiring E3 #
Type u_5 → Type u_5
An idempotent commutative semiring is a commutative semiring with the additional property that addition is idempotent.
abbrev IdemCommSemiring.toSemilatticeSup E1 #
{α : Type u_5} → [self : IdemCommSemiring α] → SemilatticeSup α
abbrev IdemCommSemiring.toOrderBot E1 #
{α : Type u_5} → [self : IdemCommSemiring α] → OrderBot α
ctor IdemCommSemiring.mk E0 #
{α : Type u_5} →
[toCommSemiring : CommSemiring α] →
[toSemilatticeSup : SemilatticeSup α] →
[toOrderBot : OrderBot α] →
autoParam (∀ (a b : α), a + b = a ⊔ b) IdemSemiring.add_eq_sup._autoParam → IdemCommSemiring α
instance IdemCommSemiring.toIdemSemiring E0 #
{α : Type u_5} → [self : IdemCommSemiring α] → IdemSemiring α
instance IdemCommSemiring.toCommSemiring E0 #
{α : Type u_5} → [self : IdemCommSemiring α] → CommSemiring α
theorem IdemCommSemiring.add_eq_sup E1 #
∀ {α : Type u_5} [self : IdemCommSemiring α] (a b : α), a + b = a ⊔ b
class KStar E1 #
Type u_5 → Type u_5
Notation typeclass for the Kleene star ∗.
ctor KStar.mk E0 #
{α : Type u_5} → (α → α) → KStar α
abbrev KStar.kstar E1 #
{α : Type u_5} → [self : KStar α] → α → α
The Kleene star operator on a Kleene algebra
def Computability.«term_∗» E1 #
Lean.TrailingParserDescr
The Kleene star operator on a Kleene algebra
class KleeneAlgebra E3 #
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∗ ≤ a∗a∗ * a ≤ a∗- If
b * a ≤ b, thenb * a∗ ≤ b - If
a * b ≤ b, thena∗ * b ≤ b
instance KleeneAlgebra.toKStar E0 #
{α : Type u_5} → [self : KleeneAlgebra α] → KStar α
ctor KleeneAlgebra.mk E0 #
{α : Type u_5} →
[toIdemSemiring : IdemSemiring α] →
[toKStar : KStar α] →
(∀ (a : α), 1 ≤ KStar.kstar a) →
(∀ (a : α), a * KStar.kstar a ≤ KStar.kstar a) →
(∀ (a : α), KStar.kstar a * a ≤ KStar.kstar a) →
(∀ (a b : α), b * a ≤ b → b * KStar.kstar a ≤ b) →
(∀ (a b : α), a * b ≤ b → KStar.kstar a * b ≤ b) → KleeneAlgebra α
instance KleeneAlgebra.toIdemSemiring E0 #
{α : Type u_5} → [self : KleeneAlgebra α] → IdemSemiring α
theorem KleeneAlgebra.one_le_kstar E1 #
∀ {α : Type u_5} [self : KleeneAlgebra α] (a : α), 1 ≤ KStar.kstar a
theorem KleeneAlgebra.mul_kstar_le_kstar E1 #
∀ {α : Type u_5} [self : KleeneAlgebra α] (a : α), a * KStar.kstar a ≤ KStar.kstar a
theorem KleeneAlgebra.kstar_mul_le_kstar E1 #
∀ {α : Type u_5} [self : KleeneAlgebra α] (a : α), KStar.kstar a * a ≤ KStar.kstar a
theorem KleeneAlgebra.mul_kstar_le_self E1 #
∀ {α : Type u_5} [self : KleeneAlgebra α] (a b : α), b * a ≤ b → b * KStar.kstar a ≤ b
theorem KleeneAlgebra.kstar_mul_le_self E1 #
∀ {α : Type u_5} [self : KleeneAlgebra α] (a b : α), a * b ≤ b → KStar.kstar a * b ≤ b
abbrev IdemSemiring.ofSemiring E1 #
{α : Type u_1} → [inst : Semiring α] → (∀ (a : α), a + a = a) → IdemSemiring α
Construct an idempotent semiring from an idempotent addition.
theorem add_eq_sup E1 #
∀ {α : Type u_1} [inst : IdemSemiring α] (a b : α), a + b = a ⊔ b
theorem add_idem E1 #
∀ {α : Type u_1} [inst : IdemSemiring α] (a : α), a + a = a
theorem natCast_eq_one E1 #
∀ {α : Type u_1} [inst : IdemSemiring α] {n : ℕ}, n ≠ 0 → ↑n = 1
theorem ofNat_eq_one E1 #
∀ {α : Type u_1} [inst : IdemSemiring α] {n : ℕ} [inst_1 : n.AtLeastTwo], OfNat.ofNat n = 1
theorem nsmul_eq_self E1 #
∀ {α : Type u_1} [inst : IdemSemiring α] {n : ℕ}, n ≠ 0 → ∀ (a : α), n • a = a
theorem add_eq_left_iff_le E1 #
∀ {α : Type u_1} [inst : IdemSemiring α] {a b : α}, a + b = a ↔ b ≤ a
theorem add_eq_right_iff_le E1 #
∀ {α : Type u_1} [inst : IdemSemiring α] {a b : α}, a + b = b ↔ a ≤ b
theorem LE.le.add_eq_left E1 #
∀ {α : Type u_1} [inst : IdemSemiring α] {a b : α}, b ≤ a → a + b = a
Alias of the reverse direction of add_eq_left_iff_le.
theorem LE.le.add_eq_right E1 #
∀ {α : Type u_1} [inst : IdemSemiring α] {a b : α}, a ≤ b → a + b = b
Alias of the reverse direction of add_eq_right_iff_le.
theorem add_le_iff E0 #
∀ {α : Type u_1} [inst : IdemSemiring α] {a b c : α}, a + b ≤ c ↔ a ≤ c ∧ b ≤ c
theorem add_le E1 #
∀ {α : Type u_1} [inst : IdemSemiring α] {a b c : α}, a ≤ c → b ≤ c → a + b ≤ c
instance IdemSemiring.toIsOrderedAddMonoid E0 #
∀ {α : Type u_1} [inst : IdemSemiring α], IsOrderedAddMonoid α
instance IdemSemiring.toCanonicallyOrderedAdd E0 #
∀ {α : Type u_1} [inst : IdemSemiring α], CanonicallyOrderedAdd α
instance IdemSemiring.toMulLeftMono E0 #
∀ {α : Type u_1} [inst : IdemSemiring α], MulLeftMono α
instance IdemSemiring.toMulRightMono E0 #
∀ {α : Type u_1} [inst : IdemSemiring α], MulRightMono α
theorem one_le_kstar E0 #
∀ {α : Type u_1} [inst : KleeneAlgebra α] {a : α}, 1 ≤ KStar.kstar a
theorem mul_kstar_le_kstar E1 #
∀ {α : Type u_1} [inst : KleeneAlgebra α] {a : α}, a * KStar.kstar a ≤ KStar.kstar a
theorem kstar_mul_le_kstar E1 #
∀ {α : Type u_1} [inst : KleeneAlgebra α] {a : α}, KStar.kstar a * a ≤ KStar.kstar a
theorem mul_kstar_le_self E1 #
∀ {α : Type u_1} [inst : KleeneAlgebra α] {a b : α}, b * a ≤ b → b * KStar.kstar a ≤ b
theorem kstar_mul_le_self E1 #
∀ {α : Type u_1} [inst : KleeneAlgebra α] {a b : α}, a * b ≤ b → KStar.kstar a * b ≤ b
theorem mul_kstar_le E1 #
∀ {α : Type u_1} [inst : KleeneAlgebra α] {a b c : α}, b ≤ c → c * a ≤ c → b * KStar.kstar a ≤ c
theorem kstar_mul_le E1 #
∀ {α : Type u_1} [inst : KleeneAlgebra α] {a b c : α}, b ≤ c → a * c ≤ c → KStar.kstar a * b ≤ c
theorem kstar_le_of_mul_le_left E1 #
∀ {α : Type u_1} [inst : KleeneAlgebra α] {a b : α}, 1 ≤ b → b * a ≤ b → KStar.kstar a ≤ b
theorem kstar_le_of_mul_le_right E1 #
∀ {α : Type u_1} [inst : KleeneAlgebra α] {a b : α}, 1 ≤ b → a * b ≤ b → KStar.kstar a ≤ b
theorem le_kstar E0 #
∀ {α : Type u_1} [inst : KleeneAlgebra α] {a : α}, a ≤ KStar.kstar a
theorem kstar_mono E1 #
∀ {α : Type u_1} [inst : KleeneAlgebra α], Monotone KStar.kstar
theorem kstar_eq_one E0 #
∀ {α : Type u_1} [inst : KleeneAlgebra α] {a : α}, KStar.kstar a = 1 ↔ a ≤ 1
theorem kstar_zero E0 #
∀ {α : Type u_1} [inst : KleeneAlgebra α], KStar.kstar 0 = 1
theorem kstar_one E0 #
∀ {α : Type u_1} [inst : KleeneAlgebra α], KStar.kstar 1 = 1
theorem kstar_mul_kstar E0 #
∀ {α : Type u_1} [inst : KleeneAlgebra α] (a : α), KStar.kstar a * KStar.kstar a = KStar.kstar a
theorem kstar_eq_self E0 #
∀ {α : Type u_1} [inst : KleeneAlgebra α] {a : α}, KStar.kstar a = a ↔ a * a = a ∧ 1 ≤ a
theorem kstar_idem E0 #
∀ {α : Type u_1} [inst : KleeneAlgebra α] (a : α), KStar.kstar (KStar.kstar a) = KStar.kstar a
theorem pow_le_kstar E0 #
∀ {α : Type u_1} [inst : KleeneAlgebra α] {a : α} {n : ℕ}, a ^ n ≤ KStar.kstar a
theorem one_add_mul_kstar E1 #
∀ {α : Type u_1} [inst : KleeneAlgebra α] {a : α}, 1 + a * KStar.kstar a = KStar.kstar a
theorem one_add_kstar_mul E1 #
∀ {α : Type u_1} [inst : KleeneAlgebra α] {a : α}, 1 + KStar.kstar a * a = KStar.kstar a
instance Prod.instIdemSemiring E0 #
{α : Type u_1} → {β : Type u_2} → [IdemSemiring α] → [IdemSemiring β] → IdemSemiring (α × β)
instance Prod.instIdemCommSemiring E0 #
{α : Type u_1} → {β : Type u_2} → [IdemCommSemiring α] → [IdemCommSemiring β] → IdemCommSemiring (α × β)
instance Prod.instKleeneAlgebra E0 #
{α : Type u_1} → {β : Type u_2} → [KleeneAlgebra α] → [KleeneAlgebra β] → KleeneAlgebra (α × β)
theorem Prod.kstar_def E0 #
∀ {α : Type u_1} {β : Type u_2} [inst : KleeneAlgebra α] [inst_1 : KleeneAlgebra β] (a : α × β),
KStar.kstar a = (KStar.kstar a.1, KStar.kstar a.2)
theorem Prod.fst_kstar E0 #
∀ {α : Type u_1} {β : Type u_2} [inst : KleeneAlgebra α] [inst_1 : KleeneAlgebra β] (a : α × β),
(KStar.kstar a).1 = KStar.kstar a.1
theorem Prod.snd_kstar E0 #
∀ {α : Type u_1} {β : Type u_2} [inst : KleeneAlgebra α] [inst_1 : KleeneAlgebra β] (a : α × β),
(KStar.kstar a).2 = KStar.kstar a.2
instance Pi.instIdemSemiring E0 #
{ι : Type u_3} → {π : ι → Type u_4} → [(i : ι) → IdemSemiring (π i)] → IdemSemiring ((i : ι) → π i)
instance Pi.instIdemCommSemiringForall E0 #
{ι : Type u_3} → {π : ι → Type u_4} → [(i : ι) → IdemCommSemiring (π i)] → IdemCommSemiring ((i : ι) → π i)
instance Pi.instKleeneAlgebraForall E0 #
{ι : Type u_3} → {π : ι → Type u_4} → [(i : ι) → KleeneAlgebra (π i)] → KleeneAlgebra ((i : ι) → π i)
theorem Pi.kstar_def E0 #
∀ {ι : Type u_3} {π : ι → Type u_4} [inst : (i : ι) → KleeneAlgebra (π i)] (a : (i : ι) → π i),
KStar.kstar a = fun i ↦ KStar.kstar (a i)
theorem Pi.kstar_apply E0 #
∀ {ι : Type u_3} {π : ι → Type u_4} [inst : (i : ι) → KleeneAlgebra (π i)] (a : (i : ι) → π i) (i : ι),
KStar.kstar a i = KStar.kstar (a i)
abbrev Function.Injective.idemSemiring E1 #
{α : Type u_1} →
{β : Type u_2} →
[inst : IdemSemiring α] →
[inst_1 : LE β] →
[inst_2 : LT β] →
[inst_3 : Zero β] →
[inst_4 : One β] →
[inst_5 : Add β] →
[inst_6 : Mul β] →
[inst_7 : Pow β ℕ] →
[inst_8 : SMul ℕ β] →
[inst_9 : NatCast β] →
[inst_10 : Max β] →
[inst_11 : Bot β] →
(f : β → α) →
Function.Injective f →
(∀ {x y : β}, f x ≤ f y ↔ x ≤ y) →
(∀ {x y : β}, f x < f y ↔ x < y) →
f 0 = 0 →
f 1 = 1 →
(∀ (x y : β), f (x + y) = f x + f y) →
(∀ (x y : β), f (x * y) = f x * f y) →
(∀ (n : ℕ) (x : β), f (n • x) = n • f x) →
(∀ (x : β) (n : ℕ), f (x ^ n) = f x ^ n) →
(∀ (n : ℕ), f ↑n = ↑n) →
(∀ (a b : β), f (a ⊔ b) = f a ⊔ f b) → f ⊥ = ⊥ → IdemSemiring β
Pullback an IdemSemiring instance along an injective function.
abbrev Function.Injective.idemCommSemiring E1 #
{α : Type u_1} →
{β : Type u_2} →
[inst : IdemCommSemiring α] →
[inst_1 : LE β] →
[inst_2 : LT β] →
[inst_3 : Zero β] →
[inst_4 : One β] →
[inst_5 : Add β] →
[inst_6 : Mul β] →
[inst_7 : Pow β ℕ] →
[inst_8 : SMul ℕ β] →
[inst_9 : NatCast β] →
[inst_10 : Max β] →
[inst_11 : Bot β] →
(f : β → α) →
Function.Injective f →
(∀ {x y : β}, f x ≤ f y ↔ x ≤ y) →
(∀ {x y : β}, f x < f y ↔ x < y) →
f 0 = 0 →
f 1 = 1 →
(∀ (x y : β), f (x + y) = f x + f y) →
(∀ (x y : β), f (x * y) = f x * f y) →
(∀ (n : ℕ) (x : β), f (n • x) = n • f x) →
(∀ (x : β) (n : ℕ), f (x ^ n) = f x ^ n) →
(∀ (n : ℕ), f ↑n = ↑n) →
(∀ (a b : β), f (a ⊔ b) = f a ⊔ f b) → f ⊥ = ⊥ → IdemCommSemiring β
Pullback an IdemCommSemiring instance along an injective function.
abbrev Function.Injective.kleeneAlgebra E1 #
{α : Type u_1} →
{β : Type u_2} →
[inst : KleeneAlgebra α] →
[inst_1 : LE β] →
[inst_2 : LT β] →
[inst_3 : Zero β] →
[inst_4 : One β] →
[inst_5 : Add β] →
[inst_6 : Mul β] →
[inst_7 : Pow β ℕ] →
[inst_8 : SMul ℕ β] →
[inst_9 : NatCast β] →
[inst_10 : Max β] →
[inst_11 : Bot β] →
[inst_12 : KStar β] →
(f : β → α) →
Function.Injective f →
(∀ {x y : β}, f x ≤ f y ↔ x ≤ y) →
(∀ {x y : β}, f x < f y ↔ x < y) →
f 0 = 0 →
f 1 = 1 →
(∀ (x y : β), f (x + y) = f x + f y) →
(∀ (x y : β), f (x * y) = f x * f y) →
(∀ (n : ℕ) (x : β), f (n • x) = n • f x) →
(∀ (x : β) (n : ℕ), f (x ^ n) = f x ^ n) →
(∀ (n : ℕ), f ↑n = ↑n) →
(∀ (a b : β), f (a ⊔ b) = f a ⊔ f b) →
f ⊥ = ⊥ →
(∀ (a : β), f (KStar.kstar a) = KStar.kstar (f a)) →
KleeneAlgebra β
Pullback a KleeneAlgebra instance along an injective function.