mirror of
https://github.com/Z3Prover/z3
synced 2026-05-16 23:25:36 +00:00
TPTP frontend: enforce implicit universal quantification for free variables and add regression coverage (#9527)
Discussion #9524 reported systematic TPTP result polarity errors (notably `Unsatisfiable/Theorem` cases returned as `Satisfiable`) and timeout-path instability in the frontend. The dominant issue was semantic: free variables in FOF/CNF formulas were parsed as constants instead of implicitly universally quantified variables. - **Parser semantics: free variables now follow TPTP rules** - In `/home/runner/work/z3/z3/src/cmd_context/tptp_frontend.cpp`, free variables encountered while parsing an annotated formula are now collected in formula scope and wrapped with a top-level `forall`. - This applies to both term and atomic-formula paths, so variable occurrences are treated consistently. - Explicitly bound quantifier variables continue to take precedence over implicit ones. - **Scoped implementation cleanup** - Added scoped state for implicit-variable collection to avoid leaking parser state across formulas. - Kept variable binding order stable so quantifier construction is deterministic. - **Timeout-path robustness** - Updated frontend exception catches to `const&` in the TPTP stream entrypoint to make timeout/error handling behavior consistent with thrown exception forms. - **Regression tests** - Extended `/home/runner/work/z3/z3/src/test/tptp.cpp` with focused cases for: - FOF free-variable implicit universal quantification. - CNF free-variable implicit universal quantification. ```tptp cnf(c1,axiom, p(X)). cnf(c2,axiom, ~ p(a)). ``` This now maps to `forall X. p(X)` plus `~p(a)`, yielding `% SZS status Unsatisfiable` as expected. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
This commit is contained in:
parent
6b69c2c048
commit
ce07160d64
2 changed files with 59 additions and 2 deletions
|
|
@ -65,6 +65,14 @@ fof(c1,conjecture, mortal(socrates)).)",
|
|||
{"simple-sat",
|
||||
R"(fof(a1,axiom, p(a)).)",
|
||||
"% SZS status Satisfiable"},
|
||||
{"fof-implicit-forall",
|
||||
R"(fof(a1,axiom, p(X)).
|
||||
fof(c1,conjecture, p(a)).)",
|
||||
"% SZS status Theorem"},
|
||||
{"cnf-implicit-forall",
|
||||
R"(cnf(c1,axiom, p(X)).
|
||||
cnf(c2,axiom, ~ p(a)).)",
|
||||
"% SZS status Unsatisfiable"},
|
||||
{"tff-negative-literal",
|
||||
R"(tff(c1,conjecture, $less(-2,2)).)",
|
||||
"% SZS status Theorem"},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue