Skip to main content

SurfaceExpr

Enum SurfaceExpr 

Source
pub enum SurfaceExpr {
Show 25 variants Sort(SortKind), Var(String), App(Box<Located<SurfaceExpr>>, Box<Located<SurfaceExpr>>), Lam(Vec<Binder>, Box<Located<SurfaceExpr>>), Pi(Vec<Binder>, Box<Located<SurfaceExpr>>), Let(String, Option<Box<Located<SurfaceExpr>>>, Box<Located<SurfaceExpr>>, Box<Located<SurfaceExpr>>), Lit(Literal), Ann(Box<Located<SurfaceExpr>>, Box<Located<SurfaceExpr>>), Hole, Proj(Box<Located<SurfaceExpr>>, String), If(Box<Located<SurfaceExpr>>, Box<Located<SurfaceExpr>>, Box<Located<SurfaceExpr>>), Match(Box<Located<SurfaceExpr>>, Vec<MatchArm>), Do(Vec<DoAction>), Have(String, Box<Located<SurfaceExpr>>, Box<Located<SurfaceExpr>>, Box<Located<SurfaceExpr>>), Suffices(String, Box<Located<SurfaceExpr>>, Box<Located<SurfaceExpr>>), Show(Box<Located<SurfaceExpr>>, Box<Located<SurfaceExpr>>), NamedArg(Box<Located<SurfaceExpr>>, String, Box<Located<SurfaceExpr>>), AnonymousCtor(Vec<Located<SurfaceExpr>>), ListLit(Vec<Located<SurfaceExpr>>), Tuple(Vec<Located<SurfaceExpr>>), Return(Box<Located<SurfaceExpr>>), StringInterp(Vec<StringPart>), Range(Option<Box<Located<SurfaceExpr>>>, Option<Box<Located<SurfaceExpr>>>), ByTactic(Vec<Located<TacticRef>>), Calc(Vec<CalcStep>),
}
Expand description

Surface-level expression (before elaboration).

Variants§

§

Sort(SortKind)

Sort: Type, Prop, Type u, Sort u

§

Var(String)

Variable reference

§

App(Box<Located<SurfaceExpr>>, Box<Located<SurfaceExpr>>)

Application: f a

§

Lam(Vec<Binder>, Box<Located<SurfaceExpr>>)

Lambda: fun (x : alpha) => body or lambda (x : alpha), body

§

Pi(Vec<Binder>, Box<Located<SurfaceExpr>>)

Pi type: forall (x : alpha), beta or (x : alpha) -> beta

§

Let(String, Option<Box<Located<SurfaceExpr>>>, Box<Located<SurfaceExpr>>, Box<Located<SurfaceExpr>>)

Let binding: let x : alpha := v in body

§

Lit(Literal)

Literal value

§

Ann(Box<Located<SurfaceExpr>>, Box<Located<SurfaceExpr>>)

Explicit type annotation: (e : tau)

§

Hole

Placeholder: _

§

Proj(Box<Located<SurfaceExpr>>, String)

Projection: e.n

§

If(Box<Located<SurfaceExpr>>, Box<Located<SurfaceExpr>>, Box<Located<SurfaceExpr>>)

If-then-else: if c then t else e

§

Match(Box<Located<SurfaceExpr>>, Vec<MatchArm>)

Match expression: match e with | pat => rhs | …

§

Do(Vec<DoAction>)

Do notation: do { … }

§

Have(String, Box<Located<SurfaceExpr>>, Box<Located<SurfaceExpr>>, Box<Located<SurfaceExpr>>)

Have expression: have h : T := proof; body

§

Suffices(String, Box<Located<SurfaceExpr>>, Box<Located<SurfaceExpr>>)

Suffices expression: suffices h : T by tactic; body

§

Show(Box<Located<SurfaceExpr>>, Box<Located<SurfaceExpr>>)

Show expression: show T from expr

§

NamedArg(Box<Located<SurfaceExpr>>, String, Box<Located<SurfaceExpr>>)

Named argument application: f (x := e)

§

AnonymousCtor(Vec<Located<SurfaceExpr>>)

Anonymous constructor: (langle) a, b, c (rangle)

§

ListLit(Vec<Located<SurfaceExpr>>)

List literal: [1, 2, 3]

§

Tuple(Vec<Located<SurfaceExpr>>)

Tuple: (a, b) or (a, b, c)

§

Return(Box<Located<SurfaceExpr>>)

Return expression (used in do notation): return e

§

StringInterp(Vec<StringPart>)

String interpolation: s!"hello {name}"

§

Range(Option<Box<Located<SurfaceExpr>>>, Option<Box<Located<SurfaceExpr>>>)

Range expression: a..b, ..b, a..

§

ByTactic(Vec<Located<TacticRef>>)

By-tactic expression: by tactic1; tactic2; ...

§

Calc(Vec<CalcStep>)

Calc expression: calculational proof

Implementations§

Source§

impl SurfaceExpr

Source

pub fn var(name: &str) -> Self

Create a variable expression.

Source

pub fn nat(n: u64) -> Self

Create a natural number literal expression.

Source

pub fn string(s: &str) -> Self

Create a string literal expression.

Source

pub fn float(v: f64) -> Self

Create a float literal expression.

Source

pub fn is_hole(&self) -> bool

Check if this expression is a hole/placeholder.

Source

pub fn is_var(&self) -> bool

Check if this expression is a variable.

Source

pub fn as_var(&self) -> Option<&str>

Get the variable name if this is a variable.

Trait Implementations§

Source§

impl Clone for SurfaceExpr

Source§

fn clone(&self) -> SurfaceExpr

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 SurfaceExpr

Source§

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

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

impl Display for SurfaceExpr

Source§

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

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

impl PartialEq for SurfaceExpr

Source§

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

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