Formall vs. Other Proof Assistants
A structured comparison with Lean 4, Coq, Agda, Isabelle/HOL, and Metamath
Overview
Formall sits at a different point in the proof assistant design space than Lean 4, Coq, Agda, Isabelle/HOL, and Metamath. This page puts them side by side on the same concrete theorems, then summarises the conceptual differences. The goal is not a ranking but a clear picture of what each system optimises for.
- Lean 4 — dependent types, tactic and term mode, Mathlib standard library. Proofs and programs unified via Curry–Howard.
- Coq / Rocq — dependent types, tactic-based, constructive by default. Classical axioms are an explicit import.
- Agda — dependent types, no tactics, proof terms written directly. Constructive (intuitionistic) only.
- Isabelle/HOL — higher-order logic, structured Isar proof language, classical by default. Powerful automation via sledgehammer.
- Metamath — no built-in logic: axioms are declared as
$astatements, proofs are chains of substitutions written in reverse Polish notation. Its main databaseset.mmbuilds ZFC set theory from scratch (about 48,000 theorems); there are many small independent verifiers. The closest relative of Formall — see below. - Formall — typed atoms with HOL-style type variables (not dependent types, see below), scope-tree proofs, a small core of commands. No built-in logic — you define it from axioms.
Example 1: double negation elimination — ¬¬x → x
Prove: if ¬¬x holds, then x holds. Constructive systems (Agda, base Coq, base Lean) cannot prove this without a classical axiom.
Lean 4 — term mode with Classical
-- Classical is a built-in namespace; no external file needed
open Classical
-- em p : p ∨ ¬p (excluded middle, from Classical)
-- Or.elim splits the disjunction into two cases:
-- · left branch (hp : p) → return hp directly
-- · right branch (hnp : ¬p) → absurd : ¬p → ¬¬p → False → p
-- Result type: p
theorem dne {p : Prop} (h : ¬¬p) : p :=
Or.elim (em p)
(fun hp : p => hp) -- case p holds: done
(fun hnp : ¬p => absurd hnp h) -- case ¬p: contradicts h : ¬¬p
Coq (tactic mode) — with full manual classical setup
(* Coq is constructive by default.
We can either import Classical or declare the axiom ourselves. *)
(* Rule A: import the library *)
Require Import Classical.
(* This gives us: NNPP : forall P : Prop, ~~P -> P *)
Theorem dne_library : forall P : Prop, ~~P -> P.
Proof.
intros P H. (* H : ~~P, goal : P *)
apply NNPP. (* NNPP reduces ~~P → P to showing ~~P *)
exact H. (* H : ~~P. QED, result: P *)
Qed.
(* Rule B: declare classical axiom manually, no imports *)
Axiom excluded_middle : forall P : Prop, P \/ ~P.
Theorem dne_manual : forall P : Prop, ~~P -> P.
Proof.
intros P H.
destruct (excluded_middle P) as [hp | hnp].
- exact hp. (* case P holds: done, result P *)
- exfalso. (* goal becomes False *)
apply H. exact hnp. (* H : ~~P, hnp : ~P, so H hnp : False *)
Qed.
Agda — constructive only; DNE requires a postulate
-- Agda's logic is intuitionistic: ¬¬A → A is not provable.
-- We can postulate excluded middle as an axiom:
open import Data.Empty using (⊥; ⊥-elim) -- ⊥ = False
open import Data.Sum using (_⊎_; inj₁; inj₂)
-- ¬ A is defined as A → ⊥
¬_ : Set → Set
¬ A = A → ⊥
-- Postulate excluded middle (not provable constructively)
postulate
em : (A : Set) → A ⊎ ¬ A
-- Double negation elimination using the postulate
dne : {A : Set} → ¬ ¬ A → A
dne {A} h with em A
... | inj₁ a = a -- case A holds: return a directly
... | inj₂ ¬a = ⊥-elim (h ¬a)
-- case ¬A: h : ¬¬A, ¬a : ¬A, so h ¬a : ⊥, ⊥-elim gives A
Isabelle/HOL — classical by default, Isar proof language
(* Isabelle/HOL is classical; no imports needed. *) (* 'classical' is a built-in rule: (¬P ⟹ P) ⟹ P *) theory DNE imports Main begin theorem dne: "¬¬P ⟹ P" proof (rule classical) (* apply classical: assume ¬P, prove P *) assume "¬P" "¬¬P" (* both assumptions now in context *) then show P by contradiction (* ¬P and ¬¬P directly contradict *) qed (* Result: ¬¬P ⟹ P *) end
Metamath (set.mm)
$( Metamath has no built-in logic either: set.mm declares its axioms
(ax-mp, ax-1, ax-2, ax-3, ...) as $a statements, and a proof is a
list of labels in reverse Polish notation. The verifier only checks
that every step is a correct substitution instance. $)
$[ set.mm $]
$( Double negation elimination from Clavius' law
pm2.18 : |- ( ( -. ph -> ph ) -> ph )
jarli turns |- ( ( ph -> ps ) -> ch ) into |- ( -. ph -> ch ). $)
dne $p |- ( -. -. ph -> ph ) $=
wph wn wph wph wph pm2.18 jarli $.
$( wph wn : build the wff -. ph (substituted for ph in jarli)
wph wph : ps := ph, ch := ph
wph pm2.18 : jarli's hypothesis, an instance of Clavius' law
Result: |- ( -. -. ph -> ph ) $)
Formall: double negation elimination
No imports. The logic rules — which truth values contradict each other, how not behaves — are declared explicitly at the top. The proof assumes x -> false, derives not(not(x)) -> false by a proof, then contradict closes the assumption. Result: x -> true inside the outer if block.
Example 2: reusing a theorem — ¬¬¬x → ¬x
Apply the double negation theorem to ¬x instead of x.
Lean 4
open Classical
-- Lean's type system unfolds ¬¬¬p as ¬¬(¬p) automatically.
-- dne is applied with implicit argument ¬p inferred from context.
theorem triple_neg {p : Prop} (h : ¬¬¬p) : ¬p :=
dne h
-- Result: ¬p (Lean infers the substitution from the type)
Coq (tactic mode)
Axiom excluded_middle : forall P : Prop, P \/ ~P. Theorem dne_manual : forall P : Prop, ~~P -> P. Proof. intros P H. destruct (excluded_middle P) as [hp | hnp]. - exact hp. - exfalso. apply H. exact hnp. Qed. Theorem triple_neg : forall P : Prop, ~~~P -> ~P. Proof. intros P H. (* H : ~~~P, goal : ~P i.e. P → False *) apply dne_manual. (* reduce goal to ~~(~P) = ~~~P *) exact H. (* H : ~~~P matches. Result: ¬P *) Qed.
Agda
-- Using dne from Example 1 (with em postulate)
triple-neg : {A : Set} → ¬ ¬ ¬ A → ¬ A
triple-neg h = dne h
-- Agda unifies ¬¬¬A with ¬¬(¬A); dne applied with A := ¬A.
-- Result: ¬A
Isabelle/HOL
theory TripleNeg imports DNE begin (* Use dne lemma from Example 1 *) theorem triple_neg: "¬¬¬P ⟹ ¬P" using dne by blast (* blast: automated reasoner closes the goal instantly. *) (* Result: ¬P *) end
Metamath (set.mm)
$( Reuse dne from Example 1. The verifier computes the substitution ph := -. ph itself; the proof only builds the wff -. ph (wph wn). $) triple-neg $p |- ( -. -. -. ph -> -. ph ) $= wph wn dne $. $( Result: |- ( -. -. -. ph -> -. ph ) $)
Formall: reuse by a call
MyDNE[not(y)] substitutes not(y) for x in the theorem. The substitution is explicit — passed as a string. Lean and Agda infer it from types; Coq infers it from the goal. Result: not(y) -> true inside not(not(not(y))) -> true.
Example 3: symmetry of equality — x = y → y = x
Lean 4
-- Equality (=) is built into Lean's type theory (reflexivity, congruence).
-- h ▸ rfl: rewrite the goal "b = a" using h : a = b, giving "a = a",
-- then close with rfl (reflexivity). Result: b = a
theorem eq_symm {α : Type} {a b : α} (h : a = b) : b = a :=
h ▸ rfl
Coq (tactic mode)
Theorem eq_symm : forall (A : Type) (a b : A), a = b -> b = a. Proof. intros A a b H. (* H : a = b, goal : b = a *) rewrite H. (* rewrite a → b in goal via H, goal becomes b = b *) reflexivity. (* close b = b. Result: b = a *) Qed.
Agda
-- Equality is defined inductively (refl : a ≡ a)
-- Pattern matching on refl forces a = b, unifying a and b.
open import Relation.Binary.PropositionalEquality using (_≡_; refl)
sym : {A : Set} {a b : A} → a ≡ b → b ≡ a
sym refl = refl
-- When h : a ≡ b is matched as refl, a and b become equal by definition.
-- refl then proves b ≡ a trivially. Result: b ≡ a
Isabelle/HOL
theory EqSym imports Main begin (* sym is already in Main; shown here for comparison *) theorem eq_sym_manual: "a = b ⟹ b = a" proof - assume h: "a = b" (* h : a = b in context *) from h show "b = a" by (rule sym) (* sym : a = b ⟹ b = a *) qed (* Result: b = a *) end
Metamath (set.mm)
$( Class equality is defined in set.mm (df-cleq), and eqcom is a theorem:
eqcom : |- ( A = B <-> B = A )
mpbi : from |- ph and |- ( ph <-> ps ) conclude |- ps
A ${ ... $} block scopes the hypothesis eqsym.1 to this theorem. $)
${
eqsym.1 $e |- A = B $.
eqsym $p |- B = A $=
cA cB wceq cB cA wceq eqsym.1 cA cB eqcom mpbi $.
$}
$( Result: from |- A = B infer |- B = A $)
Formall: symmetry of equality
Formall has no built-in equality. Reflexivity is an explicit axiom; rewriting is the substitution syntax <=(y, <x>)>; indiscernibility is a lock axiom. More code than other systems — but every rule that equality follows is visible and auditable. Result: L=Sym — =(y, x) -> ✔ whenever =(x, y) -> ✔.
Conceptual differences
Metamath: the closest relative
Of all the systems on this page, Metamath shares Formall's core philosophy most closely: the verifier knows no logic. In Metamath, ax-mp, the propositional axioms and ZFC are ordinary $a declarations in a text file; the verifier checks only that every proof step is a correct substitution instance of an earlier statement. The whole language is a handful of keywords ($c $v $f $e $d $a $p), and set.mm — about 48,000 theorems of ZFC — is verified by the reference program in roughly four seconds. Even the route to double negation is the same: set.mm derives it from Clavius' law ((¬φ → φ) → φ), which is exactly what Formall's contradict does when it flips an assumption.
The differences are in what the core takes care of:
- Binders and variables. Metamath is pure string substitution; bound variables are managed by explicit distinct-variable conditions (
$d) and substitution lemmas. Formall has typed terms and constructors{x: T | …}with α-equivalence built in, so bound variables need no bookkeeping. - Contexts. Metamath is Hilbert-style: there are no local assumptions, so set.mm writes most theorems in deduction form
ph -> …and carries the context by hand. Formall's scope tree (if,for,rule) gives natural-deduction-style contexts directly. - Proof text. A Metamath proof is a list of labels in reverse Polish notation (including the steps that merely build formulas); it is compact and machine-checkable but unreadable without a tool that displays it. A Formall proof is a sequence of commands, each producing a visible statement.
- Instantiation. Metamath's verifier computes substitutions by unification —
wph wn dneis enough to usedneat¬φ. A Formall callT[a]takes the substitution as written values, or infers them from the conditions of the theorem. - Hypothetical theorems. Metamath's essential hypotheses (
$e) turn a theorem into an inference rule whose premises must be proved before use. Formall'slock()/axiom/ call plays the same role, but a realization may itself be proved under localfor/ifassumptions and is matched by signature. - Ecosystem. Metamath has a large library, a detailed specification and several independent verifiers written in different languages. Formall has one interpreter and a growing corpus.
In short: Metamath minimises the trusted kernel; Formall trades a somewhat larger kernel (types, binders, scopes, contradiction) for proofs that read as structured text.
Logic system: axiom-defined vs. built-in
Lean, Coq, and Agda have a fixed constructive core — intuitionistic type theory. Classical axioms exist but must be added deliberately. Isabelle/HOL is classical but still has a fixed higher-order logic built in.
Formall, like Metamath, has no built-in logic at all. type(bool = false | true) declares the truth values, every two different; if axioms declare how connectives behave; lock() introduces any further axioms. You can define classical boolean logic (as above), a three-valued logic, or a custom axiom system — Formall treats them identically. There is no constructive/classical split to manage, because the distinction is itself defined by your axioms.
Types: three designs
A frequent question: how do you state one equality = that works for numbers, sets and functions alike? The three families of systems answer it differently.
Metamath: one universe, no types
set.mm has no types of mathematical objects. Everything — the number 2, a real number, a function, ℝ itself — is a set (a class). So there is a single = between classes, and no =ℕ, =ℝ copies; ℕ ⊆ ℝ is ordinary inclusion. "x is a real number" is a hypothesis A ∈ ℝ, not a type. Metamath has only syntactic sorts (wff, setvar, class) that keep formulas well-formed. A theorem is a scheme over metavariables, and applying it is textual substitution.
HOL (Isabelle/HOL, HOL Light) and Formall: type variables outside the statement
Formall follows this design. A type variable 'α makes an atom polymorphic and every statement about it a scheme; a call substitutes a concrete type. This is how library/logic/equality.fl declares equality once for every type:
Formall (actual library code)
type("'α");
for("=: ['α, 'α -> 𝔹]"); notation("infix", "=", "50");
for ("x: 'α") A=Reflexive: axiom(𝒜, "x = x");
for ("a, b: 'α") if ("a = b") A=Rewrite: axiom(𝒜, "a -> b");
'α stays outside the statement: one cannot write a single statement that says "for every type". Structures such as groups are theory blocks type(G) for(∘, e) if(axioms) { … } applied by calls — the same idea as Isabelle's locales. The kernel needs no computation, and equality of types is plain syntactic equality.
Inside a block a premise over 'α can be used at another type: a proof about ℕ rewrites with A=Rewrite at ℕ. The certificate kernel (Reducibility) states such a premise as the schema it is, "for every type A, A=Rewrite at A", and each use is the schema taken at a type, which the kernel checks like any other step. The certificate has a quantifier over types for this; the language does not need one, because 'α already says it. Other systems differ here. HOL instantiates a whole theorem at a type together with its hypotheses (INST_TYPE), so the hypothesis at the other type becomes one more hypothesis of the theorem. Isabelle keeps 'a fixed inside a locale, and the locale's assumptions cannot be used at another type there. In Lean and Coq a hypothesis "for every type" is an ordinary formula ∀ α, P α.
Lean, Coq, Agda: types are values (dependent types)
The code below is hypothetical — Formall does not support it. It shows what Formall would look like on the dependent-type route.
1. A type of types 𝕋 (Lean's Type) lets a statement quantify over types inside the formula:
Hypothetical Formall
for("=: ∀{T: 𝕋 | [T, T -> 𝔹]}") // one constant with a type argument
axiom(𝒜, "∀{T: 𝕋 | ∀{x: T | =(T, x, x)}} -> ✔")
if("∀{T: 𝕋 | ∃{x: T | ✔}} -> ✔") // "every type is inhabited" as a hypothesis
2. A structure is a value, and its carrier is a type computed from that value:
Hypothetical Formall
define("Group", "{ G: 𝕋, ∘: [G, G -> G], e: G, assoc: …, … }")
for("H: Group")
for("a, b: H.G") // the type depends on the value H
"∀{H: Group | ∀{a: H.G | a H.∘ H.e = a}}" // an ordinary statement about all groups
This allows lists of groups, a function "group ↦ its centre (a group)", the type of elements of a subgroup.
3. A type depending on a number — and the price:
Hypothetical Formall
for("Vec: [ℕ -> 𝕋]")
for("append: ∀{n, m: ℕ | [Vec(n), Vec(m) -> Vec(n + m)]}")
for("n: ℕ") for("v: Vec(n), w: Vec(0)")
"=(append(v, w), v)" // TYPE ERROR unless the kernel computes Vec(n + 0) to Vec(n)
- The kernel must compute. To see that
Vec(n + 0)andVec(n)are the same type it has to reducen + 0— a small evaluator inside the trusted kernel. - Theorems do not help type checking. If addition recurses on the second argument,
0 + ndoes not reduce ton;0 + n = nis only a theorem, so one needs an explicit cast ("transport"). Fighting such casts is a known cost in Mathlib. - Equality depends on typing.
x = yis well-formed only when the types coincide, and that coincidence is a computation, not a statement.
On the HOL route one writes v: 𝕊 with a hypothesis length(v) = n instead: coarser, but the kernel needs no evaluator.
Which is better?
There is no consensus; it is a trade-off. Dependent types are more expressive, and Lean has the largest library of formal mathematics (Mathlib). HOL has a much smaller logic and kernel (HOL Light's is a few hundred lines), strong automation (Sledgehammer) and large verification projects (seL4, CakeML); it is argued (e.g. by Paulson) that HOL with locales suffices for most ordinary mathematics. Formall takes the HOL route: its goal is a small, reliable, checkable kernel — rank-one polymorphic constants plus schematic theorems, with "for every structure" expressed by theory blocks and calls.
Proof structure: tactics vs. scope tree
Coq and Lean build proofs interactively by transforming goals. You see the current goal state, apply a tactic, and get subgoals. Lean 4 has simp, omega, decide, and grind — tactics that solve whole classes of goals in one step. Isabelle's sledgehammer calls external theorem provers automatically.
Formall builds proofs as a static nested-block tree. There are no goals, no subgoal queue, no tactic state. Each if block introduces an assumption; each for introduces variables; each lock introduces local axioms. The structure of the code is the structure of the proof. Every step is an explicit command with a precisely defined effect. Formall proofs are longer, but fully readable as text without a running proof assistant.
Standard library vs. blank slate
Lean's Mathlib, Coq's standard library, and Isabelle's Archive of Formal Proofs each contain tens of thousands of theorems. Agda's standard library is similarly substantial. Working in these systems, you build on a large existing body of mathematics.
Formall starts from axioms. The library modules (library/logic/uniqueness.fl, library/sets/main.fl, library/peano/main.fl) build logic, arithmetic, and set operations from explicit axioms — including the Russell paradox, ordered pairs by Kuratowski, and existence of unions. This is slower to use but makes the foundations completely explicit and auditable.
A small core
Lean, Coq, and Isabelle have large trusted kernels and many derived rules. The kernel correctness is what you ultimately trust. Metamath sits at the other extreme: its whole verification rule is "check the substitution", and independent verifiers fit in a few hundred lines.
Formall's trusted core is a handful of commands — type, for, if, lock, rule, axiom — and two forms: proofs <…> and calls T[…]. The steps of a proof — contradiction, generalization, calls on quantified facts — and even if are expressed through lock, axiom and calls, as shown on the Command Reducibility page. If you understand what the core commands do, you understand everything the interpreter can verify.
induction tactic with Formall's Peano axiom approach; a set theory example; and the Curry–Howard correspondence — how proofs-as-programs applies (or does not) to Formall.