Independent project · Oct 2026 - Present
Fang
Automated Theorem Proving with Lean-Checked Results
Fang is an automated theorem prover for first-order logic, written in Rust. You give it a problem, a set of premises and often a conjecture, and it either proves the conjecture or finds a finite model in which it fails. Before Fang reports either answer, an independent checker written in Lean 4 reads the original problem again and checks the result step by step.
How it works
1Search · Rust
Look for an answer
The search works on clauses and combines them with inference rules such as resolution and paramodulation until it derives the empty clause, or it builds a finite model. It is the fast part, and nothing it says is trusted on its own.
2Certificate
Write it down
Each answer is written down as a certificate: every step of the refutation, or the finite model itself, in a form another program can check.
3Check · Lean 4
Check it independently
The checker parses the original input again, redoes the preprocessing with Fang's own Rust code translated to Lean by Charon and Aeneas, and checks every step. Lean theorems about the translated code prove that a certificate it accepts implies the reported status.
What you trust
Every run says in a comment line which check decided the result.
| Mode | What decides the result | What you trust |
|---|---|---|
--check compileddefault | The Lean checker, compiled to a native program | The Lean compiler and runtime |
--check kernelopt-in | The Lean kernel, which replays the check itself (for now on single-file inputs with premises only) | The Lean kernel |
--check nonenever the default | Nothing: the run is labelled unchecked | The search itself |
What it handles
- Input
- TPTP CNF and FOF problems, with or without equality, including conjectures, include directives and distinct objects
- Answers
- Theorem or Unsatisfiable from checked refutations; Satisfiable or CounterSatisfiable from checked finite models
- Output
- The SZS status, and the refutation or the model in TSTP format
- Not yet
- Typed and higher-order input (TFF, THF) and arithmetic are rejected
- Release
- v0.3.0-alpha.1, November 2026, under the BSD-3-Clause license
Figure 1Fang at work
- Search 0/15
- Lean check 0/27
- SZS status Theorem
The problem
Nine premises about who lives in Dreadbury Mansion and who hates whom, and one conjecture: Agatha killed herself.
- fn14
skf0 = agatha ∨ skf0 = butler ∨ skf0 = charles - fn15
hates(skf0, agatha) - fn16
X0 = butler ∨ ¬hates(charles, X0) - fn17
richer(skf1(butler), agatha) - fn18
hates(butler, X0) ∨ X0 = butler - fn19
¬killed(skf1(butler), agatha) - fn20
skf0 = butler ∨ skf0 = charles ∨ ¬killed(skf0, agatha) - fn21
skf0 = butler ∨ skf0 = charles - fn22
skf1(butler) = butler - fn23
¬killed(butler, agatha) - fn24
skf0 = charles ∨ ¬killed(skf0, agatha) - fn25
skf0 = charles - fn26
X0 = butler ∨ ¬hates(skf0, X0) - fn27
agatha = butler - fn28
⊥
skf0 the killer, introduced for "someone killed Agatha". skf1(X) someone X does not hate.
The problem and the proof as text
Problem PUZ001+1, TPTP v10.0.0
- Someone who lives in Dreadbury Mansion killed Aunt Agatha.
- Agatha, the butler, and Charles live in Dreadbury Mansion, and are the only people who live therein.
- A killer always hates his victim, and is never richer than his victim.
- Charles hates no one that Aunt Agatha hates.
- Agatha hates everyone except the butler.
- The butler hates everyone not richer than Aunt Agatha.
- The butler hates everyone Aunt Agatha hates.
- No one hates everyone.
- Agatha is not the butler.
- Therefore : Agatha killed herself.
Proof
- fn2
lives(skf0)axiom pel55_1 - fn3
killed(skf0, agatha)axiom pel55_1 - fn4
¬lives(X0) ∨ X0 = agatha ∨ X0 = butler ∨ X0 = charlesaxiom pel55_3 - fn5
¬killed(X0, X1) ∨ hates(X0, X1)axiom pel55_4 - fn6
¬killed(X0, X1) ∨ ¬richer(X0, X1)axiom pel55_5 - fn7
¬hates(agatha, X0) ∨ ¬hates(charles, X0)axiom pel55_6 - fn8
X0 = butler ∨ hates(agatha, X0)axiom pel55_7 - fn9
richer(X0, agatha) ∨ hates(butler, X0)axiom pel55_8 - fn10
¬hates(agatha, X0) ∨ hates(butler, X0)axiom pel55_9 - fn11
¬hates(X0, skf1(X0))axiom pel55_10 - fn12
agatha ≠ butleraxiom pel55_11 - fn13
¬killed(agatha, agatha)negated conjecture - fn14
skf0 = agatha ∨ skf0 = butler ∨ skf0 = charlesfang_resolution fn4, fn2 - fn15
hates(skf0, agatha)fang_resolution fn5, fn3 - fn16
X0 = butler ∨ ¬hates(charles, X0)fang_resolution fn8, fn7 - fn17
richer(skf1(butler), agatha)fang_resolution fn9, fn11 - fn18
hates(butler, X0) ∨ X0 = butlerfang_resolution fn10, fn8 - fn19
¬killed(skf1(butler), agatha)fang_resolution fn17, fn6 - fn20
skf0 = butler ∨ skf0 = charles ∨ ¬killed(skf0, agatha)fang_paramodulation fn14, fn13 - fn21
skf0 = butler ∨ skf0 = charlesfang_resolution fn20, fn3 - fn22
skf1(butler) = butlerfang_resolution fn18, fn11 - fn23
¬killed(butler, agatha)fang_paramodulation fn22, fn19 - fn24
skf0 = charles ∨ ¬killed(skf0, agatha)fang_paramodulation fn21, fn23 - fn25
skf0 = charlesfang_resolution fn24, fn3 - fn26
X0 = butler ∨ ¬hates(skf0, X0)fang_paramodulation fn25, fn16 - fn27
agatha = butlerfang_resolution fn26, fn15 - fn28
⊥fang_resolution fn27, fn12
$ fang --output tstp PUZ001+1.p% SZS status Theorem for PUZ001+1% fang: checked by the compiled Lean checker (default mode; compiler and runtime trusted)
Fang v0.3.0-alpha.1. PUZ001+1.p from TPTP v10.0.0 with its % comment lines removed; the formulas are byte-identical. The release prints no TSTP for a conjecture file that contains a double quote, and the header comment has one.
Figure 2How Fang checks a result
Swipe the diagram sideways, or walk through it step by step.