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

Safe HaskellNone
LanguageHaskell2010

Agda.TypeChecking.Substitute.Class

Contents

Synopsis

Application

class Apply t where Source #

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

Methods

apply :: t -> Args -> t Source #

applyE :: t -> Elims -> t Source #

applys :: Apply t => t -> [Term] -> t Source #

Apply to some default arguments.

apply1 :: Apply t => t -> Term -> t Source #

Apply to a single default argument.

Abstraction

class Abstract t where Source #

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

Minimal complete definition

abstract

Methods

abstract :: Telescope -> t -> t Source #

Substitution and raisingshiftingweakening

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

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

subst :: Subst t a => Int -> t -> a -> a Source #

Replace de Bruijn index i by a Term in something.

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

substUnder :: Subst t a => Nat -> t -> a -> a Source #

Replace what is now de Bruijn index 0, but go under n binders. substUnder n u == subst n (raise n u).

Explicit substitutions

singletonS :: DeBruijn a => Int -> a -> Substitution' a Source #

To replace index n by term u, do applySubst (singletonS n u). Γ, Δ ⊢ u : A --------------------------------- Γ, Δ ⊢ singletonS |Δ| u : Γ, A, Δ

inplaceS :: Subst a a => Int -> a -> Substitution' a Source #

Single substitution without disturbing any deBruijn indices. Γ, A, Δ ⊢ u : A --------------------------------- Γ, A, Δ ⊢ inplace |Δ| u : Γ, A, Δ

liftS :: Int -> Substitution' a -> Substitution' a Source #

Lift a substitution under k binders.

dropS :: Int -> Substitution' a -> Substitution' a Source #

        Γ ⊢ ρ : Δ, Ψ
     -------------------
     Γ ⊢ dropS |Ψ| ρ : Δ
  

composeS :: Subst a a => Substitution' a -> Substitution' a -> Substitution' a Source #

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

(++#) :: DeBruijn a => [a] -> Substitution' a -> Substitution' a infixr 4 Source #

prependS :: DeBruijn a => Empty -> [Maybe a] -> Substitution' a -> Substitution' a Source #

     Γ ⊢ ρ : Δ  Γ ⊢ reverse vs : Θ
     ----------------------------- (treating Nothing as having any type)
       Γ ⊢ prependS vs ρ : Δ, Θ
  

strengthenS :: Empty -> Int -> Substitution' a Source #

Γ ⊢ (strengthenS ⊥ |Δ|) : Γ,Δ

lookupS :: Subst a a => Substitution' a -> Nat -> a Source #

Functions on abstractions

absApp :: Subst t a => Abs a -> t -> a Source #

Instantiate an abstraction. Strict in the term.

lazyAbsApp :: Subst t a => Abs a -> t -> a 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 a => Empty -> Abs a -> a Source #

Instantiate an abstraction that doesn't use its argument.

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

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

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

underAbs :: Subst t 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 Term 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.