[][src]Struct l_group_formulas::free_group_term::FreeGroupTerm

pub struct FreeGroupTerm {
    pub literals: Vec<Literal>,
}

An element of the group algebra.

Examples

To use this, import

use l_group_formulas::free_group_term::*;
use l_group_formulas::literal::*;
use l_group_formulas::*;

Constructing a free group term goes like this.

let term = Literal::from('x') * Literal::from('y');

In this case, term encodes the element xy of a free group.

Terms constructed using FreeGrouPTerm::new automatically get reduced:

let term = Literal::from('x') * Literal::from('x').inverse();
assert_eq!(String::from("e"), term.to_string());

Can also be constructed from strings: FreeGroupTerm::from(&str) parses a free group term from a string.

This ignores all non-alphanumeric characters, such as *. Perhaps dangerously, this also ignores symbols like ^, and treats v as the name of a symbol. The input is parsed by

Examples

Basic usage:

use l_group_formulas::literal::Literal;
use l_group_formulas::free_group_term::FreeGroupTerm;
// this is equivalent to: 
// let string = "X31yz39";
let string = "X3 1*yz39 ";
let x = Literal::new('x', 31, true);
let y = Literal::new('y', 0, false);
let z = Literal::new('z', 39, false);
let term = FreeGroupTerm::new(vec![x, y, z]);
assert_eq!(term, FreeGroupTerm::from(string));

Fields

literals: Vec<Literal>

Implementations

impl FreeGroupTerm[src]

pub fn new(literals: Vec<Literal>) -> FreeGroupTerm[src]

Trait Implementations

impl Clone for FreeGroupTerm[src]

impl Debug for FreeGroupTerm[src]

impl Eq for FreeGroupTerm[src]

impl<'_> From<&'_ str> for FreeGroupTerm[src]

impl From<FreeGroupTerm> for LGroupTerm[src]

impl From<FreeGroupTerm> for ShortFreeGroupTerm[src]

fn from(term: FreeGroupTerm) -> ShortFreeGroupTerm[src]

ignores everything after the third symbol

impl From<Literal> for FreeGroupTerm[src]

impl From<ShortFreeGroupTerm> for FreeGroupTerm[src]

impl From<char> for FreeGroupTerm[src]

impl Mul<FreeGroupTerm> for FreeGroupTerm[src]

type Output = FreeGroupTerm

The resulting type after applying the * operator.

impl Mul<Literal> for FreeGroupTerm[src]

type Output = FreeGroupTerm

The resulting type after applying the * operator.

impl MulAssign<FreeGroupTerm> for FreeGroupTerm[src]

impl Ord for FreeGroupTerm[src]

impl PartialEq<FreeGroupTerm> for FreeGroupTerm[src]

impl PartialOrd<FreeGroupTerm> for FreeGroupTerm[src]

impl Reducable for FreeGroupTerm[src]

impl StructuralEq for FreeGroupTerm[src]

impl StructuralPartialEq for FreeGroupTerm[src]

impl Term for FreeGroupTerm[src]

impl ToString for FreeGroupTerm[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.