Optionaloptions: TLogicEngineOptionsRegisters a propositional variable for use across all premises.
The variable entity to register.
The registered variable (with checksum) and changeset.
Adds a premise-bound variable that references another argument's conclusion premise.
Adds a premise-bound variable that references a premise in a different argument.
Registers a premise-bound propositional variable whose truth value is derived from another premise's evaluation.
The premise-bound variable entity to register.
The registered variable (with checksum) and changeset.
ProtectedbuildProtectedcanOverride point for subclasses to restrict cross-argument bindings.
When this returns false, bindVariableToExternalPremise will throw.
Override point for subclasses to prevent forking. When this returns
false, forkArgument will throw.
Returns the meta checksum — derived from entity data only.
Enumerates all 2^n variable assignments and checks for counterexamples.
A counterexample is an admissible assignment where all supporting premises are true but the conclusion is false. The argument is valid if no counterexamples exist.
Calls validateEvaluability() (including derivation pre-flight)
before enumeration. If the argument is not evaluable, returns early
with an appropriate result rather than throwing.
Optionaloptions: TCoreValidityCheckOptionsOptional limits on variables/assignments checked and early termination mode.
The validity check result including any counterexamples.
Clears the conclusion designation.
The updated role state and changeset.
Collects all variables referenced by expressions across all premises, indexed both by variable ID and by symbol.
An object with variableIds, byId, and bySymbol indexes.
Returns the combined checksum — hash(checksum + descendantChecksum), or equals checksum if no descendants.
Creates a new premise with an auto-generated UUID and registers it with this engine.
Two call styles are supported:
Typed-bag (preferred, since 0.11.0):
engine.createPremise({
type: "freeform", // or "derivation"
derivedClaimId: claimId, // required when type === "derivation"
extras: { label: "P1" },
symbol: "P1",
})
Legacy positional (kept for compatibility):
engine.createPremise(extras, symbol) // creates a freeform premise
When type === "derivation", the engine looks up derivedClaimId in
the claim library, materializes a claim-bound variable for it (via
ensureClaimBoundVariable) if one does not already exist, and
initializes the premise's expression tree to the naked-Q form — a
single variable expression at the root referencing the consequent.
The newly created PremiseEngine instance and changeset.
Optionalsymbol: stringCreates a premise with a caller-supplied ID and registers it with
this engine. Mirrors createPremise exactly, but accepts an explicit
id as the first argument instead of generating one.
Two call styles are supported:
Typed-bag (preferred, since 0.11.0):
engine.createPremiseWithId(id, {
type: "freeform", // or "derivation"
derivedClaimId: claimId, // required when type === "derivation"
extras: { label: "P1" },
symbol: "P1",
})
Legacy positional (kept for compatibility):
engine.createPremiseWithId(id, extras, symbol) // creates a freeform premise
When type === "derivation", the same derivation initialization as
createPremise runs: variable materialization and naked-Q tree setup.
The ID to assign to the new premise.
Optionalextras: Record<string, unknown>Optionalsymbol: stringReturns the descendant checksum — derived from children's combinedChecksums. Null if no children.
Ensures a claim-bound variable for the given claim exists in this argument. If one already exists, returns it. Otherwise creates a new claim-bound variable with a fresh UUID, the current version of the claim from the ClaimLibrary, and an auto-generated symbol.
Evaluates the argument under a three-valued expression assignment.
Variables may be true, false, or null (unknown). All result
flags (isAdmissibleAssignment, isCounterexample, etc.) are
three-valued: null means indeterminate due to unknown variable
values.
Calls validateEvaluability() internally before evaluation; if the
argument is not structurally ready (including derivation pre-flight),
the method returns early with { ok: false } and the validation
details. Do not bypass evaluate to avoid this check.
The variable assignment and optional rejected expression IDs.
Optionaloptions: TCoreArgumentEvaluationOptionsOptional evaluation options.
The evaluation result, or { ok: false } with validation
details if the argument is not structurally evaluable.
Returns the PremiseEngine containing the given expression, or
undefined.
The expression ID to search for.
The owning PremiseEngine, or undefined.
Forces recomputation of all dirty checksums in the hierarchy.
Returns all expressions across all premises, sorted by ID.
An array of expression entities.
Returns a shallow copy of the argument metadata with checksum attached.
The argument entity.
Returns the checksum for a named descendant collection. Null if collection is empty.
Returns the conclusion premise, or undefined if none is set.
The conclusion PremiseEngine, or undefined.
Returns an expression by ID from any premise, or undefined if not
found.
The expression ID to look up.
The expression entity, or undefined.
Returns the premise ID that contains the given expression, or
undefined.
The expression ID to look up.
The owning premise ID, or undefined.
Returns all expressions that reference the given variable ID, across all premises.
The variable ID to search for.
An array of referencing expression entities.
Returns the argument's extra metadata record (all fields except id, version, and checksums).
The extras record.
Returns the premise with the given ID, or undefined if not found.
The ID of the premise to retrieve.
The PremiseEngine instance, or undefined.
Returns the current role assignments (conclusion premise ID only; supporting is derived).
The current argument role state.
Returns the current reactive snapshot for external store consumption.
The reactive snapshot.
Returns the variable with the given ID, or undefined if not found.
The variable ID to look up.
The variable entity, or undefined.
Returns the variable with the given symbol, or undefined if not
found.
The symbol string to look up.
The variable entity, or undefined.
Returns all premise-bound variables whose boundPremiseId matches the
given premise ID. This is a linear scan over all variables.
The premise ID to filter by.
An array of variables bound to the given premise.
Returns true if an expression with the given ID exists in any
premise.
The expression ID to check.
Whether the expression exists.
Returns true if a premise with the given ID exists.
The ID to check.
Whether the premise exists.
Returns true if a variable with the given ID exists.
The variable ID to check.
Whether the variable exists.
Returns all premise IDs in lexicographic order.
An array of premise ID strings.
Returns all premises in lexicographic ID order.
An array of PremiseEngine instances.
Returns the root expression from each premise that has one.
An array of root expression entities.
Returns all supporting premises (derived: inference premises that are not the conclusion) in lexicographic ID order.
An array of supporting PremiseEngine instances.
Normalizes expression trees across all premises. Collapses unjustified
formulas, operators with 0/1 children, and inserts formula buffers where
needed. Works regardless of autoNormalize setting.
ProtectednotifyRemoves a variable and cascade-deletes all expressions referencing it across every premise (including subtrees and operator collapse).
The ID of the variable to remove.
The removed variable, or undefined if not found.
Restores the engine to a previously captured snapshot state.
The snapshot to restore from.
Designates a premise as the argument's conclusion.
The ID of the premise to designate.
The updated role state and changeset.
Replaces the argument's extra metadata record.
The new extras record.
The new extras record and a changeset with the modified argument.
Returns a serializable snapshot of the full engine state.
The engine snapshot.
Registers a listener that is called after every mutation.
The callback to invoke on mutation.
An unsubscribe function that removes the listener.
Renders the entity as a human-readable string.
A human-readable display string.
Shallow-merges updates into the argument's existing extras.
Key-value pairs to merge into the current extras.
The merged extras record and a changeset with the modified argument.
Updates fields on an existing variable. Since all premises share the same VariableManager, the update is immediately visible everywhere.
The ID of the variable to update.
Fields to update. For claim-bound variables: symbol,
claimId, claimVersion. For premise-bound variables: symbol,
boundPremiseId, boundArgumentId, boundArgumentVersion.
claimId and claimVersion must be provided together on claim-bound variables.
The updated variable, or undefined if not found.
Run a comprehensive invariant validation sweep on the entire argument. Checks schema conformance, structural invariants, grammar rules, reference integrity, and checksum consistency.
Returns the derivation-specific subset of validateEvaluability checks.
Apps can pre-check derivation premise structures before invoking the full
evaluation pipeline.
Validates that this argument is structurally ready for evaluation: a conclusion must be set, all role references must point to existing premises, variable ID/symbol mappings must be consistent, every premise must be individually evaluable, and all derivation premise structures must be well-formed (naked-Q invariant; since 0.11.0).
Derivation premises with structurally broken trees are flagged with
DERIVATION_STRUCTURE_INVALID_AT_EVALUATION. Use
validateDerivationStructures() to isolate derivation checks without
running the full evaluability sweep.
A validation result with any issues found.
ProtectedwithStaticfromCreates a new ArgumentEngine from flat arrays of entities, as typically
stored in a relational database. Expressions are grouped by their
premiseId field and loaded in BFS order (roots first, then children
of already-added nodes) to satisfy parent-existence requirements.
Optionalconfig: TLogicEngineOptionsOptionalgrammarConfig: TGrammarConfigOptionalchecksumVerification: "ignore" | "strict"StaticfromCreates a new ArgumentEngine from a previously captured snapshot.
OptionalgrammarConfig: TGrammarConfigOptionalchecksumVerification: "ignore" | "strict"OptionalgenerateId: () => string
Manages a propositional logic argument composed of premises, variable assignments, and logical roles (supporting premises and a conclusion).
Provides premise CRUD, role management, evaluation of individual assignments, and exhaustive validity checking via truth-table enumeration.