Enum TermKind

Source
pub enum TermKind {
Show 33 variants Omega, Level, LevelZero, LevelSucc { pred: Term, }, LevelMax { a: Term, b: Term, }, Type { level: Term, }, Var(usize), FuncType { arg_type: Term, res_type: Term, }, FuncTerm { body: Term, }, FuncApp { func: Term, arg: Term, arg_type: Term, res_type: Term, }, UnitType, UnitTerm, PairType { head_type: Term, tail_type: Term, }, PairTerm { head: Term, tail: Term, }, PairElim { pair: Term, res: Term, head_type: Term, tail_type: Term, }, NeverType, NeverElim { never: Term, }, EitherType { left_type: Term, right_type: Term, }, EitherLeft { val: Term, }, EitherRight { val: Term, }, EitherElim { arg: Term, arg_type: Term, res_type: Term, on_left: Term, on_right: Term, }, IdentType { term_type: Term, a: Term, b: Term, }, IdentTerm, IdentElim { term_type: Term, a: Term, b: Term, path: Term, context: Term, proof: Term, }, RecType { rec_type: Term, }, RecTerm { rec_term: Term, }, WorldType, WorldTerm, WorldElim { intrinsic: &'static str, world_in: Term, arg: Term, expr: Term, }, UmType, UmTerm { val: u64, }, UmSucc { pred: Term, }, UmElim { arg: Term, res_type: Term, on_zero: Term, on_succ: Term, },
}
Expand description

The different kinds of term that can appear in the AST.

Variants§

§

Omega

The type of all types, and levels, which does not itself have a type.

§

Level

The type of universe levels.

§

LevelZero

Universe level zero.

§

LevelSucc

Universe level (pred + 1).

Fields

§pred: Term
§

LevelMax

Universe level max(a, b)

Fields

§

Type

The type of types, indexed by levels.

Fields

§level: Term
§

Var(usize)

A variable.

§

FuncType

The type of functions. (ie pi types)

Fields

§arg_type: Term
§res_type: Term
§

FuncTerm

Functions.

Fields

§body: Term
§

FuncApp

Function application.

Fields

§func: Term
§arg: Term
§arg_type: Term
§res_type: Term
§

UnitType

The unit type.

§

UnitTerm

The unit term.

§

PairType

A dependent pair type (ie. sigma type)

Fields

§head_type: Term
§tail_type: Term
§

PairTerm

A pair term.

Fields

§head: Term
§tail: Term
§

PairElim

Dependent pair elimination.

Fields

§pair: Term
§res: Term
§head_type: Term
§tail_type: Term
§

NeverType

The canonical empty type, (ie. bottom).

§

NeverElim

Never type elimintator

Fields

§never: Term
§

EitherType

Disjoint union, sum type.

Fields

§left_type: Term
§right_type: Term
§

EitherLeft

Inject left.

Fields

§val: Term
§

EitherRight

Inject right.

Fields

§val: Term
§

EitherElim

Case match on a sum type.

Fields

§arg: Term
§arg_type: Term
§res_type: Term
§on_left: Term
§on_right: Term
§

IdentType

The type of identifications (a == b)

Fields

§term_type: Term
§

IdentTerm

Reflexivity,

§

IdentElim

J-elimination for identities.

Fields

§term_type: Term
§path: Term
§context: Term
§proof: Term
§

RecType

A recursive type. rec_type is under a context where Var(0) refers back to the type.

Fields

§rec_type: Term
§

RecTerm

A recursive term. Used to mark rec_term as a member of a recursive type.

Fields

§rec_term: Term
§

WorldType

The type for interacting with the outside world through intrinsics.

§

WorldTerm

The term used to represent a fully-normalised world ready to perform IO on.

§

WorldElim

Performs an intrinsic call.

Fields

§intrinsic: &'static str

The name of the intrinsic

§world_in: Term

The world argument.

§arg: Term

The argument type that the intrinsic expects.

§expr: Term

The result of the expression. Evaluated with the intrinsic result at Var(1) and another World at Var(0).

§

UmType

Unsigned, memory-sized integers.

§

UmTerm

An intger literal.

Fields

§val: u64
§

UmSucc

An integer literal equal to 1 + pred

Fields

§pred: Term
§

UmElim

Case match on a Um.

Fields

§arg: Term
§res_type: Term
§on_zero: Term
§on_succ: Term

Trait Implementations§

Source§

impl Clone for TermKind

Source§

fn clone(&self) -> TermKind

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 TermKind

Source§

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

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

impl PartialEq for TermKind

Source§

fn eq(&self, other: &TermKind) -> 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 StructuralPartialEq for TermKind

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