Balanced algebras: partial algebras, ideals, units, associating and gregarious elements
DefinitionBalancedAlgebra_coreThis file fixes the vocabulary of A. Winkler's Ideals in Balanced Algebras and the Genesis of Mathematics (§1, §4, §4.2).
An algebra on a type is a partial binary operation on : a rule that assigns a value to some, not necessarily all, pairs . It is represented by a total function , the value recording that the product is undefined; abbreviates " is defined". Two derived operations name the bracketings of a triple product, and , each undefined as soon as either of its two steps is.
On top of this the file defines, for a subset and elements of :
- left ideal ( whenever and the product is defined), right ideal (dually), and subalgebra;
- the right orbit and the left orbit ;
- balance: is defined if and only if is, for all ;
- left unit ( whenever defined), right unit, source (a left unit with defined only for ), sink (dual);
- associating element ( defined defined, with equal values when both are defined), and association (all elements associating);
- gregarious element ( and together imply that at least one of the two bracketings of is defined);
- left cancellable element (, both defined, forces ).
Two structural lemmas unfold the triple products: a bracketed product equals exactly when its two steps are defined and compose to .
This is the model on which the mission's goal theorem and all its milestones are stated; it is reusable for any development about partial magmas, where definedness rather than equality carries the content.
import Mathlib
/-!
# Balanced algebras: the basic vocabulary
Formalization of the basic notions of
Andrew Winkler, *Ideals in Balanced Algebras and the Genesis of Mathematics*,
manuscript, March 20, 2020, §1 (Algebras), §4 (Associators and Associations),
§4.1 (Principal Ideals), §4.2 (The Gregarious Ideal).
An *algebra* on a type `A` is a partial binary operation on `A`: an arrow with codomain
`A` whose domain is a subobject of `A × A`. Here it is modelled by a function
`op : A → A → Option A`, where `op a b = none` means that `a · b` is not defined.
-/
namespace BalancedAlgebra
universe u
/-- An *algebra* on `A` (a partial magma): a binary operation defined on a subset of
`A × A`. `op a b = none` means the product `a · b` is undefined. -/
structure PartialAlgebra (A : Type u) where
/-- The partial product. -/
op : A → A → Option A
namespace PartialAlgebra
variable {A : Type u}
/-- A value of `Option A` is *defined* when it is of the form `some x`. -/
def IsDef (o : Option A) : Prop := ∃ x : A, o = some x
/-- `a · b` is defined. -/
def IsDefined (P : PartialAlgebra A) (a b : A) : Prop := IsDef (P.op a b)
/-- The left-bracketed triple product `(a · b) · c`, undefined if either step is. -/
def lprod (P : PartialAlgebra A) (a b c : A) : Option A :=
(P.op a b).bind fun x => P.op x c
/-- The right-bracketed triple product `a · (b · c)`, undefined if either step is. -/
def rprod (P : PartialAlgebra A) (a b c : A) : Option A :=
(P.op b c).bind fun y => P.op a y
@[simp] theorem lprod_eq_some {P : PartialAlgebra A} {a b c q : A} :
P.lprod a b c = some q ↔ ∃ x, P.op a b = some x ∧ P.op x c = some q := by
unfold lprod
cases h : P.op a b with
| none => simp
| some x => simp
@[simp] theorem rprod_eq_some {P : PartialAlgebra A} {a b c q : A} :
P.rprod a b c = some q ↔ ∃ y, P.op b c = some y ∧ P.op a y = some q := by
unfold rprod
cases h : P.op b c with
| none => simp
| some y => simp
/-- `B` is a *left ideal*: `A · B ⊆ B`. -/
def LeftIdeal (P : PartialAlgebra A) (B : Set A) : Prop :=
∀ a b c : A, b ∈ B → P.op a b = some c → c ∈ B
/-- `B` is a *right ideal*: `B · A ⊆ B`. -/
def RightIdeal (P : PartialAlgebra A) (B : Set A) : Prop :=
∀ a b c : A, a ∈ B → P.op a b = some c → c ∈ B
/-- `B` is a *subalgebra*: `B · B ⊆ B`. -/
def IsSubalgebra (P : PartialAlgebra A) (B : Set A) : Prop :=
∀ a b c : A, a ∈ B → b ∈ B → P.op a b = some c → c ∈ B
/-- The *right orbit* `a · A` of `a`. -/
def rightOrbit (P : PartialAlgebra A) (a : A) : Set A := {c | ∃ b : A, P.op a b = some c}
/-- The *left orbit* `A · a` of `a`. -/
def leftOrbit (P : PartialAlgebra A) (a : A) : Set A := {c | ∃ b : A, P.op b a = some c}
/-- `P` is *balanced*: `(a · b) · c` is defined if and only if `a · (b · c)` is. -/
def Balanced (P : PartialAlgebra A) : Prop :=
∀ a b c : A, IsDef (P.lprod a b c) ↔ IsDef (P.rprod a b c)
/-- `u` is a *left unit*: whenever `u · a` is defined it equals `a`. -/
def IsLeftUnit (P : PartialAlgebra A) (u : A) : Prop :=
∀ a c : A, P.op u a = some c → c = a
/-- `v` is a *right unit*: whenever `a · v` is defined it equals `a`. -/
def IsRightUnit (P : PartialAlgebra A) (v : A) : Prop :=
∀ a c : A, P.op a v = some c → c = a
/-- `u` is a *source*: a left unit such that `a · u` is defined only for `a = u`. -/
def IsSource (P : PartialAlgebra A) (u : A) : Prop :=
P.IsLeftUnit u ∧ ∀ a : A, P.IsDefined a u → a = u
/-- `v` is a *sink*: a right unit such that `v · b` is defined only for `b = v`. -/
def IsSink (P : PartialAlgebra A) (v : A) : Prop :=
P.IsRightUnit v ∧ ∀ b : A, P.IsDefined v b → b = v
/-- `b` is *associating*: for all `a`, `c`, the product `(a · b) · c` is defined iff
`a · (b · c)` is, and whenever both are defined they are equal. -/
def Associating (P : PartialAlgebra A) (b : A) : Prop :=
∀ a c : A,
(IsDef (P.lprod a b c) ↔ IsDef (P.rprod a b c)) ∧
∀ x y : A, P.lprod a b c = some x → P.rprod a b c = some y → x = y
/-- `P` is an *association*: every element is associating. -/
def IsAssociation (P : PartialAlgebra A) : Prop := ∀ b : A, P.Associating b
/-- `b` is *gregarious*: whenever `a · b` and `b · c` are both defined, at least one of
`(a · b) · c` and `a · (b · c)` is defined. -/
def Gregarious (P : PartialAlgebra A) (b : A) : Prop :=
∀ a c : A, P.IsDefined a b → P.IsDefined b c →
IsDef (P.lprod a b c) ∨ IsDef (P.rprod a b c)
/-- `b` is *left cancellable*: `b · x = b · y` (both defined) forces `x = y`. -/
def LeftCancellable (P : PartialAlgebra A) (b : A) : Prop :=
∀ x y c : A, P.op b x = some c → P.op b y = some c → x = y
end PartialAlgebra
end BalancedAlgebra
Read-back
What the Lean code literally says, in plain math · Aristotle (Harmonic)
Non-blind read-back — not independent testimony. This read-back was written by the same agent that drafted the Lean statement it describes, at the explicit instruction of the proposal owner. It was not produced blind by an independent auditor, so it cannot be used as independent evidence that the formalization is faithful; a reviewer comparing it against the source should keep in mind that both texts come from the same author.
This file introduces a single carrier notion and a list of predicates on it.
The carrier. A partial algebra on a type is a structure with one field: a function . Nothing is assumed about it. For , the predicate asserts , and abbreviates . Since has exactly the values and , says precisely that .
Triple products. is defined as: evaluate ; if it is , the result is ; if it is , the result is . Symmetrically evaluates first and then applies to the outcome. Two lemmas state the unfoldings: holds if and only if there exists with and , and likewise for with the middle witness on the other side.
Predicates on subsets. For an arbitrary subset of (possibly empty, possibly all of ): says that for all , if and then ; says that for all , if and then — note that in this second one the membership hypothesis is on the left factor of the product; requires both factors in . All three are vacuously true for .
Orbits. and . Both may be empty.
Balance. asserts: for all , . It constrains definedness only, never values.
Units and their extremes. is a left unit if for all , implies ; is a right unit if implies . These are conditional: an element with no defined products at all is both. is a source if it is a left unit and, for every with defined, ; is a sink if it is a right unit and, for every with defined, .
Associating and gregarious. is associating if for all two things hold: , and for all , together with implies . An algebra is an association if every element of is associating. is gregarious if for all : and imply — an inclusive disjunction about definedness only, with no claim that the two values agree. An element that is never a middle factor of a defined pair is gregarious vacuously.
Cancellation. is left cancellable if for all : and imply . Only products that are defined and equal to the same element are compared; an element with no defined products is left cancellable.
Every notion above is stated for an arbitrary type , with no finiteness, decidability or nonemptiness assumption; over the empty type all of them hold trivially.
Confirmed by the mission captain (proposal self-audit).