Struct DblTree

Source
pub struct DblTree<E, ProE, Sq>(pub OpenTree<ProE, DblNode<E, Sq>>);
Expand description

A double tree, or pasting diagram in a virtual double category.

The underlying data structure of a double tree is a open tree whose nodes represent cells (or occasionally arrows) in the pasting diagram. Not just any tree constitutes a valid pasting. The domains/codomains and sources/targets of the cells must compatible, and spines can only appear in certain configurations.

Tuple Fields§

§0: OpenTree<ProE, DblNode<E, Sq>>

Implementations§

Source§

impl<E, ProE, Sq> DblTree<E, ProE, Sq>

Source

pub fn empty(p: ProE) -> Self

Constructs the empty or identity double tree.

Source

pub fn single( sq: Sq, graph: &impl VDblGraph<E = E, ProE = ProE, Sq = Sq>, ) -> Self

Constructs a double tree with a single square from a virtual double graph.

Source

pub fn two_level( squares: impl IntoIterator<Item = Sq>, base: Sq, graph: &impl VDblGraph<E = E, ProE = ProE, Sq = Sq>, ) -> Self

Constructs a double tree of height two.

Source

pub fn dom<V>( &self, graph: &impl VDblGraph<V = V, E = E, ProE = ProE, Sq = Sq>, ) -> Path<V, ProE>
where ProE: Clone,

Domain of the tree in the given virtual double graph.

Source

pub fn cod(&self, graph: &impl VDblGraph<E = E, ProE = ProE, Sq = Sq>) -> ProE
where ProE: Clone,

Codomain of the tree in the given virtual double graph.

Source

pub fn src<V>( &self, graph: &impl VDblGraph<V = V, E = E, ProE = ProE, Sq = Sq>, ) -> Path<V, E>
where E: Clone,

Source of the tree in the given virtual double graph.

Source

pub fn tgt<V>( &self, graph: &impl VDblGraph<V = V, E = E, ProE = ProE, Sq = Sq>, ) -> Path<V, E>
where E: Clone,

Target of the tree in the given virtual double graph.

Source

pub fn arity( &self, graph: &impl VDblGraph<E = E, ProE = ProE, Sq = Sq>, ) -> usize

Arity of the cell specified by the double tree.

Note that this arity can differ from the arity of the underlying open tree due to the possibility of spines.

Source

pub fn contained_in( &self, graph: &impl VDblGraph<E = E, ProE = ProE, Sq = Sq>, ) -> bool
where E: Eq + Clone, ProE: Eq + Clone,

Is the double tree contained in the given virtual double graph?

This includes checking whether the double tree is well-typed, i.e., that the domains and codomains, and sources and targets, of the cells are compatible.

Source

pub fn is_isomorphic_to(&self, other: &Self) -> bool
where E: Eq, ProE: Eq, Sq: Eq,

Is the double tree isomorphic to another?

This method simply checks whether the underlying open trees are isomorphic.

Source

pub fn map<CodE, CodSq>( self, fn_e: impl FnMut(E) -> CodE, fn_sq: impl FnMut(Sq) -> CodSq, ) -> DblTree<CodE, ProE, CodSq>

Maps over the edges and squares of the tree.

Source§

impl<V, E, ProE, Sq> DblTree<Path<V, E>, ProE, DblTree<E, ProE, Sq>>

Source

pub fn flatten(self) -> DblTree<E, ProE, Sq>

Flattens a double tree of double trees into a single double tree.

Trait Implementations§

Source§

impl<E: Clone, ProE: Clone, Sq: Clone> Clone for DblTree<E, ProE, Sq>

Source§

fn clone(&self) -> DblTree<E, ProE, Sq>

Returns a copy 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<E: Debug, ProE: Debug, Sq: Debug> Debug for DblTree<E, ProE, Sq>

Source§

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

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

impl<E, ProE, Sq> From<OpenTree<ProE, DblNode<E, Sq>>> for DblTree<E, ProE, Sq>

Source§

fn from(value: OpenTree<ProE, DblNode<E, Sq>>) -> Self

Converts to this type from the input type.
Source§

impl<E: PartialEq, ProE: PartialEq, Sq: PartialEq> PartialEq for DblTree<E, ProE, Sq>

Source§

fn eq(&self, other: &DblTree<E, ProE, Sq>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<E: Eq, ProE: Eq, Sq: Eq> Eq for DblTree<E, ProE, Sq>

Source§

impl<E, ProE, Sq> StructuralPartialEq for DblTree<E, ProE, Sq>

Auto Trait Implementations§

§

impl<E, ProE, Sq> Freeze for DblTree<E, ProE, Sq>
where ProE: Freeze,

§

impl<E, ProE, Sq> RefUnwindSafe for DblTree<E, ProE, Sq>

§

impl<E, ProE, Sq> Send for DblTree<E, ProE, Sq>
where ProE: Send, Sq: Send, E: Send,

§

impl<E, ProE, Sq> Sync for DblTree<E, ProE, Sq>
where ProE: Sync, Sq: Sync, E: Sync,

§

impl<E, ProE, Sq> Unpin for DblTree<E, ProE, Sq>
where ProE: Unpin, Sq: Unpin, E: Unpin,

§

impl<E, ProE, Sq> UnwindSafe for DblTree<E, ProE, Sq>
where ProE: UnwindSafe, Sq: UnwindSafe, E: UnwindSafe,

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
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Same for T

Source§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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.
Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,