Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- type Value s = ValueIntro Err s Sym
- data ValueIntro err s a
- = ValueLam IrrSym (ValueIntro err s a) (Scope IrrSym (ValueIntro err s) a)
- | ValueCoerce (ValueElim err s a)
- | ValueSort s
- | ValuePi IrrSym (ValueIntro err s a) (Scope IrrSym (ValueIntro err s) a)
- | ValueErr err
- | ValueSigma IrrSym (ValueIntro err s a) (Scope IrrSym (ValueIntro err s) a)
- | ValuePair (ValueIntro err s a) (ValueIntro err s a)
- | ValueEquality (ValueIntro err s a) (ValueIntro err s a) (ValueIntro err s a)
- | ValueRefl
- | ValueUnit
- | ValueI
- | ValueEmpty
- | ValueBool
- | ValueTrue
- | ValueFalse
- | ValueNat
- | ValueNatZ
- | ValueNatS (ValueIntro err s a)
- | ValueHadron (Set Sym)
- | ValueQuark Sym
- data ValueElim err s a
- = ValueApp (ValueElim err s a) (ValueIntro err s a)
- | ValueVar a
- | ValueMatch (ValueElim err s a) IrrSym IrrSym (Scope IrrSym2 (ValueIntro err s) a)
- | ValueJ (V3 IrrSym) (ValueIntro err s a) (Scope IrrSym3 (ValueIntro err s) a) (ValueIntro err s a) (ValueIntro err s a) (ValueIntro err s a) (ValueElim err s a)
- | ValueAbsurd (ValueIntro err s a) (ValueElim err s a)
- | ValueBoolElim IrrSym (Scope IrrSym (ValueIntro err s) a) (ValueIntro err s a) (ValueIntro err s a) (ValueElim err s a)
- | ValueAnd (ValueElim err s a) (ValueElim err s a)
- | ValueNatElim IrrSym (Scope IrrSym (ValueIntro err s) a) (ValueIntro err s a) (ValueIntro err s a) (ValueElim err s a)
- | ValuePlus (ValueElim err s a) (ValueElim err s a)
- | ValueTimes (ValueElim err s a) (ValueElim err s a)
- | ValueQuarkElim IrrSym (Scope IrrSym (ValueIntro err s) a) (Map Sym (ValueIntro err s a)) (ValueElim err s a)
- pureValueIntro :: a -> ValueIntro err s a
- pureValueElim :: a -> ValueElim err s a
- mapValueIntroError :: (err -> err') -> ValueIntro err s a -> ValueIntro err' s a
- valueApp :: (PrettyPrec err, AsErr err, Specification s) => ValueIntro err s a -> ValueIntro err s a -> ValueIntro err s a
- errorlessValueIntro :: MonadErr m => ValueIntro Err s a -> m (ValueIntro err' s a)
- errorlessValueIntro' :: MonadErr m => ValueIntro Err s a -> m (ValueIntro Void s a)
- errorlessValueElim :: MonadErr m => ValueElim Err s a -> m (ValueElim err' s a)
- errorlessValueElim' :: MonadErr m => ValueElim Err s a -> m (ValueElim Void s a)
- valueMatch :: (Specification s, AsErr err, PrettyPrec err) => ValueIntro err s a -> IrrSym -> IrrSym -> Scope IrrSym2 (ValueIntro err s) a -> ValueIntro err s a
- valueJ :: (Specification s, AsErr err, PrettyPrec err) => V3 IrrSym -> ValueIntro err s a -> Scope IrrSym3 (ValueIntro err s) a -> ValueIntro err s a -> ValueIntro err s a -> ValueIntro err s a -> ValueIntro err s a -> ValueIntro err s a
- valueAbsurd :: (Specification s, AsErr err, PrettyPrec err) => ValueIntro err s a -> ValueIntro err s a -> ValueIntro err s a
- valueBoolElim :: (Specification s, AsErr err, PrettyPrec err) => IrrSym -> Scope IrrSym (ValueIntro err s) a -> ValueIntro err s a -> ValueIntro err s a -> ValueIntro err s a -> ValueIntro err s a
- valueAnd :: (Specification s, AsErr err, PrettyPrec err) => ValueIntro err s a -> ValueIntro err s a -> ValueIntro err s a
- valueNatElim :: (Specification s, AsErr err, PrettyPrec err) => IrrSym -> Scope IrrSym (ValueIntro err s) a -> ValueIntro err s a -> ValueIntro err s a -> ValueIntro err s a -> ValueIntro err s a
- valuePlus :: (Specification s, AsErr err, PrettyPrec err) => ValueIntro err s a -> ValueIntro err s a -> ValueIntro err s a
- valueTimes :: (Specification s, AsErr err, PrettyPrec err) => ValueIntro err s a -> ValueIntro err s a -> ValueIntro err s a
- valueQuarkElim :: (Specification s, AsErr err, PrettyPrec err) => IrrSym -> Scope IrrSym (ValueIntro err s) a -> Map Sym (ValueIntro err s a) -> ValueIntro err s a -> ValueIntro err s a
- pppIntro :: forall err s. (Specification s, PrettyPrec err) => Prec -> ValueIntro err s Doc -> PrettyM Doc
- pppElim :: (Specification s, PrettyPrec err) => Prec -> ValueElim err s Doc -> PrettyM Doc
Values
data ValueIntro err s a Source #
ValueIntro
has a normal deduction, \(A\!\uparrow\).
We assume that all operations are well-typed.
ValueLam IrrSym (ValueIntro err s a) (Scope IrrSym (ValueIntro err s) a) | Implication introduction, lambda abstraction. \[ \frac {\color{darkblue}{\Gamma^\downarrow, x : \mathord{\tau\!\downarrow}} \vdash \color{darkgreen}b : \color{darkred}{\mathord{\tau'\!\uparrow}}} {\color{darkblue}{\Gamma^\downarrow} \vdash \color{darkgreen}{\lambda (a : \tau) \to b} : \color{darkred}{\mathord{\tau \to \tau'\!\uparrow}}} \] |
ValueCoerce (ValueElim err s a) | Coercion. \[ \frac {\color{darkblue}{\Gamma^\downarrow} \vdash \color{darkgreen}x : \color{darkred}{\mathord{\tau\!\downarrow}}} {\color{darkblue}{\Gamma^\downarrow} \vdash \color{darkgreen}x : \color{darkred}{\mathord{\tau\!\uparrow}}} \] |
ValueSort s | Sort introduction, axiom. \[ \frac {s_1 : s_2 \in \mathcal{A}} {\color{darkblue}{\Gamma^\downarrow} \vdash \color{darkgreen}{s_1} : \color{darkred}{s_2\!\uparrow}} \] |
ValuePi IrrSym (ValueIntro err s a) (Scope IrrSym (ValueIntro err s) a) | Function type introduction. \[ \frac {(s_1, s_2, s_3 \in \mathcal{S}) \cdots} {\color{darkblue}{\Gamma^\downarrow} \vdash \cdots} \] |
ValueErr err | Falsehood introduction, errors in evaluation, bottoms. \[ \frac {\color{darkblue}{\Gamma^\downarrow} \vdash - : \color{darkred}{\bot\!\downarrow}} {\color{darkblue}{\Gamma^\downarrow} \vdash \color{darkgreen}x : \color{darkred}{\tau\!\uparrow}} \] |
ValueSigma IrrSym (ValueIntro err s a) (Scope IrrSym (ValueIntro err s) a) | Dependent pair (sum) |
ValuePair (ValueIntro err s a) (ValueIntro err s a) | (Dependent) pair constructor |
ValueEquality (ValueIntro err s a) (ValueIntro err s a) (ValueIntro err s a) | Equality |
ValueRefl | Equality witness |
ValueUnit | |
ValueI | |
ValueEmpty | |
ValueBool | Booleans. |
ValueTrue | True. |
ValueFalse | False. |
ValueNat | Nat type |
ValueNatZ | Nat zero |
ValueNatS (ValueIntro err s a) | Nat successor |
ValueHadron (Set Sym) | Hadron (collection of quarks) type. |
ValueQuark Sym | Quark. |
Instances
data ValueElim err s a Source #
ValueElim
is extracted from a hypothesis, \(A\!\downarrow\).
ValueApp (ValueElim err s a) (ValueIntro err s a) | Implication elimination, application. \[ \frac {\color{darkblue}{\Gamma^\downarrow} \vdash \color{darkgreen}f : \color{darkred}{\tau \to \tau'\!\downarrow} \qquad \color{darkblue}{\Gamma^\downarrow} \vdash \color{darkgreen}x : \color{darkred}{\tau\!\uparrow}} {\color{darkblue}{\Gamma^\downarrow} \vdash \color{darkgreen}{f\,x} : \color{darkred}{\tau'\!\downarrow}} \] |
ValueVar a | Hypothesis, variable. \[ \frac{} {\color{darkblue}{\Gamma^\downarrow, x : \mathord{\tau\!\downarrow}} \vdash \color{darkgreen}x : \color{darkred}{\tau\!\downarrow}} \] |
ValueMatch (ValueElim err s a) IrrSym IrrSym (Scope IrrSym2 (ValueIntro err s) a) | Dependent pattern match on a pair. match p (x y -> b) ~ (x y -> b) (fst p) (snd p) |
ValueJ (V3 IrrSym) (ValueIntro err s a) (Scope IrrSym3 (ValueIntro err s) a) (ValueIntro err s a) (ValueIntro err s a) (ValueIntro err s a) (ValueElim err s a) | Equality elmination |
ValueAbsurd (ValueIntro err s a) (ValueElim err s a) | |
ValueBoolElim IrrSym (Scope IrrSym (ValueIntro err s) a) (ValueIntro err s a) (ValueIntro err s a) (ValueElim err s a) | Boolean elimination |
ValueAnd (ValueElim err s a) (ValueElim err s a) | Boolean conjunction |
ValueNatElim IrrSym (Scope IrrSym (ValueIntro err s) a) (ValueIntro err s a) (ValueIntro err s a) (ValueElim err s a) | Natural number elimination |
ValuePlus (ValueElim err s a) (ValueElim err s a) | Natural number addition |
ValueTimes (ValueElim err s a) (ValueElim err s a) | Natural number multiplication |
ValueQuarkElim IrrSym (Scope IrrSym (ValueIntro err s) a) (Map Sym (ValueIntro err s a)) (ValueElim err s a) | Hadron elimination. |
Instances
Combinators
pureValueIntro :: a -> ValueIntro err s a Source #
pureValueElim :: a -> ValueElim err s a Source #
mapValueIntroError :: (err -> err') -> ValueIntro err s a -> ValueIntro err' s a Source #
Application
:: (PrettyPrec err, AsErr err, Specification s) | |
=> ValueIntro err s a | f : a -> b |
-> ValueIntro err s a | x : a |
-> ValueIntro err s a | _ : b |
Apply to values.
Note that @@
from Language.PTSmart module is different
Errors
errorlessValueIntro :: MonadErr m => ValueIntro Err s a -> m (ValueIntro err' s a) Source #
errorlessValueIntro' :: MonadErr m => ValueIntro Err s a -> m (ValueIntro Void s a) Source #
Pairs
valueMatch :: (Specification s, AsErr err, PrettyPrec err) => ValueIntro err s a -> IrrSym -> IrrSym -> Scope IrrSym2 (ValueIntro err s) a -> ValueIntro err s a Source #
Equality
valueJ :: (Specification s, AsErr err, PrettyPrec err) => V3 IrrSym -> ValueIntro err s a -> Scope IrrSym3 (ValueIntro err s) a -> ValueIntro err s a -> ValueIntro err s a -> ValueIntro err s a -> ValueIntro err s a -> ValueIntro err s a Source #
Prop types
valueAbsurd :: (Specification s, AsErr err, PrettyPrec err) => ValueIntro err s a -> ValueIntro err s a -> ValueIntro err s a Source #
Booleans
:: (Specification s, AsErr err, PrettyPrec err) | |
=> IrrSym | x |
-> Scope IrrSym (ValueIntro err s) a | P : s |
-> ValueIntro err s a | t : P true |
-> ValueIntro err s a | f : P false |
-> ValueIntro err s a | b : Bool |
-> ValueIntro err s a | P b |
valueAnd :: (Specification s, AsErr err, PrettyPrec err) => ValueIntro err s a -> ValueIntro err s a -> ValueIntro err s a Source #
Natural numbers
:: (Specification s, AsErr err, PrettyPrec err) | |
=> IrrSym | x |
-> Scope IrrSym (ValueIntro err s) a | P : s |
-> ValueIntro err s a | z : P 0 |
-> ValueIntro err s a | f : (forall l. P l -> P (succ l) |
-> ValueIntro err s a | n : Nat |
-> ValueIntro err s a | P n |
valuePlus :: (Specification s, AsErr err, PrettyPrec err) => ValueIntro err s a -> ValueIntro err s a -> ValueIntro err s a Source #
valueTimes :: (Specification s, AsErr err, PrettyPrec err) => ValueIntro err s a -> ValueIntro err s a -> ValueIntro err s a Source #
Quarks
valueQuarkElim :: (Specification s, AsErr err, PrettyPrec err) => IrrSym -> Scope IrrSym (ValueIntro err s) a -> Map Sym (ValueIntro err s a) -> ValueIntro err s a -> ValueIntro err s a Source #
Pretty-printing
pppIntro :: forall err s. (Specification s, PrettyPrec err) => Prec -> ValueIntro err s Doc -> PrettyM Doc Source #
pppElim :: (Specification s, PrettyPrec err) => Prec -> ValueElim err s Doc -> PrettyM Doc Source #