Skip to main content

SimpSet

Struct SimpSet 

Source
pub struct SimpSet { /* private fields */ }
Expand description

An indexed set of simp rules.

Implementations§

Source§

impl SimpSet

Source

pub fn new() -> Self

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

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.

Source

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.

Trait Implementations§

Source§

impl Default for SimpSet

Source§

fn default() -> SimpSet

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.