always output TFF in TPTP proofs - #884
Conversation
The proof output language was chosen with hasNonDefaultSorts(), which Problem recomputes from its current unit list. Preprocessing can remove the last unit mentioning a sort, and the property then reports an untyped problem while the proof still contains typed formulas. For the problems in vprover#730 the conjecture normalizes to ~$true, so the arithmetic disappears and the proof is printed as fof even though it contains $is_int. Type declarations are printed from the signature, which only grows, so the two could also disagree inside one proof, giving a tff type declaration followed by fof formulas. TFF subsumes FOF, so print tff unconditionally, or thf for higher-order problems, and drop the property test. TPTPPrinter already did this. Also annotate a quantified variable whose sort is not $i even when the property is false, to match Formula::toString.
cc068d0 to
f7b3617
Compare
MichaelRawson
left a comment
There was a problem hiding this comment.
Cool! I intend to merge after asking a few people about it.
| (t != AtomicSort::defaultSort() || env.getMainProblem()->hasNonDefaultSorts())){ | ||
| //a variable of a sort other than $i must always be annotated: relying on | ||
| //hasNonDefaultSorts alone loses the annotation when preprocessing removes | ||
| //the last unit mentioning that sort. Same predicate as Formula::toString. |
There was a problem hiding this comment.
In future we could consider just printing $i, it's not illegal any more because we never use fof.
This doesn't seem good: CI passes this test. What system are you using? |
I don't understand it either, I get the same error on main, I used Ubuntu latest version, now I'm not at the computer so can't see the exact version |
|
Uh-oh. Experience suggests that a compiler upgrade finally found a bug that was lurking - if you can, please try to debug the unit test. Otherwise I guess we'll let it play out. |
|
(but it's independent of this change of course, don't worry!) |
I will work on it today. |
|
@MichaelRawson success_3's expected clause was wrong (copy-pasted from success_2), and clang only hides it because it evaluates the two sides of the != in the opposite order to gcc, which makes the produced clause share a subterm with the expected one, and the test comparator returns true on identical subterms without checking that the variable renaming is consistent. |
|
I also like the fix, but I think the issue could also happen for I will open a separate PR with my proposed solution, so that we can discuss. |
I am very curious about your solution, I will look into it |
|
@mezpusz do you have any test idea that I could try to verify your claim about thf problems? trying something but I don't know how to check for all cases to be honest, so if you have better ideas to try to point to errors that I could not find |
|
I've checked it now with an "unsound" preprocessing step that just replaces all units with I pushed the changes for the alternative solution to |
Fixes #730, taking the approach @MichaelRawson suggested there.
InferenceStorechose betweenfofandtffusingProblem::hasNonDefaultSorts(). That property is recomputed from the current unit list (refreshPropertycallsProperty::scan(_units)), so it answers "do the units I am holding right now mention a non-$isort" rather than "does this proof need TFF". Preprocessing can delete the last unit mentioning a sort, and the property then reports an untyped problem while the proof still contains typed formulas.The eight problems listed in #730 hit this. The conjecture normalizes to
~$true, the arithmetic disappears, and the proof comes out as:Two related cases, both fixed here.
! [X: $int] : $is_int(X)gave anfofformula containing a typed quantifier:And because type declarations are printed from the signature, which only grows, while the language choice came from the units, which shrink, one proof could contain both languages.
checks/theory/let-tuple-bool.palready did this on master.What changed
getFofStringandProofCheckPrinter::printStepprinttff, orthffor higher-order problems, without consulting the property. TFF subsumes FOF, andShell/TPTPPrinter.cppalready printedtffunconditionally.getQuantifiedStrannotates a variable whose sort is not$iregardless of the property, which is the predicateFormula::toStringalready uses. That path only covers clause variables and I could not build a case where the old code misprinted, so treat it as consistency rather than part of the fix.-p on,-p smtcheckand-p smt2_proofcheckare untouched, and SAT steps from AVATAR still print ascnf.Testing
checks/sanitypasses, 68 checks, built against Z3 4.14.0.Inferences_HOL_Injectivityfails identically with and without this change on 3677326, so it is not from here.-p tptpoutput for all 32 problems underchecks/Problems,hol/hol1.p, the FOOL problems and three smtlib2 inputs, before and after. Every SZS status is unchanged. 36 outputs are byte identical, 16 differ only infof(becomingtff(, and 3 differ only in clause numbering, which the unpatched binary also does when run twice on those problems.checks/ucore/test2.outstill matches exactly.thf, and-p proofcheckis fixed the same way.check_no_foflines inchecks/sanityall fail without this change and pass with it.I do not have tptp4X to hand, so I have not checked the output against a strict TPTP parser. Worth noting Vampire's own parser accepts
fof(f1,conjecture,($is_int(6))), so reading proofs back through Vampire does not catch the old behaviour.