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

Safe HaskellNone
LanguageHaskell98

Agda.Syntax.Internal

Contents

Synopsis

Documentation

type Arg a = Arg Color a Source

type Dom a = Dom Color a Source

type Args = [Arg Term] Source

Type of argument lists.

data ConHead Source

Store the names of the record fields in the constructor. This allows reduction of projection redexes outside of TCM. For instance, during substitution and application.

Constructors

ConHead 

Fields

conName :: QName

The name of the constructor.

conFields :: [QName]

The name of the record fields. Empty list for data constructors. Arg is not needed here since it is stored in the constructor args.

class LensConName a where Source

Minimal complete definition

getConName

Methods

getConName :: a -> QName Source

setConName :: QName -> a -> a Source

mapConName :: (QName -> QName) -> a -> a Source

Instances

data Term Source

Raw values.

Def is used for both defined and undefined constants. Assume there is a type declaration and a definition for every constant, even if the definition is an empty list of clauses.

Constructors

Var !Int Elims

x es neutral

Lam ArgInfo (Abs Term)

Terms are beta normal. Relevance is ignored

Lit Literal 
Def QName Elims

f es, possibly a delta/iota-redex

Con ConHead Args
c vs
Pi (Dom Type) (Abs Type)

dependent or non-dependent function space

Sort Sort 
Level Level 
MetaV !MetaId Elims 
DontCare Term

Irrelevant stuff in relevant position, but created in an irrelevant context. Basically, an internal version of the irrelevance axiom .irrAx : .A -> A.

Shared !(Ptr Term)

Explicit sharing

Instances

Eq Term

Syntactic equality, ignores stuff below DontCare.

Ord Term 
Show Term 
Sized Type 
Sized Term 
KillRange Type 
KillRange Term 
IsProjElim Elim 
Free ClauseBody 
Free Type 
Free Term 
GetDefs ClauseBody 
GetDefs Type 
GetDefs Term 
TermLike Type 
TermLike Term 
GetBody ClauseBody 
TeleNoAbs Telescope 
TeleNoAbs ListTel 
Subst ClauseBody 
Subst Type 
Subst Elim 
Subst Term 
Abstract ClauseBody 
Abstract Telescope 
Abstract Type 
Abstract Term 
Apply ClauseBody 
Apply Type 
Apply Term 
AbstractTerm Type 
AbstractTerm Term 
IsPrefixOf Elims 
IsPrefixOf Term 
IsPrefixOf Args 
KillVar Telescope 
KillVar Type 
KillVar Term 
GenC Telescope 
GenC Type 
GenC Term 
AddContext Telescope 
UnFreezeMeta Type 
UnFreezeMeta Term 
IsInstantiatedMeta Term 
PrettyTCM ClauseBody 
PrettyTCM Telescope 
PrettyTCM Type 
PrettyTCM Elim 
PrettyTCM Term 
EmbPrj ClauseBody 
EmbPrj Telescope 
EmbPrj Type 
EmbPrj Term 
DropArgs ClauseBody

NOTE: does not go into the body, so does not work for recursive functions.

DropArgs Telescope

NOTE: This creates telescopes with unbound de Bruijn indices.

MentionsMeta Type 
MentionsMeta Elim 
MentionsMeta Term 
InstantiateFull ClauseBody 
InstantiateFull Type 
InstantiateFull Elim 
InstantiateFull Term 
Normalise ClauseBody 
Normalise Type 
Normalise Elim 
Normalise Term 
Simplify ClauseBody 
Simplify Type 
Simplify Elim 
Simplify Term 
Reduce Telescope 
Reduce Type 
Reduce Elim 
Reduce Term 
Instantiate Telescope 
Instantiate Type 
Instantiate Elim 
Instantiate Term 
Match Term 
Injectible Term 
Evaluate Term 
Occurs Type 
Occurs Term 
NoProjectedVar Term 
SynEq Type

Syntactic equality ignores sorts.

SynEq Term

Syntactic term equality ignores DontCare stuff.

