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

Safe HaskellNone
LanguageHaskell98

Agda.Syntax.Common

Contents

Description

Some common syntactic entities are defined in this module.

Synopsis

Delayed

data Delayed Source

Used to specify whether something should be delayed.

Constructors

Delayed 
NotDelayed 

Induction

Hiding

class LensHiding a where Source

A lens to access the Hiding attribute in data structures. Minimal implementation: getHiding and one of setHiding or mapHiding.

Minimal complete definition

getHiding

Methods

getHiding :: a -> Hiding Source

setHiding :: Hiding -> a -> a Source

mapHiding :: (Hiding -> Hiding) -> a -> a Source

mergeHiding :: LensHiding a => WithHiding a -> a Source

Monoidal composition of Hiding information in some data.

isHidden :: LensHiding a => a -> Bool Source

isHidden does not apply to Instance, only to Hidden.

notHidden :: LensHiding a => a -> Bool Source

Visible (NotHidden) arguments are notHidden. (DEPRECATED, use visible.)

visible :: LensHiding a => a -> Bool Source

NotHidden arguments are visible.

notVisible :: LensHiding a => a -> Bool Source

Instance and Hidden arguments are notVisible.

hide :: LensHiding a => a -> a Source

Relevance

data Big Source

An constructor argument is big if the sort of its type is bigger than the sort of the data type. Only parameters (and maybe forced arguments) are allowed to be big. List : Set -> Set nil : (A : Set) -> List A A is big in constructor nil as the sort Set1 of its type Set is bigger than the sort Set of the data type List.

Constructors

Big 
Small 

data Relevance Source

A function argument can be relevant or irrelevant. See Agda.TypeChecking.Irrelevance.

Constructors

Relevant

The argument is (possibly) relevant at compile-time.

NonStrict

The argument may never flow into evaluation position. Therefore, it is irrelevant at run-time. It is treated relevantly during equality checking.

Irrelevant

The argument is irrelevant at compile- and runtime.

Forced Big

The argument can be skipped during equality checking because its value is already determined by the type. If a constructor argument is big, it has to be regarded absent, otherwise we get into paradoxes.

UnusedArg

The polarity checker has determined that this argument is unused in the definition. It can be skipped during equality checking but should be mined for solutions of meta-variables with relevance UnusedArg

class LensRelevance a where Source

A lens to access the Relevance attribute in data structures. Minimal implementation: getRelevance and one of setRelevance or mapRelevance.

Minimal complete definition

getRelevance

moreRelevant :: Relevance -> Relevance -> Bool Source

Information ordering. Relevant `moreRelevant` UnusedArg `moreRelevant` Forced `moreRelevant` NonStrict `moreRelevant` Irrelevant

unusableRelevance :: Relevance -> Bool Source

unusableRelevance rel == True iff we cannot use a variable of rel.

composeRelevance :: Relevance -> Relevance -> Relevance Source

Relevance composition. Irrelevant is dominant, Relevant is neutral.

inverseComposeRelevance :: Relevance -> Relevance -> Relevance Source

inverseComposeRelevance r x returns the most irrelevant y such that forall x, y we have x `moreRelevant` (r `composeRelevance` y) iff (r `inverseComposeRelevance` x) `moreRelevant` y (Galois connection).

ignoreForced :: Relevance -> Relevance Source

For comparing Relevance ignoring Forced and UnusedArg.

irrToNonStrict :: Relevance -> Relevance Source

Irrelevant function arguments may appear non-strictly in the codomain type.

Argument decoration

class LensArgInfo a where Source

Minimal complete definition

getArgInfo

Methods

getArgInfo :: a -> ArgInfo Source

setArgInfo :: ArgInfo -> a -> a Source

mapArgInfo :: (ArgInfo -> ArgInfo) -> a -> a Source

Arguments

data Arg e Source

Constructors

Arg 

Fields

argInfo :: ArgInfo
 
unArg :: e
 

Instances

