3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-05-16 07:05:35 +00:00
z3/src/cmd_context
Copilot 36fffb3a2f
TPTP frontend: fix TFF numeric atom typing, decimal literals, and $uminus (#9518)
This PR targets the main TFF frontend parsing failures: bare numeric
atoms were being treated as uninterpreted terms (`U`) in formula
position, decimal literals were not parsed, and `$uminus` was not
recognized as an arithmetic builtin. These issues caused widespread
parse/type failures in arithmetic-heavy TPTP inputs.

- **Numeric atom parsing in formulas (TFF)**
- Added a shared numeric-literal parser path for term/formula contexts.
- In atomic formulas, numeric LHS now parses as arithmetic numerals
before `=`/`!=` handling, avoiding `U` vs `Int/Real` mismatches.

- **Decimal literal support**
- Extended numeral parsing to accept `d.d` forms and construct `Real`
numerals.
- Keeps existing integer (`d`) and rational (`d/d`) behavior on the same
code path.

- **`$uminus` builtin support**
  - Added explicit handling for `$uminus(<arg>)` in term parsing.
- Enforces arity 1 and arithmetic-argument checks; maps directly to
arithmetic unary minus.

- **Focused regression coverage**
  - Added/updated TPTP unit cases for:
    - bare integer inequality: `31 != 12`
    - decimal arithmetic literal usage
    - `$uminus` in arithmetic predicates

Example of now-supported inputs:

```tptp
tff(c1,conjecture, 31 != 12).
tff(c2,conjecture, ~ $less(-3.25,-8.69)).
tff(c3,conjecture, $less($uminus(2),0)).
```

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
2026-05-13 06:03:53 -04:00
..
extra_cmds Standardize for-loop increments to prefix form (++i) (#8199) 2026-02-18 20:57:29 -08:00
basic_cmds.cpp Revert "Refactor find_psort_decl() to return std::optional<psort_decl*> (#8339)" 2026-02-18 20:57:56 -08:00
basic_cmds.h booyah 2020-07-04 15:56:30 -07:00
CMakeLists.txt Integrate TPTP with internal APIs via cmd_context, add embedded-string TPTP regression tests, and fix TFF arithmetic/timeout regressions (#9483) 2026-05-12 19:29:58 -04:00
cmd_context.cpp Revert "Refactor find_psort_decl() to return std::optional<psort_decl*> (#8339)" 2026-02-18 20:57:56 -08:00
cmd_context.h Remove redundant default constructors when they're the only constructor (#8461) 2026-02-18 20:58:01 -08:00
cmd_context_to_goal.cpp fix #5300 2021-05-28 14:16:43 -07:00
cmd_context_to_goal.h booyah 2020-07-04 15:56:30 -07:00
cmd_util.cpp make include paths uniformly use path relative to src. #534 2017-07-31 13:24:11 -07:00
cmd_util.h booyah 2020-07-04 15:56:30 -07:00
echo_tactic.cpp mux 2019-06-05 09:06:17 +01:00
echo_tactic.h add missing tactic descriptions, add rewrite for tamagochi 2023-01-08 13:32:26 -08:00
eval_cmd.cpp remove theory_str and classes that are only used by it 2025-08-07 21:05:12 -07:00
eval_cmd.h booyah 2020-07-04 15:56:30 -07:00
parametric_cmd.cpp fix a couple hundred deref-after-free bugs due to .c_str() on a temporary string 2020-07-11 20:24:45 +01:00
parametric_cmd.h fix #6023 2022-05-08 12:03:13 -07:00
pdecl.cpp Standardize for-loop increments to prefix form (++i) (#8199) 2026-02-18 20:57:29 -08:00
pdecl.h Standardize for-loop increments to prefix form (++i) (#8199) 2026-02-18 20:57:29 -08:00
README remove hassel table from unstable: does not compile under other plantforms 2013-05-31 17:48:19 -07:00
simplifier_cmds.cpp Standardize for-loop increments to prefix form (++i) (#8199) 2026-02-18 20:57:29 -08:00
simplifier_cmds.h Add simplification customization for SMTLIB2 2023-01-30 22:38:51 -08:00
simplify_cmd.cpp remove theory_str and classes that are only used by it 2025-08-07 21:05:12 -07:00
simplify_cmd.h booyah 2020-07-04 15:56:30 -07:00
tactic_cmds.cpp Revert "Refactor find_tactic_cmd to use std::optional<tactic_cmd*> (#8331)" 2026-02-18 20:57:56 -08:00
tactic_cmds.h remove default destructors 2024-10-02 22:20:12 +01:00
tactic_manager.cpp Revert "Refactor find_tactic_cmd to use std::optional<tactic_cmd*> (#8331)" 2026-02-18 20:57:56 -08:00
tactic_manager.h Revert "Refactor find_tactic_cmd to use std::optional<tactic_cmd*> (#8331)" 2026-02-18 20:57:56 -08:00
tptp_frontend.cpp TPTP frontend: fix TFF numeric atom typing, decimal literals, and $uminus (#9518) 2026-05-13 06:03:53 -04:00
tptp_frontend.h Integrate TPTP with internal APIs via cmd_context, add embedded-string TPTP regression tests, and fix TFF arithmetic/timeout regressions (#9483) 2026-05-12 19:29:58 -04:00

Command context provides the infrastructure for executing commands in front-ends such as SMT-LIB 2.0.
It is also provides the solver abstraction to plugin solvers in this kind of front-end.