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

  1. 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.

  2. 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.

  3. 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.

ModeWhat decides the resultWhat you trust
--check compileddefaultThe Lean checker, compiled to a native programThe Lean compiler and runtime
--check kernelopt-inThe Lean kernel, which replays the check itself (for now on single-file inputs with premises only)The Lean kernel
--check nonenever the defaultNothing: the run is labelled uncheckedThe 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

  1. Search 0/15
  2. Lean check 0/27
  3. SZS status Theorem
23456789101112131415161718192021222324252627⊥

The problem

Nine premises about who lives in Dreadbury Mansion and who hates whom, and one conjecture: Agatha killed herself.

  1. fn14skf0 = agatha ∨ skf0 = butler ∨ skf0 = charles
  2. fn15hates(skf0, agatha)
  3. fn16X0 = butler ∨ ¬hates(charles, X0)
  4. fn17richer(skf1(butler), agatha)
  5. fn18hates(butler, X0) ∨ X0 = butler
  6. fn19¬killed(skf1(butler), agatha)
  7. fn20skf0 = butler ∨ skf0 = charles ∨ ¬killed(skf0, agatha)
  8. fn21skf0 = butler ∨ skf0 = charles
  9. fn22skf1(butler) = butler
  10. fn23¬killed(butler, agatha)
  11. fn24skf0 = charles ∨ ¬killed(skf0, agatha)
  12. fn25skf0 = charles
  13. fn26X0 = butler ∨ ¬hates(skf0, X0)
  14. fn27agatha = butler
  15. fn28⊥

skf0 the killer, introduced for "someone killed Agatha". skf1(X) someone X does not hate.

Figure 1. Who killed Aunt Agatha? A refutation of TPTP problem PUZ001+1 (Pelletier 55) found by Fang in 0.49 s and accepted by its compiled Lean 4 checker before Fang reported Theorem. Fang negates the conjecture "Agatha killed herself", turns premises into clauses, and derives the empty clause ⊥ by resolution and paramodulation. Point at a node to read its clause.
The problem and the proof as text

Problem PUZ001+1, TPTP v10.0.0

  1. Someone who lives in Dreadbury Mansion killed Aunt Agatha.
  2. Agatha, the butler, and Charles live in Dreadbury Mansion, and are the only people who live therein.
  3. A killer always hates his victim, and is never richer than his victim.
  4. Charles hates no one that Aunt Agatha hates.
  5. Agatha hates everyone except the butler.
  6. The butler hates everyone not richer than Aunt Agatha.
  7. The butler hates everyone Aunt Agatha hates.
  8. No one hates everyone.
  9. Agatha is not the butler.
  10. Therefore : Agatha killed herself.

Proof

  1. fn2lives(skf0)axiom pel55_1
  2. fn3killed(skf0, agatha)axiom pel55_1
  3. fn4¬lives(X0) ∨ X0 = agatha ∨ X0 = butler ∨ X0 = charlesaxiom pel55_3
  4. fn5¬killed(X0, X1) ∨ hates(X0, X1)axiom pel55_4
  5. fn6¬killed(X0, X1) ∨ ¬richer(X0, X1)axiom pel55_5
  6. fn7¬hates(agatha, X0) ∨ ¬hates(charles, X0)axiom pel55_6
  7. fn8X0 = butler ∨ hates(agatha, X0)axiom pel55_7
  8. fn9richer(X0, agatha) ∨ hates(butler, X0)axiom pel55_8
  9. fn10¬hates(agatha, X0) ∨ hates(butler, X0)axiom pel55_9
  10. fn11¬hates(X0, skf1(X0))axiom pel55_10
  11. fn12agatha ≠ butleraxiom pel55_11
  12. fn13¬killed(agatha, agatha)negated conjecture
  13. fn14skf0 = agatha ∨ skf0 = butler ∨ skf0 = charlesfang_resolution fn4, fn2
  14. fn15hates(skf0, agatha)fang_resolution fn5, fn3
  15. fn16X0 = butler ∨ ¬hates(charles, X0)fang_resolution fn8, fn7
  16. fn17richer(skf1(butler), agatha)fang_resolution fn9, fn11
  17. fn18hates(butler, X0) ∨ X0 = butlerfang_resolution fn10, fn8
  18. fn19¬killed(skf1(butler), agatha)fang_resolution fn17, fn6
  19. fn20skf0 = butler ∨ skf0 = charles ∨ ¬killed(skf0, agatha)fang_paramodulation fn14, fn13
  20. fn21skf0 = butler ∨ skf0 = charlesfang_resolution fn20, fn3
  21. fn22skf1(butler) = butlerfang_resolution fn18, fn11
  22. fn23¬killed(butler, agatha)fang_paramodulation fn22, fn19
  23. fn24skf0 = charles ∨ ¬killed(skf0, agatha)fang_paramodulation fn21, fn23
  24. fn25skf0 = charlesfang_resolution fn24, fn3
  25. fn26X0 = butler ∨ ¬hates(skf0, X0)fang_paramodulation fn25, fn16
  26. fn27agatha = butlerfang_resolution fn26, fn15
  27. 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

Once, offline · output committed to the repositoryFang's Rustpreprocessing cratesCharonLLBCCharon IRAeneasLean definitionsgenerated, committedLean theoremsaccepted ⇒ status holdsproved aboutcompileNative checkerfang-v8-check · Lean 4.35.0Every runTPTP problemCNF or FOFSearchRustcertificateLean kernel replay--check kernel · Lean kernel trustedNative checker · default--check compiled · compiler, runtime trustedNo check--check none · result uncheckedSZS statusTheorem, Unsat., …

Swipe the diagram sideways, or walk through it step by step.

Figure 2. Once, offline: Charon and Aeneas translate Fang's Rust preprocessing into Lean definitions, which are committed to the repository. Lean theorems about those definitions prove that an accepted certificate implies the reported status, and the Lean 4.35.0 compiler turns the checker into a native program. On every run, the Rust search writes a certificate and the check layer decides what confirms it before the SZS status is reported. The kernel layer currently covers single-file inputs whose formulas are all axioms.

fang · how a result gets checked

Step 1 of 9

A problem comes in

Fang reads a problem written in TPTP, the standard format for first-order logic: some premises and, often, a conjecture to prove.

Once, offline · output committed to the repositoryFang's Rustpreprocessing cratesCharonLLBCCharon IRAeneasLean definitionsgenerated, committedLean theoremsaccepted ⇒ status holdsproved aboutcompileNative checkerfang-v8-check · Lean 4.35.0Every runTPTP problemCNF or FOFSearchRustcertificateLean kernel replay--check kernel · Lean kernel trustedNative checker · default--check compiled · compiler, runtime trustedNo check--check none · result uncheckedSZS statusTheorem, Unsat., …
1 / 9

© 2026 Pietro Pellegrino · P.IVA 04970330611

Set in Source Serif 4 and JetBrains Mono · Privacy Policy