Skip to main content

ProofTerm

Struct ProofTerm 

Source
pub struct ProofTerm;
Expand description

Proof term utilities.

Implementations§

Source§

impl ProofTerm

Source

pub fn is_proof(term: &Expr, prop: &Expr) -> bool

Check if an expression is a proof of a proposition.

In CiC, propositions are types in Prop. A proof is a term inhabiting such a type. Without a type checker available, we use structural heuristics.

Source

pub fn could_be_prop(ty: &Expr) -> bool

Check if a type expression could be a proposition (in Sort 0).

A type is a Prop if its universe is Sort 0.

Source

pub fn is_sort_zero(ty: &Expr) -> bool

Check if a type is definitely Prop (Sort 0).

Source

pub fn get_proposition(term: &Expr) -> Option<Expr>

Extract the proposition from a proof term’s type annotation.

If the term is (t : P) where P is a Prop, returns P.

Source

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

Check if a proof uses only constructive axioms.

A proof is constructive if it doesn’t depend on:

  • Classical.choice
  • Classical.em (excluded middle)
  • propext (propositional extensionality, though debatable)
Source

pub fn collect_constants(term: &Expr) -> HashSet<Name>

Collect all constant names used in a term.

Source

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

Count the size (number of nodes) of a proof term.

Source

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

Compute the depth of a proof term.

Source

pub fn same_proposition_structure(p1: &Expr, p2: &Expr) -> bool

Check if two proofs are of the same proposition structure.

When proof irrelevance is enabled, this can be used to determine if two proofs should be considered equal.

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.