AFTD Auto-Formalizing Theoretical Domains

bmi_assoc_of_is_b_of_left_unit

theoremverifiedformalization

Let $(A, \cdot)$ be a magma with a $B$-element $B$. If $B$ is a left unit ($Bx = x$ for all $x$), then the operation is associative: $(xy)z = x(yz)$ for all $x, y, z \in A$.

Statement

theorem bmi_assoc_of_is_b_of_left_unit {A : Type*} [Mul A]
    (B : A) (hB : bmi_is_b_element B) (hB_unit : ∀ x : A, B * x = x) :
    ∀ x y z : A, (x * y) * z = x * (y * z)
Formalizes
arXiv:2610.37108 Proposition 3.1 -- Finite BM-algebras and fixed-point combinators
Verified
28 Oct 2026
Axioms
none — Lean reports it depends on no axioms
Built on 1
  • bmi_is_b_elementAn element $B$ in a magma $(A, \cdot)$ is a $B$-element if $((Bx)y)z = x(yz)$ for all $x, y, z \in A$.
Used by 3

Read back from the Lean

For any type A equipped with a multiplication * and any element B : A, if B is a "B-element" (satisfies bmi_is_b_element B) and B is a left identity for multiplication (for all x : A, B * x = x), then multiplication on A is associative: for all x, y, z : A, (x * y) * z = x * (y * z).

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

The proof, explained

To prove that multiplication is associative, we evaluate the defining property of the $B$-element, $((B \cdot x) \cdot y) \cdot z = x \cdot (y \cdot z)$, on arbitrary elements $x, y, z \in A$. Because $B$ is a left unit, $B \cdot x$ simplifies to $x$. This immediately reduces the equality to $(x \cdot y) \cdot z = x \cdot (y \cdot z)$, establishing associativity.

  1. For arbitrary elements $x, y, z \in A$, we have $((B \cdot x) \cdot y) \cdot z = x \cdot (y \cdot z)$.

    We introduce arbitrary elements $x, y, z \in A$ and instantiate the definition of a $B$-element (`bmi_is_b_element`), which states that $B \cdot u \cdot v \cdot w = u \cdot (v \cdot w)$ for all $u, v, w$ (with multiplication being left-associative).

    lines 5–6

      intro x y z
      have h := hB x y z
  2. $(x \cdot y) \cdot z = x \cdot (y \cdot z)$

    Because $B$ is a left unit ($B \cdot x = x$ by `hB_unit`), we substitute $x$ for $B \cdot x$ in the established equality, transforming $((B \cdot x) \cdot y) \cdot z = x \cdot (y \cdot z)$ into $(x \cdot y) \cdot z = x \cdot (y \cdot z)$, which closes the goal.

    lines 7–8

      rw [hB_unit x] at h
      exact h

Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.

Lean source view module on GitHub

/-- If B is a B-element and also a left unit in a magma A, then multiplication on A is associative. -/theorem bmi_assoc_of_is_b_of_left_unit {A : Type*} [Mul A]    (B : A) (hB : bmi_is_b_element B) (hB_unit : ∀ x : A, B * x = x) :    ∀ x y z : A, (x * y) * z = x * (y * z) := by  intro x y z  have h := hB x y z  rw [hB_unit x] at h  exact h
See it in the graphDiscuss this resultChallenge it