pub struct SimpSet { /* private fields */ }Expand description
An indexed set of simp rules.
Implementations§
Source§impl SimpSet
impl SimpSet
pub fn new() -> Self
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn register_context_lemmas(&mut self, ctx: &Context) -> usize
pub fn register_context_lemmas(&mut self, ctx: &Context) -> usize
Compile every @[simp] lemma REGISTERED in a kernel context into this rule set.
Context::simp_rules is the one door a simplifier consults — @[simp], a local simp inside a section, and an equational auto hint all arrive through it — and it
holds its rules as kernel Terms. The proof layer rewrites ProofExprs, so each rule
is lowered back into the shape SimpSet::register_lemma orients:
Π(x̄). Eq A lhs rhs becomes ∀x̄. lhs = rhs.
Registration makes a lemma a RULE; it does not make it true. The compiled rule’s
derivation base is a PremiseMatch on the lemma, so a rewrite fires into a certificate
only where the lemma is also in scope — as a premise, a hypothesis, or a declaration the
certifier can find. That separation is deliberate: a @[simp] attribute is an
instruction to the simplifier, never an assumption.
Returns how many rules were added. A registry rule that does not lower is one whose
terms are outside the proof layer’s first-order fragment (a Π, a Match, a Lambda
inside the pattern), not one the registry let through: the shapes that would make a
rewriter WRONG — a bare-variable left-hand side, an undetermined right-hand-side
variable, a self-rewrite — are already refused, loudly and by name, at the door.
Sourcepub fn register_lemma(&mut self, name: &str, lemma: &ProofExpr) -> bool
pub fn register_lemma(&mut self, name: &str, lemma: &ProofExpr) -> bool
Compile and index lemma as a rewrite rule. Returns false (and
registers nothing) if the lemma is not an oriented rule: no equational
or iff core, a bare-variable lhs, rhs/condition variables the lhs does
not bind, or shadowed binder names.
The rule’s derivation base is a PremiseMatch leaf, so the lemma must
be in scope (a premise or hypothesis) wherever the rule fires.