This page requires javascript to work

Enum GenericTelescope

Source
pub enum GenericTelescope<Value: Clone> {
    Nil,
    UpDec(Rc<Self>, Declaration),
    UpVar(Rc<Self>, Pattern, Value),
}
Expand description

Generic definition for two kinds of telescopes.
Value can be specialized with Value or NormalExpression.

Implementing Eq because of NormalExpression

Variants§

§

Nil

$()$, Empty telescope.

§

UpDec(Rc<Self>, Declaration)

$\rho, p=D$, In Mini-TT, checked declarations are put here. However, it’s not possible to store a recursive declaration as an Expression (which is a member of Declaration) here.

The problem is quite complicated and can be reproduced by checking out 0.1.5 revision and type-check this code (Type was U and Sum was sum at that time):

rec nat : U = sum { Zero 1 | Suc nat };
-- Inductive definition of nat

let one : nat = Zero 0;
let two : nat = Suc one;
-- Unresolved reference
§

UpVar(Rc<Self>, Pattern, Value)

$\rho, p=v$, Usually a local variable, introduced in your telescope

Implementations§

Source§

impl GenericTelescope<Value>

Source

pub fn resolve(&self, name: &str) -> Result<Value, String>

$$ \textnormal{If} \ x \ \textnormal{is\ in}\ p, \\ \begin{alignedat}{2} & (\rho, p=v)(x) &&= \textsf{proj}^p_x(v) \\ & (\rho, p:A=M)(x) &&= \textsf{proj}^p_x(⟦ M ⟧ \rho) \\ & (\rho, \textsf{rec}\ p:A=M)(x) &&= \textsf{proj}^p_x(⟦ M ⟧ (\rho, \textsf{rec}\ p:A=M)) \end{alignedat} \\ \textnormal{If} \ x \ \textnormal{is\ not\ in}\ p, \\ \begin{alignedat}{2} & (\rho, p=v)(x) &&= \rho(x) \\ & (\rho, D)(x) &&= \rho(x) \\ \end{alignedat} $$ getRho in Mini-TT.

Trait Implementations§

Source§

impl<Value: Clone + Clone> Clone for GenericTelescope<Value>

Source§

fn clone(&self) -> GenericTelescope<Value>

Returns a copy 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<Value: Debug + Clone> Debug for GenericTelescope<Value>

Source§

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

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

impl<Value: Clone + Display> Display for GenericTelescope<Value>

Actually it’s for NeutralTelescope

Source§

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

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

impl<Value: PartialEq + Clone> PartialEq for GenericTelescope<Value>

Source§

fn eq(&self, other: &GenericTelescope<Value>) -> 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 ReadBack for &GenericTelescope<Value>

Source§

fn read_back(self, index: u32) -> Self::NormalForm

$$ \begin{alignedat}{2} & \textsf{R}_i (\rho,p=v) &&= \textsf{R}_i\ \rho,p=\textsf{R}_i\ v \\ & \textsf{R}_i (\rho,D) &&= \textsf{R}_i\ \rho,D \\ & \textsf{R}_i () &&= () \end{alignedat} $$ rbRho in Mini-TT.

Source§

type NormalForm = Rc<GenericTelescope<NormalExpression>>

Corresponding normal form type for the read-backable structures.
This is needed because Rust does not support Higher-Kinded Types :(
Source§

fn read_back_please(self) -> Self::NormalForm

Sometimes you don’t want to pass an argument, and let me do this for you :)
Source§

fn normal( index: u32, me: Self, other: Self, ) -> (Self::NormalForm, Self::NormalForm)

eqNf in Mini-TT, but returning normal forms for error reporting.
Whether two structures are equivalent up to normal form.
Source§

impl<Value: Eq + Clone> Eq for GenericTelescope<Value>

Source§

impl<Value: Clone> StructuralPartialEq for GenericTelescope<Value>

Auto Trait Implementations§

§

impl<Value> Freeze for GenericTelescope<Value>
where Value: Freeze,

§

impl<Value> RefUnwindSafe for GenericTelescope<Value>
where Value: RefUnwindSafe,

§

impl<Value> !Send for GenericTelescope<Value>

§

impl<Value> !Sync for GenericTelescope<Value>

§

impl<Value> Unpin for GenericTelescope<Value>
where Value: Unpin,

§

impl<Value> UnwindSafe for GenericTelescope<Value>
where Value: UnwindSafe + RefUnwindSafe,

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.