Functor Arg Source 
Foldable Arg Source 
Traversable Arg Source 
Decoration Arg Source 
IsPrefixOf Args Source 
UniverseBi Args Pattern 
UniverseBi Args Term 
Subst t a => Subst t (Arg a) Source 
Eq a => Eq (Arg a) Source 
Ord e => Ord (Arg e) Source 
Show a => Show (Arg a) Source 
NFData e => NFData (Arg e) Source 
KillRange a => KillRange (Arg a) Source 
SetRange a => SetRange (Arg a) Source 
HasRange a => HasRange (Arg a) Source 
LensArgInfo (Arg a) Source 
LensRelevance (Arg e) Source 
LensHiding (Arg e) Source 
ExprLike a => ExprLike (Arg a) Source 
IsProjP a => IsProjP (Arg a) Source 
SubstExpr a => SubstExpr (Arg a) Source 
AllNames a => AllNames (Arg a) Source 
ExprLike a => ExprLike (Arg a) Source 
GetDefs a => GetDefs (Arg a) Source 
TermLike a => TermLike (Arg a) Source 
Free a => Free (Arg a) Source 
KillVar a => KillVar (Arg a) Source 
GenC a => GenC (Arg a) Source 
NamesIn a => NamesIn (Arg a) Source 
IsInstantiatedMeta a => IsInstantiatedMeta (Arg a) Source 
(Reify a e, ToConcrete e c, Pretty c) => PrettyTCM (Arg a) Source 
MentionsMeta t => MentionsMeta (Arg t) Source 
ExpandPatternSynonyms a => ExpandPatternSynonyms (Arg a) Source 
InstantiateFull t => InstantiateFull (Arg t) Source 
Normalise t => Normalise (Arg t) Source 
Simplify t => Simplify (Arg t) Source 
Reduce t => Reduce (Arg t) Source 
Instantiate t => Instantiate (Arg t) Source 
Match a => Match (Arg a) Source 
SynEq a => SynEq (Arg a) Source 
Injectible a => Injectible (Arg a) Source 
Evaluate a => Evaluate (Arg a) Source 
RaiseNLP a => RaiseNLP (Arg a) Source 
ComputeOccurrences a => ComputeOccurrences (Arg a) Source 
FoldRigid a => FoldRigid (Arg a) Source 
Occurs a => Occurs (Arg a) Source 
NoProjectedVar a => NoProjectedVar (Arg a) Source 
HasPolarity a => HasPolarity (Arg a) Source 
AbsTerm a => AbsTerm (Arg a) Source 
Unquote a => Unquote (Arg a) Source 
IsFlexiblePattern a => IsFlexiblePattern (Arg a) Source 
Free' a c => Free' (Arg a) c Source 
ShrinkC a b => ShrinkC (Arg a) (Arg b) Source 
ToConcrete a c => ToConcrete (Arg a) (Arg c) Source 
ToAbstract [Arg Term] [NamedArg Expr] Source 
ToAbstract r a => ToAbstract (Arg r) (NamedArg a) Source 
Reify i a => Reify (Dom i) (Arg a) Source 
Reify i a => Reify (Arg i) (Arg a) Source

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

Match a b => Match (Arg a) (Arg b) Source 
PatternFrom a b => PatternFrom (Arg a) (Arg b) Source 
ToAbstract c a => ToAbstract (Arg c) (Arg a) Source 
LabelPatVars a b i => LabelPatVars (Arg a) (Arg b) i Source 

withArgsFrom :: [a] -> [Arg b] -> [Arg a] Source

xs `withArgsFrom` args translates xs into a list of Args, using the elements in args to fill in the non-unArg fields.

Precondition: The two lists should have equal length.

Names

Function type domain

data Dom e Source

Similar to Arg, but we need to distinguish an irrelevance annotation in a function domain (the domain itself is not irrelevant!) from an irrelevant argument.

Dom is used in Pi of internal syntax, in Context and Telescope. Arg is used for actual arguments (Var, Con, Def etc.) and in Abstract syntax and other situations.

Constructors

Dom 

Fields

domInfo :: ArgInfo
 
unDom :: e
 

Instances

Functor Dom Source 
Foldable Dom Source 
Traversable Dom Source 
Decoration Dom Source 
TeleNoAbs Telescope Source 
TeleNoAbs ListTel Source 
Abstract Telescope Source 
KillVar Telescope Source 
GenC Telescope Source 
AddContext Telescope Source 
PrettyTCM Telescope Source 
Reduce Telescope Source 
Instantiate Telescope Source 
DropArgs Telescope Source

NOTE: This creates telescopes with unbound de Bruijn indices.

