Skip to main content

ProofNormalizer

Struct ProofNormalizer 

Source
pub struct ProofNormalizer;
Expand description

A minimal proof normalizer that applies beta reduction to proof terms.

In the kernel, proof terms are normalised before definitional equality checks to avoid spurious inequality due to un-reduced redexes.

Implementations§

Source§

impl ProofNormalizer

Source

pub fn beta_reduce(term: &Expr) -> Expr

Beta-reduce a proof term to its normal form.

This is a simple structural pass that eliminates (fun x => body) arg redexes by substituting arg for bound variable 0 in body.

Source

pub fn subst_bvar(term: Expr, depth: u32, replacement: &Expr) -> Expr

Substitute replacement for bound variable depth in term.

This implements the standard capture-avoiding substitution for de Bruijn terms.

Source

pub fn count_redexes(term: &Expr) -> usize

Count the number of beta-redexes remaining in a term.

Source

pub fn is_beta_normal(term: &Expr) -> bool

Returns true if the term is already in beta-normal form (no redexes).

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.