rzk-0.11.4: An experimental proof assistant for synthetic ∞-categories
Safe HaskellNone
LanguageHaskell2010

Rzk.Check.Rules

Description

The typing rules: check and infer on raw terms, with types as values, producing core terms.

The algorithm is Coquand's bidirectional one (/An algorithm for type-checking dependent types/, 1996), in the form of free-foil-NBE's DependentTypes.Elaborate (Renata Shakirova and Nikolai Kudasov): a λ is checked against a Π value by entering its binder with the domain and checking the body against the codomain at the bound names; an inferred type is compared with the expected one by subtyping (Rzk.Check.Conversion). The rules mirror those of Rzk.TypeCheck.Judgements case by case, on values.

The modal constructs and match are not covered yet.

Synopsis

Documentation

check :: forall (n :: S). Distinct n => Raw n -> Value n -> Check n (Core n) Source #

infer :: forall (n :: S). Distinct n => Raw n -> Check n (Core n, Value n) Source #

inferAs :: forall (n :: S). Distinct n => Value n -> Raw n -> Check n (Core n, Value n) Source #

Infer a term and compare its type's sort with the expected one.

checkTopeAgainstContext :: forall (n :: S). Distinct n => String -> Value n -> Check n () Source #

Diagnose a recOR guard or a restriction face against the context: a tope disjoint from a consistent context is vacuous, an error; a tope that overhangs the context is reported when the option asks.

contextEntails :: forall (n :: S). Distinct n => Value n -> Check n () Source #

The context entails the tope, or the tope mentions a hole and cannot be decided.

ensureTypeAtU :: forall (n :: S). Distinct n => String -> Value n -> Check n () Source #

Reject a universe kind standing where an ordinary type is required.

data DomainKind Source #

The kind of a type standing at U: the universes and the families into them are U-sorted but are not ordinary types.

Constructors

DomainType

an ordinary type in U

DomainCubeUniverse

the universe CUBE, not an ordinary type

DomainCubeFamily

a family valued in CUBE

DomainTopeUniverse

the universe TOPE, not an ordinary type

DomainTopeFamily

a tope family over a cube

DomainOtherTopeFamily

a tope family over a domain that is not a cube

DomainModalTope

a modal cube or tope kind

Instances

Instances details
Show DomainKind Source # 
Instance details

Defined in Rzk.Check.Rules

Eq DomainKind Source # 
Instance details

Defined in Rzk.Check.Rules

classifyType :: forall (n :: S). Distinct n => Scope n -> Context n -> Value n -> DomainKind Source #

Classify a type value.

evalM :: forall (n :: S). Distinct n => Core n -> Check n (Value n) Source #

quoteM :: forall (n :: S). Distinct n => Value n -> Check n (Core n) Source #

A value read back, with defined names folded. Lazy: nothing is read back until a consumer looks.

underRawScope :: forall (n :: S) r. Distinct n => TModality -> Value n -> Maybe (Value n) -> ScopedRaw n -> (forall (l :: S). (Distinct l, DExt n l) => Pattern n l -> Raw l -> Check l r) -> Check n r Source #

Enter a raw scope bound at a domain, with a modality and a shape.