LeanEuclid (System E in Lean 4)

L3 Rule-closed · Archetype: synthetic-formal · upstream · dossier

Believe it because Lean’s kernel checked every rule application from System E’s axioms — except that premise-discharging steps are admitted by an SMT oracle axiom.

Trust chain

LeanEuclid trust chain

Ontology

Axiomatized sorts Point, Line, Circle (+ Segment, Angle, Triangle); opaque relations onLine, sameSide, between, onCircle; magnitudes in ℝ. (What exists?)

Language

Lean 4 propositions in System E syntax: ∀ a b c : Point, formTriangle … → ∠ a:b:c = ∠ a:c:b. (How is a statement written?)

Assumptions

System E as 101 Lean axiom declarations (construction, diagrammatic, metric, transfer, superposition) + hand-written SMT theory. (What is taken as given?)

Engine

euclid_apply (kernel-checked rule instance) with premises closed by euclid_finish → z3/cvc5. (How are new truths derived?)

Certificate

Lean proof term with opaque SMT_VERIF leaves. (What evidence is left behind?)

Checker

Lean 4 kernel + SMT_VERIF oracle (solver, translator, hand-written theory). (What must be trusted?)

Semantics

Avigad–Dean–Mumma: E is sound and complete for ruler-and-compass Euclidean planes (not formalized in LeanEuclid). (What model makes it sound?)

At a glance

Logic / calculus:

Dependent type theory + axioms

Exact vs numeric:

Exact (symbolic)

Decision procedure:

SMT on the diagrammatic fragment (oracle)

Role of the diagram:

Formalized: 36 diagrammatic + 23 transfer axioms

Degeneracy handling:

Explicit hypotheses (formTriangle, a ≠ b)

Trusted base (size):

Lean kernel + SMT stack (unbounded)

Trusts:

Lean 4 kernel (~8k lines C++ (estimate)) · SMT_VERIF oracle (z3/cvc5 + hand-written E theory)

Catalog:

256 principles (65 shared with other systems) — search

A statement in its own language

theorem proposition_5 : ∀ (a b c d e : Point) (AB BC AC : Line),
          formTriangle a b c AB BC AC ∧ (|(a─b)| = |(a─c)|) ∧
          (between a b d) ∧ (between a c e) →
          (∠ a:b:c = ∠ a:c:b) ∧ (∠ c:b:d = ∠ b:c:e) :=
        

Source: Prop05.lean#L7-L10

Findings

  • euclid_finish closes goals with `axiom SMT_VERIF (P : Prop) : P` (SystemE/Meta/Smt/Solver.lean:44-54) — inconsistent as a Lean axiom; solver timeouts fall back to `sorry`.

  • The SMT background theory (Meta/Smt/EuclidTheory.lean, ~111 asserts) is hand-written, not derived from the Lean axioms.

  • 104 `axiom` declarations under SystemE/Theory: 3 sorts + 101 rules (36 diagrammatic, 23 transfer, 21+7+2 construction, 11 metric, 1 superposition).

  • Book/Prop47.lean isolates orientation lemmas Euclid’s Bride’s Chair leaves implicit.

In the showcase

References