Agda-2.4.2.2: A dependently typed functional programming language and proof assistant

Safe HaskellNone
LanguageHaskell98

Agda.TypeChecking.Substitute

Contents

Synopsis

Application

class Apply t where Source

Apply something to a bunch of arguments. Preserves blocking tags (application can never resolve blocking).

Minimal complete definition

Nothing

Methods

apply :: t -> Args -> t Source

applyE :: t -> Elims -> t Source

canProject :: QName -> Term -> Maybe (Arg Term) Source

If $v$ is a record value, canProject f v returns its field f.

conApp :: ConHead -> Args -> Elims -> Term Source

Eliminate a constructed term.

defApp :: QName -> Elims -> Elims -> Term Source

defApp f us vs applies Def f us to further arguments vs, eliminating top projection redexes. If us is not empty, we cannot have a projection redex, since the record argument is the first one.

piApply :: Type -> Args -> Type Source

The type must contain the right number of pis without have to perform any reduction.

Abstraction

class Abstract t where Source

(abstract args v) apply args --> v[args].

Methods

abstract :: Telescope -> t -> t Source

Instances

Abstract Permutation 
Abstract ClauseBody 
Abstract Clause 
Abstract Sort 
Abstract Telescope 
Abstract Type 
Abstract Term 
Abstract CompiledClauses 
Abstract FunctionInverse 
Abstract PrimFun 
Abstract Defn 
Abstract Projection 
Abstract Definition 
Abstract RewriteRule

tel ⊢ (Γ ⊢ lhs ↦ rhs : t) becomes tel, Γ ⊢ lhs ↦ rhs : t) we do not need to change lhs, rhs, and t since they live in Γ. See 'Abstract Clause'.

Abstract t => Abstract [t] 
Abstract [Occurrence] 
Abstract [Polarity] 
Abstract t => Abstract (Maybe t) 
DoDrop a => Abstract (Drop a) 
Abstract a => Abstract (Case a) 
Abstract a => Abstract (WithArity a) 
Abstract v => Abstract (Map k v) 

abstractArgs :: Abstract a => Args -> a -> a Source

Explicit substitutions

composeS :: Substitution -> Substitution -> Substitution Source

applySubst (ρ composeS σ) v == applySubst ρ (applySubst σ v)

Substitution and raisingshiftingweakening

raise :: Subst t => Nat -> t -> t Source

raiseFrom :: Subst t => Nat -> Nat -> t -> t Source

subst :: Subst t => Term -> t -> t Source

strengthen :: Subst t => Empty -> t -> t Source

substUnder :: Subst t => Nat -> Term -> t -> t Source

Telescopes

data TelV a Source

Constructors

TelV 

Fields

theTel :: Tele (Dom a)
 
theCore :: a
 

Instances

Functor TelV 
(Eq a, Subst a) => Eq (TelV a) 
(Ord a, Subst a) => Ord (TelV a) 
Show a => Show (TelV a) 
Typeable (* -> *) TelV 

type ListTel' a = [Dom (a, Type)] Source

bindsToTel' :: (Name -> a) -> [Name] -> Dom Type -> ListTel' a Source

Turn a typed binding (x1 .. xn : A) into a telescope.

mkPi :: Dom (ArgName, Type) -> Type -> Type Source

mkPi dom t = telePi (telFromList [dom]) t

telePi :: Telescope -> Type -> Type Source

Uses free variable analysis to introduce noAbs bindings.

telePi_ :: Telescope -> Type -> Type Source

Everything will be a Abs.

class TeleNoAbs a where Source

Performs void (noAbs) abstraction over telescope.

Methods

teleNoAbs :: a -> Term -> Term Source

dLub :: Sort -> Abs Sort -> Sort Source

Dependent least upper bound, to assign a level to expressions like forall i -> Set i.

dLub s1 i.s2 = omega if i appears in the rigid variables of s2.

Functions on abstractions

absApp :: Subst t => Abs t -> Term -> t Source

Instantiate an abstraction. Strict in the term.

lazyAbsApp :: Subst t => Abs t -> Term -> t Source

Instantiate an abstraction. Lazy in the term, which allow it to be IMPOSSIBLE in the case where the variable shouldn't be used but we cannot use noabsApp. Used in Apply.

noabsApp :: Subst t => Empty -> Abs t -> t Source

Instantiate an abstraction that doesn't use its argument.

absBody :: Subst t => Abs t -> t Source

mkAbs :: (Subst a, Free a) => ArgName -> a -> Abs a Source

reAbs :: (Subst a, Free a) => Abs a -> Abs a Source

underAbs :: Subst a => (a -> b -> b) -> a -> Abs b -> Abs b Source

underAbs k a b applies k to a and the content of abstraction b and puts the abstraction back. a is raised if abstraction was proper such that at point of application of k and the content of b are at the same context. Precondition: a and b are at the same context at call time.

underLambdas :: Subst a => Int -> (a -> Term -> Term) -> a -> Term -> Term Source

underLambdas n k a b drops n initial Lams from b, performs operation k on a and the body of b, and puts the Lams back. a is raised correctly according to the number of abstractions.

class GetBody a where Source

Methods to retrieve the clauseBody.

Methods

getBody :: a -> Maybe Term Source

Returns the properly raised clause Body, and Nothing if NoBody.

getBodyUnraised :: a -> Maybe Term Source

Just grabs the body, without raising the de Bruijn indices. This is useful if you want to consider the body in context clauseTel.

Syntactic equality and order

Level stuff

Boring instances