Term

Enum Term 

Source
pub enum Term<'a> {
    Constant(Symbol),
    Variable(Symbol),
    Function(Symbol, &'a [Term<'a>]),
    Group(&'a [Term<'a>]),
    Possessed {
        possessor: &'a Term<'a>,
        possessed: Symbol,
    },
    Sigma(Symbol),
    Intension(Symbol),
    Proposition(&'a LogicExpr<'a>),
    Value {
        kind: NumberKind,
        unit: Option<Symbol>,
        dimension: Option<Dimension>,
    },
}
Expand description

First-order logic term representing entities or values.

Terms denote individuals, groups, or computed values in the domain of discourse. They serve as arguments to predicates.

Variants§

§

Constant(Symbol)

Named individual constant (e.g., john, paris).

§

Variable(Symbol)

Bound or free variable (e.g., x, y).

§

Function(Symbol, &'a [Term<'a>])

Function application: f(t1, t2, ...) (e.g., mother(john)).

§

Group(&'a [Term<'a>])

Plural group for collective readings (e.g., john ⊕ mary).

§

Possessed

Possessive construction: john's bookPoss(john, book).

Fields

§possessor: &'a Term<'a>
§possessed: Symbol
§

Sigma(Symbol)

Definite description σ-term: σx.P(x) (“the unique x such that P”).

§

Intension(Symbol)

Intensional term (Montague up-arrow ^P) for de dicto readings.

§

Proposition(&'a LogicExpr<'a>)

Sentential complement (embedded clause as propositional argument).

§

Value

Numeric value with optional unit and dimension.

Fields

§dimension: Option<Dimension>

Implementations§

Source§

impl<'a> Term<'a>

Source

pub fn write_to<W: Write>( &self, w: &mut W, registry: &mut SymbolRegistry, interner: &Interner, ) -> Result

Writes the term to a writer using abbreviated symbols.

Source

pub fn write_to_full<W: Write>( &self, w: &mut W, registry: &mut SymbolRegistry, interner: &Interner, ) -> Result

Writes the term to a writer using full (unabbreviated) symbols.

Source

pub fn write_to_raw<W: Write>(&self, w: &mut W, interner: &Interner) -> Result

Writes the term preserving original case (for code generation).

Source

pub fn transpile( &self, registry: &mut SymbolRegistry, interner: &Interner, ) -> String

Transpiles the term to a logic formula string.

Trait Implementations§

Source§

impl<'a> Clone for Term<'a>

Source§

fn clone(&self) -> Term<'a>

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<'a> Debug for Term<'a>

Source§

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

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

impl<'a> DisplayWith for Term<'a>

Source§

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

Source§

fn with<'a>(&'a self, interner: &'a Interner) -> WithInterner<'a, Self>

Source§

impl<'a, 'b> Resolve<'a> for Term<'b>

Source§

type Output = TermView<'a>

Source§

fn resolve(&self, interner: &'a Interner) -> TermView<'a>

Source§

impl<'a> Copy for Term<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for Term<'a>

§

impl<'a> RefUnwindSafe for Term<'a>

§

impl<'a> Send for Term<'a>

§

impl<'a> Sync for Term<'a>

§

impl<'a> Unpin for Term<'a>

§

impl<'a> UnwindSafe for Term<'a>

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> 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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V