Struct ProofTreeArray

Source
pub struct ProofTreeArray {
    pub trees: Vec<ProofTree>,
    pub qed: usize,
    /* private fields */
}
Expand description

An array of proof trees, used to collect steps of a proof in proof order

Fields§

§trees: Vec<ProofTree>

The list of proof trees

§qed: usize

The QED step

Implementations§

Source§

impl ProofTreeArray

Source

pub fn with_logical_steps<T>( &self, db: &Database, f: impl Fn(usize, usize, StatementRef<'_>, Vec<usize>) -> T, ) -> Vec<T>

Applies the provided function to each of the logical steps. It takes 4 parameters:

  • cur - the index of the step among all proof steps (incuding non-logical ones). This can be used as an index in ProofTreeArray’s expressions exprs and indents.
  • ix - the index of the step, when only logical steps are counted,
  • stmt - the statement applied at this step,
  • hyps - the indices of the hypotheses for this step (only counting logical hypotheses)
Source

pub fn with_steps<T>( &self, db: &Database, f: impl Fn(usize, StatementRef<'_>, &Vec<usize>) -> T, ) -> Vec<T>

Applies the provided function to each of the steps. It takes 3 parameters:

  • cur - the current index of the step,
  • stmt - the statement applied at this step,
  • hyps - the indices of the hypotheses for this step,
Source§

impl ProofTreeArray

Source

pub fn new(enable_exprs: bool) -> Self

Constructs a new empty ProofTreeArray. If enable_exprs is true, it will construct expressions for each step, used by Database::export_mmp_proof_tree.

Source

pub fn index(&self, tree: &ProofTree) -> Option<usize>

Get the index of a proof tree in the array

Source

pub fn indent(&self) -> &[u16]

Get the minimum distance from each step to the QED step

Source

pub fn calc_indent(&mut self)

Finds the shortest path from each node in the proof tree to the qed step, using Dijkstra’s algorithm. Based on the example in https://doc.rust-lang.org/std/collections/binary_heap/.

Source

pub fn count_parents(&self) -> Vec<usize>

Get the number of parents of each step in the proof

Source

pub fn to_rpn(&self, parents: &[usize], explicit: bool) -> Vec<RPNStep>

Write the proof as an RPN sequence with backrefs

Source

pub fn normal_iter(&self, explicit: bool) -> NormalIter<'_>

Produce an iterator over the steps in the proof in normal/uncompressed mode. (Because this can potentially be very long, we do not store the list and just stream it.)

Source

pub fn exprs(&self) -> Option<&[Vec<u8>]>

Returns the list of expressions corresponding to each proof tree.

Trait Implementations§

Source§

impl Clone for ProofTreeArray

Source§

fn clone(&self) -> ProofTreeArray

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ProofTreeArray

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ProofTreeArray

Source§

fn default() -> Self

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

impl ProofBuilder for ProofTreeArray

Source§

type Item = usize

The data type being generated
Source§

type Accum = Vec<usize>

The hyp gathering type
Source§

fn push(&mut self, hyps: &mut Vec<usize>, hyp: usize)

Add a new hyp to the accumulation type
Source§

fn build( &mut self, addr: StatementAddress, trees: Vec<usize>, pool: &[u8], expr: Range<usize>, ) -> usize

Create a proof data node from a statement, the data for the hypotheses, and the compressed constant string

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.