Skip to content

Eliminate hacky UnitInputTypes - #1057

Merged
quickbeam123 merged 5 commits into
masterfrom
martin-input-type-cleanup-2
Nov 11, 2026
Merged

quickbeam123 merged 5 commits into
masterfrom
martin-input-type-cleanup-2

Conversation

@quickbeam123

Copy link
Copy Markdown
Collaborator

CLAIM, MODEL_DEFINITION, and EXTENSIONALITY_AXIOM are eliminated from UnitInputType while preserving most of the functionality:

  • CLAIM is treated as before, only spelled out "axiom" in proof output
  • model_checking mode also learns about the model formulas but not through the UnitInputType but a map kept in the TPTP parser
  • extensionality resolution still works, but we drop the unused custom "extensionality tagging" feature

quickbeam123 and others added 3 commits November 11, 2026 10:40
The Vampire-only TPTP role "extensionality" gave a unit the input type
EXTENSIONALITY_AXIOM, which the Clause constructor turned into
_extensionalityTag (resetting the type to AXIOM). The tag was read only
under -er tagged, which no schedule or sampler uses, and nothing in
checks/ or UnitTests/ exercised it beyond printing the role.

It was also fragile: children do not inherit the tag, so any rewrite of
the clause before activation dropped it. And a fof formula with the
role looked like a goal to everything testing == AXIOM or
derivedFromGoal() until clausification (SInE seed, Property goal count),
and beat a real goal premise in the max of input types.

Remove the role from the TPTP parser (it is now a parse error), the
input type (MODEL_DEFINITION becomes 5), the -er value tagged (OFF
becomes 2), the Clause bit (donated to _numSelected, now 25 bits) and
the corresponding printing code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MODEL_DEFINITION was not a TPTP role but a marker for the section between
vampire(model_check,model_start) and vampire(model_check,model_end),
read only by FMB/ModelCheck. As an input type it caused trouble:

- Statistics::inputTypeCnts excluded it (sized toNumber(MODEL_DEFINITION)),
  but Statistics::reportUnit, called from every Unit constructor, indexes
  the array by the input type of each input unit. So every model
  definition unit wrote one StatPair past the end of the array, in every
  mode; UBSan does not see it through std::array::operator[].
- Outside --mode model_check, model units were the top of the max of
  input types and counted as derivedFromGoal(); in a debug build they
  tripped ASS_LE(type, CLAIM) in SaturationAlgorithm::addInputClause.

Now the TPTP parser records the model units in a side set, like it
records unit names, and ModelCheck asks TPTP::isModelDefinition(). Model
units get type AXIOM; their stated role is ignored as before.
modelCheckMode rejects --input_syntax smtlib2, since only the TPTP parser
records model units. Statistics counts input types up to CLAIM, and the
assertion in addInputClause, now vacuous, is removed.

Reproducer for the out-of-bounds write: any TPTP file containing
vampire(model_check,model_start). ... vampire(model_check,model_end).
For the assertion, the same file in the default mode with a debug build:
  script -q /dev/null ./vampire file.p

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CLAIM was set only by the Vampire-only TPTP role claim, and only for the
parser to know to call processClaimFormula. The claim machinery itself
(ConsequenceFinder, LiteralSelector, Ordering) reads the label flag of
the introduced predicate, never the input type. Being the top value of
the enum, CLAIM merely made claims count as derivedFromGoal() and come
first in ClauseQueue::tieLessThan and Normalisation::lessThan, while the
SMT-LIB assert-claim, documented as analogous, used ASSUMPTION.

The TPTP parser now records a claim in a flag, like a question, and
gives it the input type AXIOM. The SMT-LIB parser is unchanged; the
discrepancy between the two is left for later.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@MichaelRawson MichaelRawson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! This slowly reduces the insanity. :)

Comment thread Kernel/Inference.hpp
/** Used in parsing and preprocessing for extensionality clause tagging, should not appear in proof search */
EXTENSIONALITY_AXIOM = 5,
/** Used to separate model definitions in model_check mode, should not appear in proof search */
MODEL_DEFINITION = 6

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can now save a bit with the `_inputType : 3' bitfield later in the file.

@quickbeam123 quickbeam123 Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great pick!

(Induction depth will be happy ;))

@quickbeam123
quickbeam123 merged commit c934bbf into master Nov 11, 2026
1 check passed
@quickbeam123
quickbeam123 deleted the martin-input-type-cleanup-2 branch November 11, 2026 17:14
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.

2 participants