HasPolarity Type 
HasPolarity Term 
ComputeOccurrences Type 
ComputeOccurrences Term 
Unquote Type 
Unquote Term 
Unquote ArgInfo 
ToTerm Type 
PrimTerm Type 
ApplyHH Type 
ApplyHH Term 
UReduce Type 
UReduce Term 
Typeable * Term 
UniverseBi Elims Pattern 
UniverseBi Elims Term 
UniverseBi Args Pattern 
UniverseBi Args Term 
ShrinkC Telescope Telescope 
ShrinkC Type Type 
ShrinkC Term Term 
Reify ClauseBody RHS 
Reify Telescope Telescope 
Reify Type Expr 
Reify Elim Expr 
Reify Term Expr 
Reify ArgInfo ArgInfo 
ConvColor ArgInfo ArgInfo 
SubstHH Type (HomHet Type) 
SubstHH Term (HomHet Term) 
Eq (Type' Term) 
Eq (Elim' Term) 
Ord (Type' Term) 
Ord (Elim' Term) 
Free a => Free (Dom a) 
Free a => Free (Arg a) 
TermLike a => TermLike (Dom a) 
TermLike a => TermLike (Arg a) 
Subst a => Subst (Dom a) 
Subst a => Subst (Arg a) 
AbstractTerm a => AbstractTerm (Dom a) 
AbstractTerm a => AbstractTerm (Arg a) 
KillVar a => KillVar (Dom a) 
KillVar a => KillVar (Arg a) 
AddContext (Dom (String, Type)) 
AddContext (Dom (Name, Type)) 
(Reify a e, ToConcrete e c, Pretty c) => PrettyTCM (Dom a) 
(Reify a e, ToConcrete e c, Pretty c) => PrettyTCM (Arg a) 
MentionsMeta t => MentionsMeta (Dom t) 
MentionsMeta t => MentionsMeta (Arg t) 
InstantiateFull t => InstantiateFull (Dom t) 
InstantiateFull t => InstantiateFull (Arg t) 
Normalise t => Normalise (Dom t) 
Normalise t => Normalise (Arg t) 
Simplify t => Simplify (Dom t) 
Simplify t => Simplify (Arg t) 
Reduce t => Reduce (Dom t) 
Reduce t => Reduce (Arg t) 
Instantiate t => Instantiate (Dom t) 
Instantiate t => Instantiate (Arg t) 
Match a => Match (Arg a) 
Injectible a => Injectible (Arg a) 
Evaluate a => Evaluate (Arg a) 
Occurs a => Occurs (Dom a) 
Occurs a => Occurs (Arg a) 
NoProjectedVar a => NoProjectedVar (Arg a) 
HasPolarity a => HasPolarity (Dom a) 
HasPolarity a => HasPolarity (Arg a) 
ComputeOccurrences a => ComputeOccurrences (Dom a) 
ComputeOccurrences a => ComputeOccurrences (Arg a) 
Unquote a => Unquote (Arg a) 
UReduce a => UReduce (Arg a) 
UniverseBi [Term] Term 
ShrinkC a b => ShrinkC (Dom a) (Dom b) 
ShrinkC a b => ShrinkC (Arg a) (Arg b) 
Reify i a => Reify (Dom i) (Arg a) 
Reify i a => Reify (Arg i) (Arg a)

Skip reification of implicit and irrelevant args if option is off.

SubstHH a b => SubstHH (Dom a) (Dom b) 
SubstHH a b => SubstHH (Arg a) (Arg b) 
ConvColor (Dom e) (Dom e) 
ConvColor (Arg e) (Arg e) 
AddContext ([Name], Dom Type) 
AddContext (String, Dom Type) 
AddContext (Name, Dom Type) 
UniverseBi ([Type], [Clause]) Pattern 
UniverseBi ([Type], [Clause]) Term 

type Elims Source

Arguments

 = [Elim]

eliminations ordered left-to-right.

type ArgName = String Source

Names in binders and arguments.

data Abs a Source

Binder. Abs: The bound variable might appear in the body. NoAbs is pseudo-binder, it does not introduce a fresh variable, similar to the const of Haskell.

Constructors

Abs

The body has (at least) one free variable. Danger: unAbs doesn't shift variables properly

Fields

absName :: ArgName
 
unAbs :: a
 
NoAbs 

Fields

absName :: ArgName
 
unAbs :: a
 

Instances

Functor Abs 
Foldable Abs 
Traversable Abs 
(Subst a, Eq a) => Eq (Abs a) 
(Subst a, Ord a) => Ord (Abs a) 
Show a => Show (Abs a) 
Sized a => Sized (Abs a) 
KillRange a => KillRange (Abs a) 
Free a => Free (Abs a) 
GetDefs a => GetDefs (Abs a) 
TermLike a => TermLike (Abs a) 
Subst a => Subst (Abs a) 
(Subst a, AbstractTerm a) => AbstractTerm (Abs a) 
KillVar a => KillVar (Abs a) 
GenC a => GenC (Abs a) 
UnFreezeMeta a => UnFreezeMeta (Abs a) 
IsInstantiatedMeta a => IsInstantiatedMeta (Abs a)

Does not worry about raising.

EmbPrj a => EmbPrj (Abs a) 
MentionsMeta t => MentionsMeta (Abs t) 
(Subst t, InstantiateFull t) => InstantiateFull (Abs t) 
(Subst t, Normalise t) => Normalise (Abs t) 
(Subst t, Simplify t) => Simplify (Abs t) 
(Subst t, Reduce t) => Reduce (Abs t) 
Instantiate t => Instantiate (Abs t) 
Evaluate a => Evaluate (Abs a) 
(Occurs a, Subst a) => Occurs (Abs a) 
(Subst a, SynEq a) => SynEq (Abs a) 
HasPolarity a => HasPolarity (Abs a) 
ComputeOccurrences a => ComputeOccurrences (Abs a) 
Unquote a => Unquote (Abs a) 
Suggest (Abs a) (Abs b) 
ShrinkC a b => ShrinkC (Abs a) (Abs b) 
SubstHH a b => SubstHH (Abs a) (Abs b) 
(Free i, Reify i a) => Reify (Abs i) (Name, a) 
Typeable (* -> *) Abs 

data Tele a Source

Sequence of types. An argument of the first type is bound in later types and so on.

Constructors

EmptyTel 
ExtendTel a (Abs (Tele a))

Abs is never NoAbs.

mapAbsNamesM :: Applicative m => (ArgName -> m ArgName) -> Tele a -> m (Tele a) Source

data Sort Source

Sorts.

Constructors

Type Level 
Prop 
Inf 
DLub Sort (Abs Sort)

if the free variable occurs in the second sort the whole thing should reduce to Inf, otherwise it's the normal Lub

newtype Level Source

A level is a maximum expression of 0..n PlusLevel expressions each of which is a number or an atom plus a number.

The empty maximum is the canonical representation for level 0.

Constructors

Max [PlusLevel] 

data Blocked t Source

Something where a meta variable may block reduction.

Constructors

Blocked MetaId t 
NotBlocked t 

Definitions

data Clause Source

A clause is a list of patterns and the clause body should Bind.

The telescope contains the types of the pattern variables and the permutation is how to get from the order the variables occur in the patterns to the order they occur in the telescope. The body binds the variables in the order they appear in the patterns.

clauseTel ~ permute clausePerm (patternVars clausPats)

Terms in dot patterns are valid in the clause telescope.

For the purpose of the permutation and the body dot patterns count as variables. TODO: Change this!

Constructors

Clause 

Fields

clauseRange :: Range
 
clauseTel :: Telescope

The types of the pattern variables.

clausePerm :: Permutation
 
namedClausePats :: [NamedArg Pattern]
 
clauseBody :: ClauseBody
 
clauseType :: Maybe (Arg Type)

The type of the rhs under clauseTel. Used, e.g., by TermCheck. Can be Irrelevant if we encountered an irrelevant projection pattern on the lhs.

type PatVarName = ArgName Source

Pattern variables.

data Pattern Source

Patterns are variables, constructors, or wildcards. QName is used in ConP rather than Name since a constructor might come from a particular namespace. This also meshes well with the fact that values (i.e. the arguments we are matching with) use QName.

Constructors

VarP PatVarName

The PatVarName is a name suggestion.

DotP Term 
ConP ConHead ConPatternInfo [NamedArg Pattern]

The Patterns do not contain any projection copatterns.

LitP Literal 
ProjP QName

Projection copattern. Can only appear by itself.

type ConPatternInfo = Maybe (Bool, Arg Type) Source

The ConPatternInfo states whether the constructor belongs to a record type (Just) or data type (Nothing). In the former case, the Bool says whether the record pattern orginates from the expansion of an implicit pattern. The Type is the type of the whole record pattern. The scope used for the type is given by any outer scope plus the clause's telescope (clauseTel).

patternVars :: Arg Pattern -> [Arg (Either PatVarName Term)] Source

Extract pattern variables in left-to-right order. A DotP is also treated as variable (see docu for Clause).

properlyMatching :: Pattern -> Bool Source

Does the pattern perform a match that could fail?

Absurd Lambda

absurdBody :: Abs Term Source

Absurd lambdas are internally represented as identity with variable name "()".

Pointers and Sharing

shared :: Term -> Term Source

Introduce sharing.

updateSharedFM :: (Monad m, Applicative m, Traversable f) => (Term -> m (f Term)) -> Term -> m (f Term) Source

Typically m would be TCM and f would be Blocked.

updateSharedM :: Monad m => (Term -> m Term) -> Term -> m Term Source

Smart constructors

var :: Nat -> Term Source

An unapplied variable.

dontCare :: Term -> Term Source

Add DontCare is it is not already a DontCare.

typeDontCare :: Type Source

A dummy type.

topSort :: Type Source

Top sort (Setomega).

sSuc :: Sort -> Sort Source

Get the next higher sort.

Handling blocked terms.

Simple operations on terms and types.

stripDontCare :: Term -> Term Source

Removing a topmost DontCare constructor.

arity :: Type -> Nat Source

Doesn't do any reduction.

argName :: Type -> String Source

Suggest a name for the first argument of a function of the given type.

class Suggest a b where Source

Pick the better name suggestion, i.e., the one that is not just underscore.

Methods

suggest :: a -> b -> String Source

Instances

Eliminations.

unSpine :: Term -> Term Source

Convert top-level postfix projections into prefix projections.

hasElims :: Term -> Maybe (Elims -> Term, Elims) Source

A view distinguishing the neutrals Var, Def, and MetaV which can be projected.

argFromElim :: Elim -> Arg Term Source

Drop Apply constructor. (Unsafe!)

isApplyElim :: Elim -> Maybe (Arg Term) Source

Drop Apply constructor. (Safe)

allApplyElims :: Elims -> Maybe Args Source

Drop Apply constructors. (Safe)

splitApplyElims :: Elims -> (Args, Elims) Source

Split at first non-Apply

dropProjElims :: IsProjElim e => [e] -> [e] Source

Discard Proj f entries.

argsFromElims :: Elims -> Args Source

Discards Proj f entries.

Show instances.

Sized instances.

KillRange instances.

UniverseBi instances.