ShrinkC Telescope Telescope Source 
Reify Telescope Telescope Source 
Subst t a => Subst t (Dom a) Source 
Eq e => Eq (Dom e) Source 
Ord e => Ord (Dom e) Source 
Show a => Show (Dom a) Source 
KillRange a => KillRange (Dom a) Source 
HasRange a => HasRange (Dom a) Source 
LensArgInfo (Dom e) Source 
LensRelevance (Dom e) Source 
LensHiding (Dom e) Source 
SgTel (Dom (ArgName, Type)) Source 
SgTel (Dom Type) Source 
LensSort a => LensSort (Dom a) Source 
GetDefs a => GetDefs (Dom a) Source 
TermLike a => TermLike (Dom a) Source 
Free a => Free (Dom a) Source 
KillVar a => KillVar (Dom a) Source 
GenC a => GenC (Dom a) Source 
NamesIn a => NamesIn (Dom a) Source 
AddContext (Dom (String, Type)) Source 
AddContext (Dom (Name, Type)) Source 
AddContext (Dom Type) Source 
(Reify a e, ToConcrete e c, Pretty c) => PrettyTCM (Dom a) Source 
MentionsMeta t => MentionsMeta (Dom t) Source 
InstantiateFull t => InstantiateFull (Dom t) Source 
Normalise t => Normalise (Dom t) Source 
Simplify t => Simplify (Dom t) Source 
Reduce t => Reduce (Dom t) Source 
Instantiate t => Instantiate (Dom t) Source 
SynEq a => SynEq (Dom a) Source 
RaiseNLP a => RaiseNLP (Dom a) Source 
ComputeOccurrences a => ComputeOccurrences (Dom a) Source 
FoldRigid a => FoldRigid (Dom a) Source 
Occurs a => Occurs (Dom a) Source 
HasPolarity a => HasPolarity (Dom a) Source 
AbsTerm a => AbsTerm (Dom a) Source 
Unquote a => Unquote (Dom a) Source 
Free' a c => Free' (Dom a) c Source 
ShrinkC a b => ShrinkC (Dom a) (Dom b) Source 
Reify i a => Reify (Dom i) (Arg a) Source 
Match a b => Match (Dom a) (Dom b) Source 
PatternFrom a b => PatternFrom (Dom a) (Dom b) Source 
SgTel (ArgName, Dom Type) Source 
AddContext ([WithHiding Name], Dom Type) Source 
AddContext ([Name], Dom Type) Source 
AddContext (String, Dom Type) Source 
AddContext (Name, Dom Type) Source 
ToAbstract r Expr => ToAbstract (Dom r, Name) TypedBindings Source 

Named arguments

data Named name a Source

Something potentially carrying a name.

Constructors

Named 

Fields

nameOf :: Maybe name
 
namedThing :: a
 

Instances

Subst t a => Subst t (Named name a) Source 
Functor (Named name) Source 
Show a => Show (Named_ a) Source 
Foldable (Named name) Source 
Traversable (Named name) Source 
Decoration (Named name) Source 
(Reify a e, ToConcrete e c, Pretty c) => PrettyTCM (Named_ a) Source 
ToAbstract [Arg Term] [NamedArg Expr] Source 
ToAbstract r a => ToAbstract (Arg r) (NamedArg a) Source 
(Eq name, Eq a) => Eq (Named name a) Source 
(Ord name, Ord a) => Ord (Named name a) Source 
(NFData name, NFData a) => NFData (Named name a) Source 
(KillRange name, KillRange a) => KillRange (Named name a) Source 
SetRange a => SetRange (Named name a) Source 
HasRange a => HasRange (Named name a) Source 
ExprLike a => ExprLike (Named name a) Source 
IsProjP a => IsProjP (Named n a) Source 
SubstExpr a => SubstExpr (Named name a) Source 
AllNames a => AllNames (Named name a) Source 
ExprLike a => ExprLike (Named x a) Source 
NamesIn a => NamesIn (Named n a) Source 
ExpandPatternSynonyms a => ExpandPatternSynonyms (Named n a) Source 
InstantiateFull t => InstantiateFull (Named name t) Source 
Normalise t => Normalise (Named name t) Source 
Simplify t => Simplify (Named name t) Source 
IsFlexiblePattern a => IsFlexiblePattern (Named name a) Source 
ToConcrete a c => ToConcrete (Named name a) (Named name c) Source 
ToAbstract r a => ToAbstract (Named name r) (Named name a) Source 
Reify i a => Reify (Named n i) (Named n a) Source 
ToAbstract c a => ToAbstract (Named name c) (Named name a) Source 
LabelPatVars a b i => LabelPatVars (Named x a) (Named x b) i Source 

