Skip to content

Replace failwith with R_unknown fallback in role_of_string#109

Open
Xujiangjing wants to merge 1 commit intosneeuwballen:masterfrom
Xujiangjing:fix-role-of-string
Open

Replace failwith with R_unknown fallback in role_of_string#109
Xujiangjing wants to merge 1 commit intosneeuwballen:masterfrom
Xujiangjing:fix-role-of-string

Conversation

@Xujiangjing
Copy link
Copy Markdown
Contributor

Fixes #108.

Change

Three small additions to role_of_string in src/parsers/ast_tptp.ml:

  1. Add corollaryR_axiom (TPTP BNF :== lists corollary as axiom-like; handled the same way as lemma)
  2. Add interpretation and logicR_plain (TPTP-standard roles for semantic / logic specification)
  3. Replace the failwith catch-all with a stderr warning + R_unknown fallback, so unrecognised roles no longer abort the prover

Before / after

Input: thf(test, <ROLE>, ($true)).

Role Before (master) After (this PR)
corollary Failure("not a proper TPTP role: corollary") (uncaught) ✅ accepted as axiom
interpretation Failure(...) (uncaught) ✅ accepted as plain
logic Failure(...) (uncaught) ✅ accepted as plain
garbage (invalid) Failure(...) (uncaught) R_unknown + stderr warning
All previously-accepted roles ✅ accepted ✅ accepted (no regression)

Alternative

If the maintainers prefer to keep the hard failure, I'm happy to adapt the PR accordingly.

- Add corollary (TPTP BNF :== lists it as axiom-like, handle as R_axiom)
- Add interpretation and logic (TPTP standard roles, handle as R_plain)
- Replace failwith catch-all with R_unknown + stderr warning

Previously, unrecognised TPTP roles caused an uncaught Failure exception
with no source location. E and Vampire both produce graceful parse errors
in the same situation. This change brings Zipperposition's error handling
in line with that of other ATPs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

role_of_string uses failwith for unrecognised TPTP roles — minor error-handling inconsistency

1 participant