FreeInv

Enum FreeInv 

Source
pub enum FreeInv<T: Eq> {
    Id(T),
    Inv(T),
}
Expand description

Wraps a type T and symbolically inverts elements.

Used for constructing FreeGroup

Variants§

§

Id(T)

Wraps an instance of type T

§

Inv(T)

The symbolic inverse of an object of type T

Implementations§

Source§

impl<T: Eq> FreeInv<T>

Source

pub fn is_inv(&self) -> bool

Returns true if self is inverted

use free_algebra::FreeInv::*;

assert!(Inv('a').is_inv());
assert!(!Id('a').is_inv());
Source

pub fn is_id(&self) -> bool

Returns true if self is non-inverted

use free_algebra::FreeInv::*;

assert!(Id('a').is_id());
assert!(!Inv('a').is_id());

Trait Implementations§

Source§

impl<T: Eq> AsMut<T> for FreeInv<T>

Provides a mutable reference to this type’s inner T

Note that this does not convey any information regarding the state of inversion

Source§

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

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<T: Eq> AsRef<T> for FreeInv<T>

Provides a reference to this type’s inner T

Note that this does not convey any information regarding the state of inversion

Source§

fn as_ref(&self) -> &T

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T: Clone + Eq> Clone for FreeInv<T>

Source§

fn clone(&self) -> FreeInv<T>

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<T: Debug + Eq> Debug for FreeInv<T>

Source§

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

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

impl<T: Eq + Display> Display for FreeInv<T>

Source§

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

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

impl<T: Eq> Div<MonoidalString<FreeInv<T>, InvRule>> for FreeInv<T>

Source§

type Output = MonoidalString<FreeInv<T>, InvRule>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: FreeGroup<T>) -> FreeGroup<T>

Performs the / operation. Read more
Source§

impl<T: Eq> Div for FreeInv<T>

Source§

type Output = MonoidalString<FreeInv<T>, InvRule>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Self) -> FreeGroup<T>

Performs the / operation. Read more
Source§

impl<C: Eq, P: One + Neg<Output = P>> From<FreeInv<C>> for FreePow<C, P>

Source§

fn from(inv: FreeInv<C>) -> Self

Converts to this type from the input type.
Source§

impl<T: Eq> From<T> for FreeInv<T>

Source§

fn from(t: T) -> Self

Converts to this type from the input type.
Source§

impl<T: Hash + Eq> Hash for FreeInv<T>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T: Eq> Inv for FreeInv<T>

Source§

type Output = FreeInv<T>

The result after applying the operator.
Source§

fn inv(self) -> Self

Returns the multiplicative inverse of self. Read more
Source§

impl<T: Eq> InvMonoidRule<FreeInv<T>> for InvRule

Source§

fn invert(letter: FreeInv<T>) -> FreeInv<T>

Inverts a letter x such that x * x.invert() == 1
Source§

impl<T: Eq> MonoidRule<FreeInv<T>> for InvRule

Source§

fn apply(string: Vec<FreeInv<T>>, letter: FreeInv<T>) -> Vec<FreeInv<T>>

Applies the operation rule to the product of a word and a single letter
Source§

fn apply_many(word1: Vec<C>, word2: Vec<C>) -> Vec<C>

Applies the operation rule to the product of two words Read more
Source§

fn apply_iter<I: Iterator<Item = C>>(word: Vec<C>, letters: I) -> Vec<C>

Applies the operation rule to the product of a word and a sequence of letters Read more
Source§

impl<T: Eq> Mul<MonoidalString<FreeInv<T>, InvRule>> for FreeInv<T>

Source§

type Output = MonoidalString<FreeInv<T>, InvRule>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: FreeGroup<T>) -> FreeGroup<T>

Performs the * operation. Read more
Source§

impl<T: Eq> Mul for FreeInv<T>

Source§

type Output = MonoidalString<FreeInv<T>, InvRule>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Self) -> FreeGroup<T>

Performs the * operation. Read more
Source§

impl<T: Eq> PartialEq<T> for FreeInv<T>

Source§

fn eq(&self, rhs: &T) -> 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<T: PartialEq + Eq> PartialEq for FreeInv<T>

Source§

fn eq(&self, other: &FreeInv<T>) -> 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<T: Eq> AssociativeMonoidRule<FreeInv<T>> for InvRule

Source§

impl<T: Copy + Eq> Copy for FreeInv<T>

Source§

impl<T: Eq + Eq> Eq for FreeInv<T>

Source§

impl<T: Eq> StructuralPartialEq for FreeInv<T>

Auto Trait Implementations§

§

impl<T> Freeze for FreeInv<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for FreeInv<T>
where T: RefUnwindSafe,

§

impl<T> Send for FreeInv<T>
where T: Send,

§

impl<T> Sync for FreeInv<T>
where T: Sync,

§

impl<T> Unpin for FreeInv<T>
where T: Unpin,

§

impl<T> UnwindSafe for FreeInv<T>
where T: 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
Source§

impl<T> From<!> for T

Source§

fn from(t: !) -> T

Converts to this type from the input type.
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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.