Safe Autoformalization: Sufficiency and Necessity with Entailment Graphs
Umut A. Acar, Eli Goldweber
cs.AI
Nov 23, 2026 · v1
cs.LO
TL;DR
All theorems about entailment-graph search, frontiers, and ambiguity residue are machine-checked in Lean 4 with Mathlib over an arbitrary Boolean algebra.
Abstract
Autoformalization translates a natural-language statement into a formula that captures its intent, which depends on the statement's context: the background that disambiguates it. LLMs make autoformalization practical, but their probabilistic output carries no formal guarantees. We propose techniques for safe autoformalization that certify one-sided logical adequacy: a formula sufficient for the intent is safe to enforce, and a formula necessary for it is safe to rely on. We use LLMs to generate candidate formulas and order them by logical strength in an Entailment Graph (EG), an ordering a solver decides. Each edge carries a residual and a co-residual, the two adjoints of the entailment order, all fixed by the candidate pool alone. In a context, two searches return the sufficient frontier, the weakest candidates that entail the statement, and the necessary frontier, the strongest candidates the statement entails; each step is one local check against an edge's residual or co-residual. The frontiers bracket the statement and yield the ambiguity residue, which holds exactly of the situations the candidates certify neither as satisfying nor as violating it; the statement is ambiguous precisely when the residue is satisfiable. For natural-language statements and contexts, an LLM entailment oracle decides the checks; it is sound if it accepts only checks that hold, and complete if it accepts every check that holds. We prove that a sound oracle makes the search safe regardless of pool quality, and that a complete one makes the frontiers tight. On security-critical AWS properties, EGs are safe in all 20 cases of an expert-adjudicated study, where majority vote over equivalence clusters and Universal Self-Consistency are unsafe in 25% and 10%. An ablation with the same oracle but no graph is unsafe in 25% and rejects every candidate in another 30%. We machine-checked our proofs in Lean.
Problem
LLM-based autoformalization produces multiple inequivalent candidate formulas with no guarantee of logical adequacy with respect to the intent of a natural-language statement in context.
Approach
Candidates are clustered by equivalence and ordered by entailment into an Entailment Graph decided by an SMT solver, with residuals and co-residuals on each edge. Downward and upward searches, driven by an LLM entailment oracle, return the weakest sufficient and strongest necessary candidates, and these frontiers define an ambiguity residue. Soundness and tightness theorems for the searches are mechanized in Lean 4 on Mathlib over an arbitrary Boolean algebra, with no sorry and only standard axioms.
Results
On 20 expert-adjudicated AWS security properties, Entailment Graphs were safe in all cases. Majority vote over equivalence clusters was unsafe in 25% of cases and Universal Self-Consistency in 10%. A graph-free ablation using the same oracle was unsafe in 25% and rejected every candidate in another 30%.
| Method | Unsafe |
|---|
| Entailment Graphs | 0% |
| Majority vote (equivalence clusters) | 25% |
| Universal Self-Consistency | 10% |
| Oracle without graph (ablation) | 25% (+30% reject all) |
Unsafe rate on 20 AWS properties