type Named_ = Named RString Source

Standard naming.

unnamed :: a -> Named name a Source

named :: name -> a -> Named name a Source

type NamedArg a = Arg (Named_ a) Source

Only Hidden arguments can have names.

namedArg :: NamedArg a -> a Source

Get the content of a NamedArg.

updateNamedArg :: (a -> b) -> NamedArg a -> NamedArg b Source

The functor instance for NamedArg would be ambiguous, so we give it another name here.

Range decoration.

data Ranged a Source

Thing with range info.

Constructors

Ranged 

Fields

rangeOf :: Range
 
rangedThing :: a
 

unranged :: a -> Ranged a Source

Thing with no range info.

Raw names (before parsing into name parts).

type RawName = String Source

A RawName is some sort of string.

type RString = Ranged RawName Source

String with range info.

Constructor pattern info

data ConPOrigin Source

Where does the ConP of come from?

Constructors

ConPImplicit

Expanded from an implicit pattern.

ConPCon

User wrote a constructor pattern.

ConPRec

User wrote a record pattern.

Infixity, access, abstract, etc.

data IsInfix Source

Functions can be defined in both infix and prefix style. See LHS.

Constructors

InfixDef 
PrefixDef 

data Access Source

Access modifier.

Constructors

PrivateAccess 
PublicAccess 
OnlyQualified

Visible from outside, but not exported when opening the module Used for qualified constructors.

type Nat = Int Source

NameId

data NameId Source

The unique identifier of a name. Second argument is the top-level module identifier.

Constructors

NameId !Integer !Integer 

Meta variables

newtype Constr a Source

Constructors

Constr a 

Interaction meta variables

Import directive

data ImportDirective' a b Source

The things you are allowed to say when you shuffle names between name spaces (i.e. in import, namespace, or open declarations).

Constructors

ImportDirective 

Fields

importDirRange :: Range
 
using :: Using' a b
 
hiding :: [ImportedName' a b]
 
impRenaming :: [Renaming' a b]
 
publicOpen :: Bool

Only for open. Exports the opened names from the current module.

Instances

data Using' a b Source

Constructors

UseEverything 
Using [ImportedName' a b] 

Instances

(Eq a, Eq b) => Eq (Using' a b) Source 
Monoid (Using' a b) Source 
(NFData a, NFData b) => NFData (Using' a b) Source 
(KillRange a, KillRange b) => KillRange (Using' a b) Source 
(HasRange a, HasRange b) => HasRange (Using' a b) Source 

defaultImportDir :: ImportDirective' a b Source

Default is directive is private (use everything, but do not export).

data ImportedName' a b Source

An imported name can be a module or a defined name

Constructors

ImportedModule b 
ImportedName a 

Instances

data Renaming' a b Source

Constructors

Renaming 

Fields

renFrom :: ImportedName' a b

Rename from this name.

renTo :: ImportedName' a b

To this one. Must be same kind as renFrom.

renToRange :: Range

The range of the "to" keyword. Retained for highlighting purposes.

Instances

(Eq a, Eq b) => Eq (Renaming' a b) Source 
(NFData a, NFData b) => NFData (Renaming' a b) Source

Ranges are not forced.

(KillRange a, KillRange b) => KillRange (Renaming' a b) Source 
(HasRange a, HasRange b) => HasRange (Renaming' a b) Source 

HasRange instances

KillRange instances

NFData instances

Termination

data TerminationCheck m Source

Termination check? (Default = TerminationCheck).

Constructors

TerminationCheck

Run the termination checker.

NoTerminationCheck

Skip termination checking (unsafe).

NonTerminating

Treat as non-terminating.

Terminating

Treat as terminating (unsafe). Same effect as NoTerminationCheck.

TerminationMeasure Range m

Skip termination checking but use measure instead.

Positivity

type PositivityCheck = Bool Source

Positivity check? (Default = True).