jacopy.Definition¶
- class jacopy.Definition¶
Bases:
ABCA single rewrite rule keyed to a local pattern.
Subclasses provide
matches()(doesexprfit the left-hand side?) andrewrite()(produce the right-hand side). Thenameis used verbatim in theProofSteprule field.A definition is classified as an axiom by default, the engine tags its
ProofStepwithprovenance_tag="axiom". A subclass that represents a theorem overridestheorem_proof_builder()to return a callable producing the sub-proof; in foundational mode the engine then attaches that sub-proof under the step as children. Efficient mode still tags the step"theorem"but skips sub-proof construction, so the same definition serves both proof modes.- __init__()¶
Methods
__init__()matches(expr)True when
expris an instance of this definition's LHS.rewrite(expr)Return the RHS.
Return a callable producing this definition's sub-proof, or
None.Attributes
the Expr class (or tuple of classes) this definition's LHS is rooted at.
Structural IDENTITY of the rule:
Noneby default — the rule is never deduplicated by identity and itskeyfalls back to(class name, display name).True when this definition carries a sub-proof builder.
identitywhen given, else(class name, display name).namethe algebroid of a declared axiom, the theorem's owner for a cited theorem, …
Nonefor structure-free rules."definition"— a definitional unfolding or a structural law (no assumption);"assumption"— a DECLARED axiom of a structure (the*Declarationrules), i.e. a hypothesis the proof depends on;"theorem"— a cited proven result.a
jacopy.bibliography.Citation— or a tuple of them — built withjacopy.bibliography.cite(), e.g.cite("Uchino2002", "Section 1, axiom [C5]").Explicitly-unverified citation (a TheoremBook record marked
unverified): its steps are classified as legacy assumptions.- anchor = None¶
the Expr class (or tuple of classes) this definition’s LHS is rooted at. When set, the engine only consults the rule on nodes of that type (via an MRO-indexed lookup) instead of trying every rule at every node.
Nonekeeps the rule in the always-consulted fallback list.- Type:
Optional dispatch anchor
- owner = None¶
the algebroid of a declared axiom, the theorem’s owner for a cited theorem, …
Nonefor structure-free rules. The engine refuses two rules whose owners share a tree-visible name but differ (jacopy.proof.ownership).- Type:
The structure this rule was built for
- role = 'definition'¶
"definition"— a definitional unfolding or a structural law (no assumption);"assumption"— a DECLARED axiom of a structure (the*Declarationrules), i.e. a hypothesis the proof depends on;"theorem"— a cited proven result.ProofResult.from_chainreads it from the fired steps; a step whose rule recorded no role is kept as a LEGACY assumption, never dropped.- Type:
What the rule IS, logically
- unverified = False¶
Explicitly-unverified citation (a TheoremBook record marked
unverified): its steps are classified as legacy assumptions.
- identity = None¶
Structural IDENTITY of the rule:
Noneby default — the rule is never deduplicated by identity and itskeyfalls back to(class name, display name). A rule that gives one returns(class, structure identity, mathematical parameters): two rules with equal identity are the same rule (an explicit assumption instance, a declared axiom of a structure with its parameters …).
- source = None¶
a
jacopy.bibliography.Citation— or a tuple of them — built withjacopy.bibliography.cite(), e.g.cite("Uchino2002", "Section 1, axiom [C5]"). The engine copies it onto everyProofStepthe rule produces and the display layer prints it; no matching, rewriting or classification reads it.None: the rule names no source.- Type:
Literature source of the rule (metadata only)
- property key¶
identitywhen given, else(class name, display name). Recorded on every firedProofStepand on the resulting requirement records, so a citation can check that the SAME licensing rule is registered in the citing engine.- Type:
The rule’s structural key
- abstractmethod matches(expr)¶
True when
expris an instance of this definition’s LHS.
- abstractmethod rewrite(expr)¶
Return the RHS. Caller guarantees
matches(expr)is True.
- theorem_proof_builder()¶
Return a callable producing this definition’s sub-proof, or
None.The returned callable has signature
(matched_expr: Expr) -> ProofChainand is only invoked by the engine whenmode="foundational".None(the default) marks the definition as a pure axiom.