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

Safe Haskell | None
Language | Haskell2010

Agda.Syntax.Internal

Contents

- Blocked Terms
- Definitions
- Explicit substitutions
- Views
- Absurd Lambda
- Pointers and Sharing
- Smart constructors
- Handling blocked terms.
- Simple operations on terms and types.
- Eliminations.
- Null instances.
- Show instances.
- Sized instances and TermSize.
- KillRange instances.
- UniverseBi instances.
- Simple pretty printing
- NFData instances

Synopsis

- type Args = [Arg Term]
- type NamedArgs = [NamedArg Term]
- data ConHead = ConHead {
  - conName :: QName
  - conInductive :: Induction
  - conFields :: [QName]
  }
- class LensConName a where
- data Term
  - = Var !Int Elims
  - | Lam ArgInfo (Abs Term)
  - | Lit Literal
  - | Def QName Elims
  - | Con ConHead ConInfo Args
  - | Pi (Dom Type) (Abs Type)
  - | Sort Sort
  - | Level Level
  - | MetaV !MetaId Elims
  - | DontCare Term
  - | Shared !(Ptr Term)
- type ConInfo = ConOrigin
- data Elim' a
  - = Apply (Arg a)
  - | Proj ProjOrigin QName
- type Elim = Elim' Term
- type Elims = [Elim]
- type ArgName = String
- argNameToString :: ArgName -> String
- stringToArgName :: String -> ArgName
- appendArgNames :: ArgName -> ArgName -> ArgName
- nameToArgName :: Name -> ArgName
- data Abs a
  - = Abs {
    - absName :: ArgName
    - unAbs :: a
    }
  - | NoAbs {
    - absName :: ArgName
    - unAbs :: a
    }
- data Type' a = El {
  - _getSort :: Sort
  - unEl :: a
  }
- type Type = Type' Term
- class LensSort a where
- data Tele a
  - = EmptyTel
  - | ExtendTel a (Abs (Tele a))
- type Telescope = Tele (Dom Type)
- mapAbsNamesM :: Applicative m => (ArgName -> m ArgName) -> Tele a -> m (Tele a)
- mapAbsNames :: (ArgName -> ArgName) -> Tele a -> Tele a
- replaceEmptyName :: ArgName -> Tele a -> Tele a
- data Sort
  - = Type Level
  - | Prop
  - | Inf
  - | SizeUniv
  - | DLub Sort (Abs Sort)
- newtype Level = Max [PlusLevel]
- data PlusLevel
  - = ClosedLevel Integer
  - | Plus Integer LevelAtom
- data LevelAtom
  - = MetaLevel MetaId Elims
  - | BlockedLevel MetaId Term
  - | NeutralLevel NotBlocked Term
  - | UnreducedLevel Term
- data NotBlocked
  - = StuckOn Elim
  - | Underapplied
  - | AbsurdMatch
  - | MissingClauses
  - | ReallyNotBlocked
- data Blocked t
  - = Blocked {
    - theBlockingMeta :: MetaId
    - ignoreBlocking :: t
    }
  - | NotBlocked {
    - blockingStatus :: NotBlocked
    - ignoreBlocking :: t
    }
- type Blocked_ = Blocked ()
- stuckOn :: Elim -> NotBlocked -> NotBlocked
- data Clause = Clause {
  - clauseRange :: Range
  - clauseTel :: Telescope
  - namedClausePats :: [NamedArg DeBruijnPattern]
  - clauseBody :: Maybe Term
  - clauseType :: Maybe (Arg Type)
  - clauseCatchall :: Bool
  }
- clausePats :: Clause -> [Arg DeBruijnPattern]
- type PatVarName = ArgName
- patVarNameToString :: PatVarName -> String
- nameToPatVarName :: Name -> PatVarName
- data Pattern' x
  - = VarP x
  - | DotP Term
  - | ConP ConHead ConPatternInfo [NamedArg (Pattern' x)]
  - | LitP Literal
  - | ProjP ProjOrigin QName
- type Pattern = Pattern' PatVarName
- varP :: ArgName -> Pattern
- data DBPatVar = DBPatVar {
  - dbPatVarName :: PatVarName
  - dbPatVarIndex :: Int
  }
- type DeBruijnPattern = Pattern' DBPatVar
- namedVarP :: PatVarName -> Named_ Pattern
- namedDBVarP :: Int -> PatVarName -> Named_ DeBruijnPattern
- data ConPatternInfo = ConPatternInfo {
  - conPRecord :: Maybe ConOrigin
  - conPType :: Maybe (Arg Type)
  }
- noConPatternInfo :: ConPatternInfo
- toConPatternInfo :: ConInfo -> ConPatternInfo
- fromConPatternInfo :: ConPatternInfo -> ConInfo
- patternVars :: Arg (Pattern' a) -> [Arg (Either a Term)]
- properlyMatching :: DeBruijnPattern -> Bool
- data Substitution' a
  - = IdS
  - | EmptyS
  - | a :# (Substitution' a)
  - | Strengthen Empty (Substitution' a)
  - | Wk !Int (Substitution' a)
  - | Lift !Int (Substitution' a)
- type Substitution = Substitution' Term
- type PatternSubstitution = Substitution' DeBruijnPattern
- data EqualityView
  - = EqualityType {
    - eqtSort :: Sort
    - eqtName :: QName
    - eqtLevel :: Arg Term
    - eqtType :: Arg Term
    - eqtLhs :: Arg Term
    - eqtRhs :: Arg Term
    }
  - | OtherType Type
- isEqualityType :: EqualityView -> Bool
- absurdBody :: Abs Term
- isAbsurdBody :: Abs Term -> Bool
- absurdPatternName :: PatVarName
- isAbsurdPatternName :: PatVarName -> Bool
- ignoreSharing :: Term -> Term
- ignoreSharingType :: Type -> Type
- shared_ :: Term -> Term
- updateSharedFM :: (Monad m, Traversable f) => (Term -> m (f Term)) -> Term -> m (f Term)
- updateSharedM :: Monad m => (Term -> m Term) -> Term -> m Term
- updateShared :: (Term -> Term) -> Term -> Term
- pointerChain :: Term -> [Ptr Term]
- compressPointerChain :: Term -> Term
- var :: Nat -> Term
- dontCare :: Term -> Term
- typeDontCare :: Type
- topSort :: Type
- sort :: Sort -> Type
- varSort :: Int -> Sort
- sSuc :: Sort -> Sort
- levelSuc :: Level -> Level
- mkType :: Integer -> Sort
- impossibleTerm :: String -> Int -> Term
- class SgTel a where
- hackReifyToMeta :: Term
- isHackReifyToMeta :: Term -> Bool
- blockingMeta :: Blocked t -> Maybe MetaId
- blocked :: MetaId -> a -> Blocked a
- notBlocked :: a -> Blocked a
- stripDontCare :: Term -> Term
- arity :: Type -> Nat
- notInScopeName :: ArgName -> ArgName
- class Suggest a b where
- unSpine :: Term -> Term
- unSpine' :: (ProjOrigin -> Bool) -> Term -> Term
- hasElims :: Term -> Maybe (Elims -> Term, Elims)
- argFromElim :: Elim' a -> Arg a
- isApplyElim :: Elim' a -> Maybe (Arg a)
- allApplyElims :: [Elim' a] -> Maybe [Arg a]
- splitApplyElims :: [Elim' a] -> ([Arg a], [Elim' a])
- class IsProjElim e where
- dropProjElims :: IsProjElim e => [e] -> [e]
- argsFromElims :: Elims -> Args
- allProjElims :: Elims -> Maybe [(ProjOrigin, QName)]
- class TermSize a where
- pDom :: LensHiding a => a -> Doc -> Doc
- module Agda.Syntax.Abstract.Name
- module Agda.Utils.Pointer
- newtype MetaId = MetaId {
  - metaId :: Nat
  }

# Documentation

type Args = [Arg Term] #

Type of argument lists.

type NamedArgs = [NamedArg Term] #

data ConHead #

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. conInductive :: Induction Record constructors can be coinductive. 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.

Instances

Eq ConHead # |
Methods (==) :: ConHead -> ConHead -> Bool # (/=) :: ConHead -> ConHead -> Bool #
Ord ConHead # |
Methods compare :: ConHead -> ConHead -> Ordering # (<) :: ConHead -> ConHead -> Bool # (<=) :: ConHead -> ConHead -> Bool # (>) :: ConHead -> ConHead -> Bool # (>=) :: ConHead -> ConHead -> Bool # max :: ConHead -> ConHead -> ConHead # min :: ConHead -> ConHead -> ConHead #
Show ConHead # |
Methods showsPrec :: Int -> ConHead -> ShowS # show :: ConHead -> String # showList :: [ConHead] -> ShowS #
KillRange ConHead # |
Methods killRange :: KillRangeT ConHead #
SetRange ConHead # |
Methods setRange :: Range -> ConHead -> ConHead #
HasRange ConHead # |
Methods getRange :: ConHead -> Range #
LensConName ConHead # |
Methods getConName :: ConHead -> QName # setConName :: QName -> ConHead -> ConHead # mapConName :: (QName -> QName) -> ConHead -> ConHead #
NamesIn ConHead # |
Methods namesIn :: ConHead -> Set QName #
PrettyTCM ConHead # |
Methods prettyTCM :: ConHead -> TCM Doc #

class LensConName a where #

Minimal complete definition

getConName

Methods

getConName :: a -> QName #

setConName :: QName -> a -> a #

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

Instances

LensConName ConHead # |
Methods getConName :: ConHead -> QName # setConName :: QName -> ConHead -> ConHead # mapConName :: (QName -> QName) -> ConHead -> ConHead #

data Term #

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 ConInfo Args | `c vs` or `record { fs = 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

Show Term # |
Methods showsPrec :: Int -> Term -> ShowS # show :: Term -> String # showList :: [Term] -> ShowS #
NFData Type # |
Methods rnf :: Type -> () #
NFData Term # |
Methods rnf :: Term -> () #
Pretty Type # |
Methods pretty :: Type -> Doc # prettyPrec :: Int -> Type -> Doc #
Pretty Elim # |
Methods pretty :: Elim -> Doc # prettyPrec :: Int -> Elim -> Doc #
Pretty Term # |
Methods pretty :: Term -> Doc # prettyPrec :: Int -> Term -> Doc #
KillRange Substitution # |
Methods killRange :: KillRangeT Substitution #
KillRange Term # |
Methods killRange :: KillRangeT Term #
TermSize Term # |
Methods termSize :: Term -> Int # tsize :: Term -> Sum Int #
IsProjElim Elim # |
Methods isProjElim :: Elim -> Maybe (ProjOrigin, QName) #
GetDefs Type # |
Methods getDefs :: MonadGetDefs m => Type -> m () #
GetDefs Term # |
Methods getDefs :: MonadGetDefs m => Term -> m () #
TermLike Type # |
Methods traverseTerm :: (Term -> Term) -> Type -> Type # traverseTermM :: Monad m => (Term -> m Term) -> Type -> m Type # foldTerm :: Monoid m => (Term -> m) -> Type -> m #
TermLike Term # |
Methods traverseTerm :: (Term -> Term) -> Term -> Term # traverseTermM :: Monad m => (Term -> m Term) -> Term -> m Term # foldTerm :: Monoid m => (Term -> m) -> Term -> m #
Free Type # |
Methods freeVars' :: Type -> FreeT
Free Term # |
Methods freeVars' :: Term -> FreeT
DeBruijn Term # | We can substitute `Term`s for variables.
Methods deBruijnVar :: Int -> Term # debruijnNamedVar :: String -> Int -> Term # deBruijnView :: Term -> Maybe Int #
NamesIn Term # |
Methods namesIn :: Term -> Set QName #
TeleNoAbs Telescope # |
Methods teleNoAbs :: Telescope -> Term -> Term #
TeleNoAbs ListTel # |
Methods teleNoAbs :: ListTel -> Term -> Term #
AddContext Telescope # |
Methods addContext :: MonadTCM tcm => Telescope -> tcm a -> tcm a # contextSize :: Telescope -> Nat #
UnFreezeMeta Type # |
Methods unfreezeMeta :: Type -> TCM () #
UnFreezeMeta Term # |
Methods unfreezeMeta :: Term -> TCM () #
IsInstantiatedMeta Term # |
Methods isInstantiatedMeta :: Term -> TCM Bool #
IsSizeType Term # |
Methods isSizeType :: Term -> TCM (Maybe BoundedSize) #
DropArgs Telescope # | NOTE: This creates telescopes with unbound de Bruijn indices.
Methods dropArgs :: Int -> Telescope -> Telescope #
MentionsMeta Type # |
Methods mentionsMeta :: MetaId -> Type -> Bool #
MentionsMeta Elim # |
Methods mentionsMeta :: MetaId -> Elim -> Bool #
MentionsMeta Term # |
Methods mentionsMeta :: MetaId -> Term -> Bool #
PrettyTCM Telescope # |
Methods prettyTCM :: Telescope -> TCM Doc #
PrettyTCM Type # |
Methods prettyTCM :: Type -> TCM Doc #
PrettyTCM Elim # |
Methods prettyTCM :: Elim -> TCM Doc #
PrettyTCM Term # |
Methods prettyTCM :: Term -> TCM Doc #
InstantiateFull Substitution # |
Methods instantiateFull' :: Substitution -> ReduceM Substitution #
InstantiateFull Term # |
Methods instantiateFull' :: Term -> ReduceM Term #
Normalise Type # |
Methods normalise' :: Type -> ReduceM Type #
Normalise Elim # |
Methods normalise' :: Elim -> ReduceM Elim #
Normalise Term # |
Methods normalise' :: Term -> ReduceM Term #
Simplify Type # |
Methods simplify' :: Type -> ReduceM Type #
Simplify Elim # |
Methods simplify' :: Elim -> ReduceM Elim #
Simplify Term # |
Methods simplify' :: Term -> ReduceM Term #
Reduce Telescope # |
Methods reduce' :: Telescope -> ReduceM Telescope # reduceB' :: Telescope -> ReduceM (Blocked Telescope) #
Reduce Type # |
Methods reduce' :: Type -> ReduceM Type # reduceB' :: Type -> ReduceM (Blocked Type) #
Reduce Elim # |
Methods reduce' :: Elim -> ReduceM Elim # reduceB' :: Elim -> ReduceM (Blocked Elim) #
Reduce Term # |
Methods reduce' :: Term -> ReduceM Term # reduceB' :: Term -> ReduceM (Blocked Term) #
Instantiate Telescope # |
Methods instantiate' :: Telescope -> ReduceM Telescope #
Instantiate Type # |
Methods instantiate' :: Type -> ReduceM Type #
Instantiate Elim # |
Methods instantiate' :: Elim -> ReduceM Elim #
Instantiate Term # |
Methods instantiate' :: Term -> ReduceM Term #
Match Term # |
Methods match :: Term -> Term -> MaybeT TCM [Term] #
SynEq Type # | Syntactic equality ignores sorts.
Methods synEq :: Type -> Type -> SynEqM (Type, Type) synEq' :: Type -> Type -> SynEqM (Type, Type)
SynEq Term # | Syntactic term equality ignores `DontCare` stuff.
Methods synEq :: Term -> Term -> SynEqM (Term, Term) synEq' :: Term -> Term -> SynEqM (Term, Term)
Injectible Term # |
Methods (<:) :: Term -> Term -> ReaderT * (Map QName InjectiveFun) (Compile TCM) InjConstraints #
Evaluate Term # |
Methods evaluate :: Term -> Compile TCM Term #
HasPolarity Type # |
Methods polarities :: Nat -> Type -> TCM [Polarity] #
HasPolarity Term # |
Methods polarities :: Nat -> Term -> TCM [Polarity] #
FoldRigid Type # |
Methods foldRigid :: Monoid (TCM m) => (Nat -> TCM m) -> Type -> TCM m #
FoldRigid Term # |
Methods foldRigid :: Monoid (TCM m) => (Nat -> TCM m) -> Term -> TCM m #
Occurs Type # |
Methods occurs :: UnfoldStrategy -> OccursCtx -> MetaId -> Vars -> Type -> TCM Type # metaOccurs :: MetaId -> Type -> TCM () #
Occurs Term # |
Methods occurs :: UnfoldStrategy -> OccursCtx -> MetaId -> Vars -> Term -> TCM Term # metaOccurs :: MetaId -> Term -> TCM () #
ComputeOccurrences Type # |
Methods occurrences :: Type -> OccM OccurrencesBuilder #
ComputeOccurrences Term # |
Methods occurrences :: Term -> OccM OccurrencesBuilder #
ToTerm Type # |
Methods toTerm :: TCM (Type -> Term) # toTermR :: TCM (Type -> ReduceM Term) #
ToTerm Term # |
Methods toTerm :: TCM (Term -> Term) # toTermR :: TCM (Term -> ReduceM Term) #
PrimTerm Type # |
Methods primTerm :: Type -> TCM Term #
NoProjectedVar Term # |
Methods noProjectedVar :: Term -> Either ProjVarExc () #
AbsTerm Type # |
Methods absTerm :: Term -> Type -> Type #
AbsTerm Term # |
Methods absTerm :: Term -> Term -> Term #
IsPrefixOf Elims # |
Methods isPrefixOf :: Elims -> Elims -> Maybe Elims #
IsPrefixOf Term # |
Methods isPrefixOf :: Term -> Term -> Maybe Elims #
IsPrefixOf Args # |
Methods isPrefixOf :: Args -> Args -> Maybe Elims #
ForcedVariables Term # | Assumes that the term is in normal form.
Methods forcedVariables :: Term -> [Nat] #
UniverseBi Elims Pattern # |
Methods universeBi :: Elims -> [Pattern] #
UniverseBi Elims Term # |
Methods universeBi :: Elims -> [Term] #
UniverseBi Args Pattern # |
Methods universeBi :: Args -> [Pattern] #
UniverseBi Args Term # |
Methods universeBi :: Args -> [Term] #
Free' Term c # |
Methods freeVars' :: Term -> FreeM c #
Subst Term AsBinding # |
Methods applySubst :: Substitution' Term -> AsBinding -> AsBinding #
Subst Term DotPatternInst # |
Methods applySubst :: Substitution' Term -> DotPatternInst -> DotPatternInst #
Subst Term ProblemRest # |
Methods applySubst :: Substitution' Term -> ProblemRest -> ProblemRest #
Subst Term SizeConstraint # |
Methods applySubst :: Substitution' Term -> SizeConstraint -> SizeConstraint #
Subst Term SizeMeta # |
Methods applySubst :: Substitution' Term -> SizeMeta -> SizeMeta #
Reify Telescope Telescope # |
Methods reify :: Telescope -> TCM Telescope # reifyWhen :: Bool -> Telescope -> TCM Telescope #
Reify Type Expr # |
Methods reify :: Type -> TCM Expr # reifyWhen :: Bool -> Type -> TCM Expr #
Reify Term Expr # |
Methods reify :: Term -> TCM Expr # reifyWhen :: Bool -> Term -> TCM Expr #
Match NLPType Type # |
Methods match :: Relevance -> Telescope -> Telescope -> NLPType -> Type -> NLM () #
Match NLPat Term # |
Methods match :: Relevance -> Telescope -> Telescope -> NLPat -> Term -> NLM () #
PatternFrom Type NLPType # |
Methods patternFrom :: Relevance -> Int -> Type -> TCM NLPType #
PatternFrom Term NLPat # |
Methods patternFrom :: Relevance -> Int -> Term -> TCM NLPat #
Subst Term (Problem' p) # |
Methods applySubst :: Substitution' Term -> Problem' p -> Problem' p #
Subst Term (SizeExpr' NamedRigid SizeMeta) # | Only for `raise`.
Methods applySubst :: Substitution' Term -> SizeExpr' NamedRigid SizeMeta -> SizeExpr' NamedRigid SizeMeta #
SgTel (Dom (ArgName, Type)) # |
Methods sgTel :: Dom (ArgName, Type) -> Telescope #
SgTel (Dom Type) # |
Methods sgTel :: Dom Type -> Telescope #
AddContext (Dom (String, Type)) # |
Methods addContext :: MonadTCM tcm => Dom (String, Type) -> tcm a -> tcm a # contextSize :: Dom (String, Type) -> Nat #
AddContext (Dom (Name, Type)) # |
Methods addContext :: MonadTCM tcm => Dom (Name, Type) -> tcm a -> tcm a # contextSize :: Dom (Name, Type) -> Nat #
AddContext (Dom Type) # |
Methods addContext :: MonadTCM tcm => Dom Type -> tcm a -> tcm a # contextSize :: Dom Type -> Nat #
UniverseBi [Term] Term # |
Methods universeBi :: [Term] -> [Term] #
SgTel (ArgName, Dom Type) # |
Methods sgTel :: (ArgName, Dom Type) -> Telescope #
AddContext ([WithHiding Name], Dom Type) # |
Methods addContext :: MonadTCM tcm => ([WithHiding Name], Dom Type) -> tcm a -> tcm a # contextSize :: ([WithHiding Name], Dom Type) -> Nat #
AddContext ([Name], Dom Type) # |
Methods addContext :: MonadTCM tcm => ([Name], Dom Type) -> tcm a -> tcm a # contextSize :: ([Name], Dom Type) -> Nat #
AddContext (String, Dom Type) # |
Methods addContext :: MonadTCM tcm => (String, Dom Type) -> tcm a -> tcm a # contextSize :: (String, Dom Type) -> Nat #
AddContext (Name, Dom Type) # |
Methods addContext :: MonadTCM tcm => (Name, Dom Type) -> tcm a -> tcm a # contextSize :: (Name, Dom Type) -> Nat #
UniverseBi ([Type], [Clause]) Pattern # |
Methods universeBi :: ([Type], [Clause]) -> [Pattern] #
UniverseBi ([Type], [Clause]) Term # |
Methods universeBi :: ([Type], [Clause]) -> [Term] #

type ConInfo = ConOrigin #

data Elim' a #

Eliminations, subsuming applications and projections.

Constructors

Apply (Arg a) | Application.
Proj ProjOrigin QName | Projection. `QName` is name of a record projection.

Instances

Functor Elim' # |
Methods fmap :: (a -> b) -> Elim' a -> Elim' b # (<$) :: a -> Elim' b -> Elim' a #
Foldable Elim' # |
Methods fold :: Monoid m => Elim' m -> m # foldMap :: Monoid m => (a -> m) -> Elim' a -> m # foldr :: (a -> b -> b) -> b -> Elim' a -> b # foldr' :: (a -> b -> b) -> b -> Elim' a -> b # foldl :: (b -> a -> b) -> b -> Elim' a -> b # foldl' :: (b -> a -> b) -> b -> Elim' a -> b # foldr1 :: (a -> a -> a) -> Elim' a -> a # foldl1 :: (a -> a -> a) -> Elim' a -> a # toList :: Elim' a -> [a] # null :: Elim' a -> Bool # length :: Elim' a -> Int # elem :: Eq a => a -> Elim' a -> Bool # maximum :: Ord a => Elim' a -> a # minimum :: Ord a => Elim' a -> a # sum :: Num a => Elim' a -> a # product :: Num a => Elim' a -> a #
Traversable Elim' # |
Methods traverse :: Applicative f => (a -> f b) -> Elim' a -> f (Elim' b) # sequenceA :: Applicative f => Elim' (f a) -> f (Elim' a) # mapM :: Monad m => (a -> m b) -> Elim' a -> m (Elim' b) # sequence :: Monad m => Elim' (m a) -> m (Elim' a) #
Pretty Elim # |
Methods pretty :: Elim -> Doc # prettyPrec :: Int -> Elim -> Doc #
IsProjElim Elim # |
Methods isProjElim :: Elim -> Maybe (ProjOrigin, QName) #
MentionsMeta Elim # |
Methods mentionsMeta :: MetaId -> Elim -> Bool #
PrettyTCM Elim # |
Methods prettyTCM :: Elim -> TCM Doc #
Normalise Elim # |
Methods normalise' :: Elim -> ReduceM Elim #
Simplify Elim # |
Methods simplify' :: Elim -> ReduceM Elim #
Reduce Elim # |
Methods reduce' :: Elim -> ReduceM Elim # reduceB' :: Elim -> ReduceM (Blocked Elim) #
Instantiate Elim # |
Methods instantiate' :: Elim -> ReduceM Elim #
IsPrefixOf Elims # |
Methods isPrefixOf :: Elims -> Elims -> Maybe Elims #
UniverseBi Elims Pattern # |
Methods universeBi :: Elims -> [Pattern] #
UniverseBi Elims Term # |
Methods universeBi :: Elims -> [Term] #
Show a => Show (Elim' a) # |
Methods showsPrec :: Int -> Elim' a -> ShowS # show :: Elim' a -> String # showList :: [Elim' a] -> ShowS #
NFData a => NFData (Elim' a) # |
Methods rnf :: Elim' a -> () #
KillRange a => KillRange (Elim' a) # |
Methods killRange :: KillRangeT (Elim' a) #
GetDefs a => GetDefs (Elim' a) # |
Methods getDefs :: MonadGetDefs m => Elim' a -> m () #
TermLike a => TermLike (Elim' a) # |
Methods traverseTerm :: (Term -> Term) -> Elim' a -> Elim' a # traverseTermM :: Monad m => (Term -> m Term) -> Elim' a -> m (Elim' a) # foldTerm :: Monoid m => (Term -> m) -> Elim' a -> m #
Free a => Free (Elim' a) # |
Methods freeVars' :: Elim' a -> FreeT
NamesIn a => NamesIn (Elim' a) # |
Methods namesIn :: Elim' a -> Set QName #
PrettyTCM (Elim' NLPat) # |
Methods prettyTCM :: Elim' NLPat -> TCM Doc #
PrettyTCM (Elim' DisplayTerm) # |
Methods prettyTCM :: Elim' DisplayTerm -> TCM Doc #
InstantiateFull a => InstantiateFull (Elim' a) # |
Methods instantiateFull' :: Elim' a -> ReduceM (Elim' a) #
Match a => Match (Elim' a) # |
Methods match :: Elim' a -> Elim' a -> MaybeT TCM [Term] #
SynEq a => SynEq (Elim' a) # |
Methods synEq :: Elim' a -> Elim' a -> SynEqM (Elim' a, Elim' a) synEq' :: Elim' a -> Elim' a -> SynEqM (Elim' a, Elim' a)
Injectible a => Injectible (Elim' a) # |
Methods (<:) :: Elim' a -> Elim' a -> ReaderT * (Map QName InjectiveFun) (Compile TCM) InjConstraints #
Evaluate a => Evaluate (Elim' a) # |
Methods evaluate :: Elim' a -> Compile TCM (Elim' a) #
HasPolarity a => HasPolarity (Elim' a) # |
Methods polarities :: Nat -> Elim' a -> TCM [Polarity] #
FoldRigid a => FoldRigid (Elim' a) # |
Methods foldRigid :: Monoid (TCM m) => (Nat -> TCM m) -> Elim' a -> TCM m #
Occurs a => Occurs (Elim' a) # |
Methods occurs :: UnfoldStrategy -> OccursCtx -> MetaId -> Vars -> Elim' a -> TCM (Elim' a) # metaOccurs :: MetaId -> Elim' a -> TCM () #
ComputeOccurrences a => ComputeOccurrences (Elim' a) # |
Methods occurrences :: Elim' a -> OccM OccurrencesBuilder #
RaiseNLP a => RaiseNLP (Elim' a) # |
Methods raiseNLPFrom :: Int -> Int -> Elim' a -> Elim' a # raiseNLP :: Int -> Elim' a -> Elim' a #
AbsTerm a => AbsTerm (Elim' a) # |
Methods absTerm :: Term -> Elim' a -> Elim' a #
Free' a c => Free' (Elim' a) c # |
Methods freeVars' :: Elim' a -> FreeM c #
Reify i a => Reify (Elim' i) (Elim' a) # |
Methods reify :: Elim' i -> TCM (Elim' a) # reifyWhen :: Bool -> Elim' i -> TCM (Elim' a) #
Match a b => Match (Elim' a) (Elim' b) # |
Methods match :: Relevance -> Telescope -> Telescope -> Elim' a -> Elim' b -> NLM () #
PatternFrom a NLPat => PatternFrom (Elim' a) (Elim' NLPat) # |
Methods patternFrom :: Relevance -> Int -> Elim' a -> TCM (Elim' NLPat) #

type Elim = Elim' Term #

type Elims #

Arguments

= [Elim] | eliminations ordered left-to-right.

type ArgName = String #

Names in binders and arguments.

argNameToString :: ArgName -> String #

stringToArgName :: String -> ArgName #

appendArgNames :: ArgName -> ArgName -> ArgName #

nameToArgName :: Name -> ArgName #

data Abs a #

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 # |
Methods fmap :: (a -> b) -> Abs a -> Abs b # (<$) :: a -> Abs b -> Abs a #
Foldable Abs # |
Methods fold :: Monoid m => Abs m -> m # foldMap :: Monoid m => (a -> m) -> Abs a -> m # foldr :: (a -> b -> b) -> b -> Abs a -> b # foldr' :: (a -> b -> b) -> b -> Abs a -> b # foldl :: (b -> a -> b) -> b -> Abs a -> b # foldl' :: (b -> a -> b) -> b -> Abs a -> b # foldr1 :: (a -> a -> a) -> Abs a -> a # foldl1 :: (a -> a -> a) -> Abs a -> a # toList :: Abs a -> [a] # null :: Abs a -> Bool # length :: Abs a -> Int # elem :: Eq a => a -> Abs a -> Bool # maximum :: Ord a => Abs a -> a # minimum :: Ord a => Abs a -> a # sum :: Num a => Abs a -> a # product :: Num a => Abs a -> a #
Traversable Abs # |
Methods traverse :: Applicative f => (a -> f b) -> Abs a -> f (Abs b) # sequenceA :: Applicative f => Abs (f a) -> f (Abs a) # mapM :: Monad m => (a -> m b) -> Abs a -> m (Abs b) # sequence :: Monad m => Abs (m a) -> m (Abs a) #
Decoration Abs # |
Methods traverseF :: Functor m => (a -> m b) -> Abs a -> m (Abs b) # distributeF :: Functor m => Abs (m a) -> m (Abs a) #
Suggest String (Abs b) # |
Methods suggest :: String -> Abs b -> String #
Suggest Name (Abs b) # |
Methods suggest :: Name -> Abs b -> String #
Show a => Show (Abs a) # |
Methods showsPrec :: Int -> Abs a -> ShowS # show :: Abs a -> String # showList :: [Abs a] -> ShowS #
Sized a => Sized (Abs a) # |
Methods size :: Integral n => Abs a -> n #
KillRange a => KillRange (Abs a) # |
Methods killRange :: KillRangeT (Abs a) #
LensSort a => LensSort (Abs a) # |
Methods lensSort :: Lens' Sort (Abs a) # getSort :: Abs a -> Sort #
GetDefs a => GetDefs (Abs a) # |
Methods getDefs :: MonadGetDefs m => Abs a -> m () #
TermLike a => TermLike (Abs a) # |
Methods traverseTerm :: (Term -> Term) -> Abs a -> Abs a # traverseTermM :: Monad m => (Term -> m Term) -> Abs a -> m (Abs a) # foldTerm :: Monoid m => (Term -> m) -> Abs a -> m #
Free a => Free (Abs a) # |
Methods freeVars' :: Abs a -> FreeT
NamesIn a => NamesIn (Abs a) # |
Methods namesIn :: Abs a -> Set QName #
UnFreezeMeta a => UnFreezeMeta (Abs a) # |
Methods unfreezeMeta :: Abs a -> TCM () #
IsInstantiatedMeta a => IsInstantiatedMeta (Abs a) # | Does not worry about raising.
Methods isInstantiatedMeta :: Abs a -> TCM Bool #
MentionsMeta t => MentionsMeta (Abs t) # |
Methods mentionsMeta :: MetaId -> Abs t -> Bool #
(Subst t a, InstantiateFull a) => InstantiateFull (Abs a) # |
Methods instantiateFull' :: Abs a -> ReduceM (Abs a) #
(Subst t a, Normalise a) => Normalise (Abs a) # |
Methods normalise' :: Abs a -> ReduceM (Abs a) #
(Subst t a, Simplify a) => Simplify (Abs a) # |
Methods simplify' :: Abs a -> ReduceM (Abs a) #
(Subst t a, Reduce a) => Reduce (Abs a) # |
Methods reduce' :: Abs a -> ReduceM (Abs a) # reduceB' :: Abs a -> ReduceM (Blocked (Abs a)) #
Instantiate t => Instantiate (Abs t) # |
Methods instantiate' :: Abs t -> ReduceM (Abs t) #
(Subst t a, SynEq a) => SynEq (Abs a) # |
Methods synEq :: Abs a -> Abs a -> SynEqM (Abs a, Abs a) synEq' :: Abs a -> Abs a -> SynEqM (Abs a, Abs a)
Evaluate a => Evaluate (Abs a) # |
Methods evaluate :: Abs a -> Compile TCM (Abs a) #
HasPolarity a => HasPolarity (Abs a) # |
Methods polarities :: Nat -> Abs a -> TCM [Polarity] #
(Subst t a, FoldRigid a) => FoldRigid (Abs a) # |
Methods foldRigid :: Monoid (TCM m) => (Nat -> TCM m) -> Abs a -> TCM m #
(Occurs a, Subst t a) => Occurs (Abs a) # |
Methods occurs :: UnfoldStrategy -> OccursCtx -> MetaId -> Vars -> Abs a -> TCM (Abs a) # metaOccurs :: MetaId -> Abs a -> TCM () #
ComputeOccurrences a => ComputeOccurrences (Abs a) # |
Methods occurrences :: Abs a -> OccM OccurrencesBuilder #
RaiseNLP a => RaiseNLP (Abs a) # |
Methods raiseNLPFrom :: Int -> Int -> Abs a -> Abs a # raiseNLP :: Int -> Abs a -> Abs a #
(Subst Term a, AbsTerm a) => AbsTerm (Abs a) # |
Methods absTerm :: Term -> Abs a -> Abs a #
Free' a c => Free' (Abs a) c # |
Methods freeVars' :: Abs a -> FreeM c #
Suggest (Abs a) (Abs b) # |
Methods suggest :: Abs a -> Abs b -> String #
(Match a b, RaiseNLP a, Subst t2 b) => Match (Abs a) (Abs b) # |
Methods match :: Relevance -> Telescope -> Telescope -> Abs a -> Abs b -> NLM () #
PatternFrom a b => PatternFrom (Abs a) (Abs b) # |
Methods patternFrom :: Relevance -> Int -> Abs a -> TCM (Abs b) #
(Free i, Reify i a) => Reify (Abs i) (Name, a) # |
Methods reify :: Abs i -> TCM (Name, a) # reifyWhen :: Bool -> Abs i -> TCM (Name, a) #

data Type' a #

Types are terms with a sort annotation.

Constructors

El |
Fields _getSort :: Sort unEl :: a

Instances

Functor Type' # |
Methods fmap :: (a -> b) -> Type' a -> Type' b # (<$) :: a -> Type' b -> Type' a #
Foldable Type' # |
Methods fold :: Monoid m => Type' m -> m # foldMap :: Monoid m => (a -> m) -> Type' a -> m # foldr :: (a -> b -> b) -> b -> Type' a -> b # foldr' :: (a -> b -> b) -> b -> Type' a -> b # foldl :: (b -> a -> b) -> b -> Type' a -> b # foldl' :: (b -> a -> b) -> b -> Type' a -> b # foldr1 :: (a -> a -> a) -> Type' a -> a # foldl1 :: (a -> a -> a) -> Type' a -> a # toList :: Type' a -> [a] # null :: Type' a -> Bool # length :: Type' a -> Int # elem :: Eq a => a -> Type' a -> Bool # maximum :: Ord a => Type' a -> a # minimum :: Ord a => Type' a -> a # sum :: Num a => Type' a -> a # product :: Num a => Type' a -> a #
Traversable Type' # |
Methods traverse :: Applicative f => (a -> f b) -> Type' a -> f (Type' b) # sequenceA :: Applicative f => Type' (f a) -> f (Type' a) # mapM :: Monad m => (a -> m b) -> Type' a -> m (Type' b) # sequence :: Monad m => Type' (m a) -> m (Type' a) #
NFData Type # |
Methods rnf :: Type -> () #
Pretty Type # |
Methods pretty :: Type -> Doc # prettyPrec :: Int -> Type -> Doc #
Decoration Type' # |
Methods traverseF :: Functor m => (a -> m b) -> Type' a -> m (Type' b) # distributeF :: Functor m => Type' (m a) -> m (Type' a) #
GetDefs Type # |
Methods getDefs :: MonadGetDefs m => Type -> m () #
TermLike Type # |
Methods traverseTerm :: (Term -> Term) -> Type -> Type # traverseTermM :: Monad m => (Term -> m Term) -> Type -> m Type # foldTerm :: Monoid m => (Term -> m) -> Type -> m #
Free Type # |
Methods freeVars' :: Type -> FreeT
TeleNoAbs Telescope # |
Methods teleNoAbs :: Telescope -> Term -> Term #
TeleNoAbs ListTel # |
Methods teleNoAbs :: ListTel -> Term -> Term #
AddContext Telescope # |
Methods addContext :: MonadTCM tcm => Telescope -> tcm a -> tcm a # contextSize :: Telescope -> Nat #
UnFreezeMeta Type # |
Methods unfreezeMeta :: Type -> TCM () #
DropArgs Telescope # | NOTE: This creates telescopes with unbound de Bruijn indices.
Methods dropArgs :: Int -> Telescope -> Telescope #
MentionsMeta Type # |
Methods mentionsMeta :: MetaId -> Type -> Bool #
PrettyTCM Telescope # |
Methods prettyTCM :: Telescope -> TCM Doc #
PrettyTCM Type # |
Methods prettyTCM :: Type -> TCM Doc #
Normalise Type # |
Methods normalise' :: Type -> ReduceM Type #
Simplify Type # |
Methods simplify' :: Type -> ReduceM Type #
Reduce Telescope # |
Methods reduce' :: Telescope -> ReduceM Telescope # reduceB' :: Telescope -> ReduceM (Blocked Telescope) #
Reduce Type # |
Methods reduce' :: Type -> ReduceM Type # reduceB' :: Type -> ReduceM (Blocked Type) #
Instantiate Telescope # |
Methods instantiate' :: Telescope -> ReduceM Telescope #
Instantiate Type # |
Methods instantiate' :: Type -> ReduceM Type #
SynEq Type # | Syntactic equality ignores sorts.
Methods synEq :: Type -> Type -> SynEqM (Type, Type) synEq' :: Type -> Type -> SynEqM (Type, Type)
HasPolarity Type # |
Methods polarities :: Nat -> Type -> TCM [Polarity] #
FoldRigid Type # |
Methods foldRigid :: Monoid (TCM m) => (Nat -> TCM m) -> Type -> TCM m #
Occurs Type # |
Methods occurs :: UnfoldStrategy -> OccursCtx -> MetaId -> Vars -> Type -> TCM Type # metaOccurs :: MetaId -> Type -> TCM () #
ComputeOccurrences Type # |
Methods occurrences :: Type -> OccM OccurrencesBuilder #
ToTerm Type # |
Methods toTerm :: TCM (Type -> Term) # toTermR :: TCM (Type -> ReduceM Term) #
PrimTerm Type # |
Methods primTerm :: Type -> TCM Term #
AbsTerm Type # |
Methods absTerm :: Term -> Type -> Type #
Reify Telescope Telescope # |
Methods reify :: Telescope -> TCM Telescope # reifyWhen :: Bool -> Telescope -> TCM Telescope #
Reify Type Expr # |
Methods reify :: Type -> TCM Expr # reifyWhen :: Bool -> Type -> TCM Expr #
Match NLPType Type # |
Methods match :: Relevance -> Telescope -> Telescope -> NLPType -> Type -> NLM () #
PatternFrom Type NLPType # |
Methods patternFrom :: Relevance -> Int -> Type -> TCM NLPType #
Show a => Show (Type' a) # |
Methods showsPrec :: Int -> Type' a -> ShowS # show :: Type' a -> String # showList :: [Type' a] -> ShowS #
KillRange a => KillRange (Type' a) # |
Methods killRange :: KillRangeT (Type' a) #
SgTel (Dom (ArgName, Type)) # |
Methods sgTel :: Dom (ArgName, Type) -> Telescope #
SgTel (Dom Type) # |
Methods sgTel :: Dom Type -> Telescope #
LensSort (Type' a) # |
Methods lensSort :: Lens' Sort (Type' a) # getSort :: Type' a -> Sort #
NamesIn a => NamesIn (Type' a) # |
Methods namesIn :: Type' a -> Set QName #
AddContext (Dom (String, Type)) # |
Methods addContext :: MonadTCM tcm => Dom (String, Type) -> tcm a -> tcm a # contextSize :: Dom (String, Type) -> Nat #
AddContext (Dom (Name, Type)) # |
Methods addContext :: MonadTCM tcm => Dom (Name, Type) -> tcm a -> tcm a # contextSize :: Dom (Name, Type) -> Nat #
AddContext (Dom Type) # |
Methods addContext :: MonadTCM tcm => Dom Type -> tcm a -> tcm a # contextSize :: Dom Type -> Nat #
IsSizeType a => IsSizeType (Type' a) # |
Methods isSizeType :: Type' a -> TCM (Maybe BoundedSize) #
PrettyTCM (Type' NLPat) # |
Methods prettyTCM :: Type' NLPat -> TCM Doc #
InstantiateFull a => InstantiateFull (Type' a) # |
Methods instantiateFull' :: Type' a -> ReduceM (Type' a) #
Free' a c => Free' (Type' a) c # |
Methods freeVars' :: Type' a -> FreeM c #
SgTel (ArgName, Dom Type) # |
Methods sgTel :: (ArgName, Dom Type) -> Telescope #
AddContext ([WithHiding Name], Dom Type) # |
Methods addContext :: MonadTCM tcm => ([WithHiding Name], Dom Type) -> tcm a -> tcm a # contextSize :: ([WithHiding Name], Dom Type) -> Nat #
AddContext ([Name], Dom Type) # |
Methods addContext :: MonadTCM tcm => ([Name], Dom Type) -> tcm a -> tcm a # contextSize :: ([Name], Dom Type) -> Nat #
AddContext (String, Dom Type) # |
Methods addContext :: MonadTCM tcm => (String, Dom Type) -> tcm a -> tcm a # contextSize :: (String, Dom Type) -> Nat #
AddContext (Name, Dom Type) # |
Methods addContext :: MonadTCM tcm => (Name, Dom Type) -> tcm a -> tcm a # contextSize :: (Name, Dom Type) -> Nat #
UniverseBi ([Type], [Clause]) Pattern # |
Methods universeBi :: ([Type], [Clause]) -> [Pattern] #
UniverseBi ([Type], [Clause]) Term # |
Methods universeBi :: ([Type], [Clause]) -> [Term] #

type Type = Type' Term #

class LensSort a where #

Minimal complete definition

lensSort

Methods

lensSort :: Lens' Sort a #

getSort :: a -> Sort #

Instances

LensSort a => LensSort (Dom a) # |
Methods lensSort :: Lens' Sort (Dom a) # getSort :: Dom a -> Sort #
LensSort (Type' a) # |
Methods lensSort :: Lens' Sort (Type' a) # getSort :: Type' a -> Sort #
LensSort a => LensSort (Abs a) # |
Methods lensSort :: Lens' Sort (Abs a) # getSort :: Abs a -> Sort #

data Tele a #

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`.

Instances

Functor Tele # |
Methods fmap :: (a -> b) -> Tele a -> Tele b # (<$) :: a -> Tele b -> Tele a #
Foldable Tele # |
Methods fold :: Monoid m => Tele m -> m # foldMap :: Monoid m => (a -> m) -> Tele a -> m # foldr :: (a -> b -> b) -> b -> Tele a -> b # foldr' :: (a -> b -> b) -> b -> Tele a -> b # foldl :: (b -> a -> b) -> b -> Tele a -> b # foldl' :: (b -> a -> b) -> b -> Tele a -> b # foldr1 :: (a -> a -> a) -> Tele a -> a # foldl1 :: (a -> a -> a) -> Tele a -> a # toList :: Tele a -> [a] # null :: Tele a -> Bool # length :: Tele a -> Int # elem :: Eq a => a -> Tele a -> Bool # maximum :: Ord a => Tele a -> a # minimum :: Ord a => Tele a -> a # sum :: Num a => Tele a -> a # product :: Num a => Tele a -> a #
Traversable Tele # |
Methods traverse :: Applicative f => (a -> f b) -> Tele a -> f (Tele b) # sequenceA :: Applicative f => Tele (f a) -> f (Tele a) # mapM :: Monad m => (a -> m b) -> Tele a -> m (Tele b) # sequence :: Monad m => Tele (m a) -> m (Tele a) #
TeleNoAbs Telescope # |
Methods teleNoAbs :: Telescope -> Term -> Term #
AddContext Telescope # |
Methods addContext :: MonadTCM tcm => Telescope -> tcm a -> tcm a # contextSize :: Telescope -> Nat #
DropArgs Telescope # | NOTE: This creates telescopes with unbound de Bruijn indices.
Methods dropArgs :: Int -> Telescope -> Telescope #
PrettyTCM Telescope # |
Methods prettyTCM :: Telescope -> TCM Doc #
Reduce Telescope # |
Methods reduce' :: Telescope -> ReduceM Telescope # reduceB' :: Telescope -> ReduceM (Blocked Telescope) #
Instantiate Telescope # |
Methods instantiate' :: Telescope -> ReduceM Telescope #
Reify Telescope Telescope # |
Methods reify :: Telescope -> TCM Telescope # reifyWhen :: Bool -> Telescope -> TCM Telescope #
Show a => Show (Tele a) # |
Methods showsPrec :: Int -> Tele a -> ShowS # show :: Tele a -> String # showList :: [Tele a] -> ShowS #
Pretty a => Pretty (Tele (Dom a)) # |
Methods pretty :: Tele (Dom a) -> Doc # prettyPrec :: Int -> Tele (Dom a) -> Doc #
Null (Tele a) # |
Methods empty :: Tele a # null :: Tele a -> Bool #
Sized (Tele a) # | The size of a telescope is its length (as a list).
Methods size :: Integral n => Tele a -> n #
KillRange a => KillRange (Tele a) # |
Methods killRange :: KillRangeT (Tele a) #
Free a => Free (Tele a) # |
Methods freeVars' :: Tele a -> FreeT
NamesIn a => NamesIn (Tele a) # |
Methods namesIn :: Tele a -> Set QName #
MentionsMeta a => MentionsMeta (Tele a) # |
Methods mentionsMeta :: MetaId -> Tele a -> Bool #
(Subst t a, InstantiateFull a) => InstantiateFull (Tele a) # |
Methods instantiateFull' :: Tele a -> ReduceM (Tele a) #
(Subst t a, Normalise a) => Normalise (Tele a) # |
Methods normalise' :: Tele a -> ReduceM (Tele a) #
(Subst t a, Simplify a) => Simplify (Tele a) # |
Methods simplify' :: Tele a -> ReduceM (Tele a) #
ComputeOccurrences a => ComputeOccurrences (Tele a) # |
Methods occurrences :: Tele a -> OccM OccurrencesBuilder #
Free' a c => Free' (Tele a) c # |
Methods freeVars' :: Tele a -> FreeM c #

type Telescope = Tele (Dom Type) #

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

A traversal for the names in a telescope.

mapAbsNames :: (ArgName -> ArgName) -> Tele a -> Tele a #

replaceEmptyName :: ArgName -> Tele a -> Tele a #

data Sort #

Sorts.

Constructors

Type Level | `Set ℓ`.
Prop | Dummy sort.
Inf | `Setω`.
SizeUniv | `SizeUniv`, a sort inhabited by type `Size`.
DLub Sort (Abs Sort) | Dependent least upper bound. If the free variable occurs in the second sort, the whole thing should reduce to Inf, otherwise it's the normal lub.

Instances

Show Sort # |
Methods showsPrec :: Int -> Sort -> ShowS # show :: Sort -> String # showList :: [Sort] -> ShowS #
NFData Sort # |
Methods rnf :: Sort -> () #
Pretty Sort # |
Methods pretty :: Sort -> Doc # prettyPrec :: Int -> Sort -> Doc #
KillRange Sort # |
Methods killRange :: KillRangeT Sort #
TermSize Sort # |
Methods termSize :: Sort -> Int # tsize :: Sort -> Sum Int #
GetDefs Sort # |
Methods getDefs :: MonadGetDefs m => Sort -> m () #
Free Sort # |
Methods freeVars' :: Sort -> FreeT
NamesIn Sort # |
Methods namesIn :: Sort -> Set QName #
UnFreezeMeta Sort # |
Methods unfreezeMeta :: Sort -> TCM () #
MentionsMeta Sort # |
Methods mentionsMeta :: MetaId -> Sort -> Bool #
PrettyTCM Sort # |
Methods prettyTCM :: Sort -> TCM Doc #
InstantiateFull Sort # |
Methods instantiateFull' :: Sort -> ReduceM Sort #
Normalise Sort # |
Methods normalise' :: Sort -> ReduceM Sort #
Simplify Sort # |
Methods simplify' :: Sort -> ReduceM Sort #
Reduce Sort # |
Methods reduce' :: Sort -> ReduceM Sort # reduceB' :: Sort -> ReduceM (Blocked Sort) #
Instantiate Sort # |
Methods instantiate' :: Sort -> ReduceM Sort #
Match Sort # |
Methods match :: Sort -> Sort -> MaybeT TCM [Term] #
SynEq Sort # |
Methods synEq :: Sort -> Sort -> SynEqM (Sort, Sort) synEq' :: Sort -> Sort -> SynEqM (Sort, Sort)
FoldRigid Sort # |
Methods foldRigid :: Monoid (TCM m) => (Nat -> TCM m) -> Sort -> TCM m #
Occurs Sort # |
Methods occurs :: UnfoldStrategy -> OccursCtx -> MetaId -> Vars -> Sort -> TCM Sort # metaOccurs :: MetaId -> Sort -> TCM () #
AbsTerm Sort # |
Methods absTerm :: Term -> Sort -> Sort #
Free' Sort c # |
Methods freeVars' :: Sort -> FreeM c #
Reify Sort Expr # |
Methods reify :: Sort -> TCM Expr # reifyWhen :: Bool -> Sort -> TCM Expr #
Match NLPat Sort # |
Methods match :: Relevance -> Telescope -> Telescope -> NLPat -> Sort -> NLM () #
PatternFrom Sort NLPat # |
Methods patternFrom :: Relevance -> Int -> Sort -> TCM NLPat #

newtype Level #

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] |

Instances

Show Level # |
Methods showsPrec :: Int -> Level -> ShowS # show :: Level -> String # showList :: [Level] -> ShowS #
NFData Level # |
Methods rnf :: Level -> () #
Pretty Level # |
Methods pretty :: Level -> Doc # prettyPrec :: Int -> Level -> Doc #
KillRange Level # |
Methods killRange :: KillRangeT Level #
TermSize Level # |
Methods termSize :: Level -> Int # tsize :: Level -> Sum Int #
GetDefs Level # |
Methods getDefs :: MonadGetDefs m => Level -> m () #
TermLike Level # |
Methods traverseTerm :: (Term -> Term) -> Level -> Level # traverseTermM :: Monad m => (Term -> m Term) -> Level -> m Level # foldTerm :: Monoid m => (Term -> m) -> Level -> m #
Free Level # |
Methods freeVars' :: Level -> FreeT
DeBruijn Level # |
Methods deBruijnVar :: Int -> Level # debruijnNamedVar :: String -> Int -> Level # deBruijnView :: Level -> Maybe Int #
NamesIn Level # |
Methods namesIn :: Level -> Set QName #
UnFreezeMeta Level # |
Methods unfreezeMeta :: Level -> TCM () #
IsInstantiatedMeta Level # |
Methods isInstantiatedMeta :: Level -> TCM Bool #
MentionsMeta Level # |
Methods mentionsMeta :: MetaId -> Level -> Bool #
PrettyTCM Level # |
Methods prettyTCM :: Level -> TCM Doc #
InstantiateFull Level # |
Methods instantiateFull' :: Level -> ReduceM Level #
Normalise Level # |
Methods normalise' :: Level -> ReduceM Level #
Simplify Level # |
Methods simplify' :: Level -> ReduceM Level #
Reduce Level # |
Methods reduce' :: Level -> ReduceM Level # reduceB' :: Level -> ReduceM (Blocked Level) #
Instantiate Level # |
Methods instantiate' :: Level -> ReduceM Level #
Match Level # |
Methods match :: Level -> Level -> MaybeT TCM [Term] #
SynEq Level # |
Methods synEq :: Level -> Level -> SynEqM (Level, Level) synEq' :: Level -> Level -> SynEqM (Level, Level)
HasPolarity Level # |
Methods polarities :: Nat -> Level -> TCM [Polarity] #
FoldRigid Level # |
Methods foldRigid :: Monoid (TCM m) => (Nat -> TCM m) -> Level -> TCM m #
Occurs Level # |
Methods occurs :: UnfoldStrategy -> OccursCtx -> MetaId -> Vars -> Level -> TCM Level # metaOccurs :: MetaId -> Level -> TCM () #
ComputeOccurrences Level # |
Methods occurrences :: Level -> OccM OccurrencesBuilder #
AbsTerm Level # |
Methods absTerm :: Term -> Level -> Level #
Free' Level c # |
Methods freeVars' :: Level -> FreeM c #
Reify Level Expr # |
Methods reify :: Level -> TCM Expr # reifyWhen :: Bool -> Level -> TCM Expr #
Match NLPat Level # |
Methods match :: Relevance -> Telescope -> Telescope -> NLPat -> Level -> NLM () #

data PlusLevel #

Constructors

ClosedLevel Integer | `n`, to represent `Setₙ`.
Plus Integer LevelAtom | `n + ℓ`.

Instances

Show PlusLevel # |
Methods showsPrec :: Int -> PlusLevel -> ShowS # show :: PlusLevel -> String # showList :: [PlusLevel] -> ShowS #
NFData PlusLevel # |
Methods rnf :: PlusLevel -> () #
Pretty PlusLevel # |
Methods pretty :: PlusLevel -> Doc # prettyPrec :: Int -> PlusLevel -> Doc #
KillRange PlusLevel # |
Methods killRange :: KillRangeT PlusLevel #
TermSize PlusLevel # |
Methods termSize :: PlusLevel -> Int # tsize :: PlusLevel -> Sum Int #
GetDefs PlusLevel # |
Methods getDefs :: MonadGetDefs m => PlusLevel -> m () #
TermLike PlusLevel # |
Methods traverseTerm :: (Term -> Term) -> PlusLevel -> PlusLevel # traverseTermM :: Monad m => (Term -> m Term) -> PlusLevel -> m PlusLevel # foldTerm :: Monoid m => (Term -> m) -> PlusLevel -> m #
Free PlusLevel # |
Methods freeVars' :: PlusLevel -> FreeT
DeBruijn PlusLevel # |
Methods deBruijnVar :: Int -> PlusLevel # debruijnNamedVar :: String -> Int -> PlusLevel # deBruijnView :: PlusLevel -> Maybe Int #
NamesIn PlusLevel # |
Methods namesIn :: PlusLevel -> Set QName #
UnFreezeMeta PlusLevel # |
Methods unfreezeMeta :: PlusLevel -> TCM () #
IsInstantiatedMeta PlusLevel # |
Methods isInstantiatedMeta :: PlusLevel -> TCM Bool #
MentionsMeta PlusLevel # |
Methods mentionsMeta :: MetaId -> PlusLevel -> Bool #
InstantiateFull PlusLevel # |
Methods instantiateFull' :: PlusLevel -> ReduceM PlusLevel #
Normalise PlusLevel # |
Methods normalise' :: PlusLevel -> ReduceM PlusLevel #
Simplify PlusLevel # |
Methods simplify' :: PlusLevel -> ReduceM PlusLevel #
Reduce PlusLevel # |
Methods reduce' :: PlusLevel -> ReduceM PlusLevel # reduceB' :: PlusLevel -> ReduceM (Blocked PlusLevel) #
Instantiate PlusLevel # |
Methods instantiate' :: PlusLevel -> ReduceM PlusLevel #
SynEq PlusLevel # |
Methods synEq :: PlusLevel -> PlusLevel -> SynEqM (PlusLevel, PlusLevel) synEq' :: PlusLevel -> PlusLevel -> SynEqM (PlusLevel, PlusLevel)
HasPolarity PlusLevel # |
Methods polarities :: Nat -> PlusLevel -> TCM [Polarity] #
FoldRigid PlusLevel # |
Methods foldRigid :: Monoid (TCM m) => (Nat -> TCM m) -> PlusLevel -> TCM m #
Occurs PlusLevel # |
Methods occurs :: UnfoldStrategy -> OccursCtx -> MetaId -> Vars -> PlusLevel -> TCM PlusLevel # metaOccurs :: MetaId -> PlusLevel -> TCM () #
ComputeOccurrences PlusLevel # |
Methods occurrences :: PlusLevel -> OccM OccurrencesBuilder #
AbsTerm PlusLevel # |
Methods absTerm :: Term -> PlusLevel -> PlusLevel #
Free' PlusLevel c # |
Methods freeVars' :: PlusLevel -> FreeM c #

data LevelAtom #

An atomic term of type `Level`.

Constructors

MetaLevel MetaId Elims | A meta variable targeting `Level` under some eliminations.
BlockedLevel MetaId Term | A term of type `Level` whose reduction is blocked by a meta.
NeutralLevel NotBlocked Term | A neutral term of type `Level`.
UnreducedLevel Term | Introduced by `instantiate`, removed by `reduce`.

Instances

Show LevelAtom # |
Methods showsPrec :: Int -> LevelAtom -> ShowS # show :: LevelAtom -> String # showList :: [LevelAtom] -> ShowS #
NFData LevelAtom # |
Methods rnf :: LevelAtom -> () #
Pretty LevelAtom # |
Methods pretty :: LevelAtom -> Doc # prettyPrec :: Int -> LevelAtom -> Doc #
KillRange LevelAtom # |
Methods killRange :: KillRangeT LevelAtom #
TermSize LevelAtom # |
Methods termSize :: LevelAtom -> Int # tsize :: LevelAtom -> Sum Int #
GetDefs LevelAtom # |
Methods getDefs :: MonadGetDefs m => LevelAtom -> m () #
TermLike LevelAtom # |
Methods traverseTerm :: (Term -> Term) -> LevelAtom -> LevelAtom # traverseTermM :: Monad m => (Term -> m Term) -> LevelAtom -> m LevelAtom # foldTerm :: Monoid m => (Term -> m) -> LevelAtom -> m #
Free LevelAtom # |
Methods freeVars' :: LevelAtom -> FreeT
DeBruijn LevelAtom # |
Methods deBruijnVar :: Int -> LevelAtom # debruijnNamedVar :: String -> Int -> LevelAtom # deBruijnView :: LevelAtom -> Maybe Int #
NamesIn LevelAtom # |
Methods namesIn :: LevelAtom -> Set QName #
UnFreezeMeta LevelAtom # |
Methods unfreezeMeta :: LevelAtom -> TCM () #
IsInstantiatedMeta LevelAtom # |
Methods isInstantiatedMeta :: LevelAtom -> TCM Bool #
MentionsMeta LevelAtom # |
Methods mentionsMeta :: MetaId -> LevelAtom -> Bool #
InstantiateFull LevelAtom # |
Methods instantiateFull' :: LevelAtom -> ReduceM LevelAtom #
Normalise LevelAtom # |
Methods normalise' :: LevelAtom -> ReduceM LevelAtom #
Simplify LevelAtom # |
Methods simplify' :: LevelAtom -> ReduceM LevelAtom #
Reduce LevelAtom # |
Methods reduce' :: LevelAtom -> ReduceM LevelAtom # reduceB' :: LevelAtom -> ReduceM (Blocked LevelAtom) #
Instantiate LevelAtom # |
Methods instantiate' :: LevelAtom -> ReduceM LevelAtom #
SynEq LevelAtom # |
Methods synEq :: LevelAtom -> LevelAtom -> SynEqM (LevelAtom, LevelAtom) synEq' :: LevelAtom -> LevelAtom -> SynEqM (LevelAtom, LevelAtom)
HasPolarity LevelAtom # |
Methods polarities :: Nat -> LevelAtom -> TCM [Polarity] #
FoldRigid LevelAtom # |
Methods foldRigid :: Monoid (TCM m) => (Nat -> TCM m) -> LevelAtom -> TCM m #
Occurs LevelAtom # |
Methods occurs :: UnfoldStrategy -> OccursCtx -> MetaId -> Vars -> LevelAtom -> TCM LevelAtom # metaOccurs :: MetaId -> LevelAtom -> TCM () #
ComputeOccurrences LevelAtom # |
Methods occurrences :: LevelAtom -> OccM OccurrencesBuilder #
AbsTerm LevelAtom # |
Methods absTerm :: Term -> LevelAtom -> LevelAtom #
Free' LevelAtom c # |
Methods freeVars' :: LevelAtom -> FreeM c #

# Blocked Terms

data NotBlocked #

Even if we are not stuck on a meta during reduction we can fail to reduce a definition by pattern matching for another reason.

Constructors

StuckOn Elim | The `Elim` is neutral and blocks a pattern match.
Underapplied | Not enough arguments were supplied to complete the matching.
AbsurdMatch | We matched an absurd clause, results in a neutral `Def`.
MissingClauses | We ran out of clauses, all considered clauses produced an actual mismatch. This can happen when try to reduce a function application but we are still missing some function clauses. See Agda.TypeChecking.Patterns.Match.
ReallyNotBlocked | Reduction was not blocked, we reached a whnf which can be anything but a stuck ``Def``.

Instances

Show NotBlocked # |
Methods showsPrec :: Int -> NotBlocked -> ShowS # show :: NotBlocked -> String # showList :: [NotBlocked] -> ShowS #
Semigroup NotBlocked # | `ReallyNotBlocked` is the unit. `MissingClauses` is dominant. ``StuckOn`{}` should be propagated, if tied, we take the left.
Methods (<>) :: NotBlocked -> NotBlocked -> NotBlocked # sconcat :: NonEmpty NotBlocked -> NotBlocked # stimes :: Integral b => b -> NotBlocked -> NotBlocked #
Monoid NotBlocked # |
Methods mempty :: NotBlocked # mappend :: NotBlocked -> NotBlocked -> NotBlocked # mconcat :: [NotBlocked] -> NotBlocked #

data Blocked t #

Something where a meta variable may block reduction.

Constructors

Blocked |
Fields theBlockingMeta :: MetaId ignoreBlocking :: t
NotBlocked |
Fields blockingStatus :: NotBlocked ignoreBlocking :: t

Instances

Functor Blocked # |
Methods fmap :: (a -> b) -> Blocked a -> Blocked b # (<$) :: a -> Blocked b -> Blocked a #
Applicative Blocked # | Blocking by a meta is dominant.
Methods pure :: a -> Blocked a # (<*>) :: Blocked (a -> b) -> Blocked a -> Blocked b # (*>) :: Blocked a -> Blocked b -> Blocked b # (<*) :: Blocked a -> Blocked b -> Blocked a #
Foldable Blocked # |
Methods fold :: Monoid m => Blocked m -> m # foldMap :: Monoid m => (a -> m) -> Blocked a -> m # foldr :: (a -> b -> b) -> b -> Blocked a -> b # foldr' :: (a -> b -> b) -> b -> Blocked a -> b # foldl :: (b -> a -> b) -> b -> Blocked a -> b # foldl' :: (b -> a -> b) -> b -> Blocked a -> b # foldr1 :: (a -> a -> a) -> Blocked a -> a # foldl1 :: (a -> a -> a) -> Blocked a -> a # toList :: Blocked a -> [a] # null :: Blocked a -> Bool # length :: Blocked a -> Int # elem :: Eq a => a -> Blocked a -> Bool # maximum :: Ord a => Blocked a -> a # minimum :: Ord a => Blocked a -> a # sum :: Num a => Blocked a -> a # product :: Num a => Blocked a -> a #
Traversable Blocked # |
Methods traverse :: Applicative f => (a -> f b) -> Blocked a -> f (Blocked b) # sequenceA :: Applicative f => Blocked (f a) -> f (Blocked a) # mapM :: Monad m => (a -> m b) -> Blocked a -> m (Blocked b) # sequence :: Monad m => Blocked (m a) -> m (Blocked a) #
Semigroup Blocked_ # |
Methods (<>) :: Blocked_ -> Blocked_ -> Blocked_ # sconcat :: NonEmpty Blocked_ -> Blocked_ # stimes :: Integral b => b -> Blocked_ -> Blocked_ #
Monoid Blocked_ # |
Methods mempty :: Blocked_ # mappend :: Blocked_ -> Blocked_ -> Blocked_ # mconcat :: [Blocked_] -> Blocked_ #
HasOptions NLM # |
Methods pragmaOptions :: NLM PragmaOptions # commandLineOptions :: NLM CommandLineOptions #
Show t => Show (Blocked t) # |
Methods showsPrec :: Int -> Blocked t -> ShowS # show :: Blocked t -> String # showList :: [Blocked t] -> ShowS #
KillRange a => KillRange (Blocked a) # |
Methods killRange :: KillRangeT (Blocked a) #
TermLike a => TermLike (Blocked a) # |
Methods traverseTerm :: (Term -> Term) -> Blocked a -> Blocked a # traverseTermM :: Monad m => (Term -> m Term) -> Blocked a -> m (Blocked a) # foldTerm :: Monoid m => (Term -> m) -> Blocked a -> m #
PrettyTCM a => PrettyTCM (Blocked a) # |
Methods prettyTCM :: Blocked a -> TCM Doc #
Instantiate a => Instantiate (Blocked a) # |
Methods instantiate' :: Blocked a -> ReduceM (Blocked a) #

type Blocked_ = Blocked () #

``Blocked` t` without the `t`.

stuckOn :: Elim -> NotBlocked -> NotBlocked #

When trying to reduce `f es`, on match failed on one elimination `e ∈ es` that came with info `r :: NotBlocked`. `stuckOn e r` produces the new `NotBlocked` info.

`MissingClauses` must be propagated, as this is blockage that can be lifted in the future (as more clauses are added).

``StuckOn` e0` is also propagated, since it provides more precise information as `StuckOn e` (as `e0` is the original reason why reduction got stuck and usually a subterm of `e`). An information like `StuckOn (Apply (Arg info (Var i [])))` (stuck on a variable) could be used by the lhs/coverage checker to trigger a split on that (pattern) variable.

In the remaining cases for `r`, we are terminally stuck due to `StuckOn e`. Propagating ``AbsurdMatch`` does not seem useful.

`Underapplied` must not be propagated, as this would mean that `f es` is underapplied, which is not the case (it is stuck). Note that `Underapplied` can only arise when projection patterns were missing to complete the original match (in `e`). (Missing ordinary pattern would mean the `e` is of function type, but we cannot match against something of function type.)

# Definitions

data Clause #

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

The telescope contains the types of the pattern variables and the de Bruijn indices say 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 telescope.

    clauseTel ~ permute clausePerm (patternVars namedClausePats)

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 in dependency order. namedClausePats :: [NamedArg DeBruijnPattern] `Δ ⊢ ps`. The de Bruijn indices refer to `Δ`. clauseBody :: Maybe Term `Just v` with `Δ ⊢ v` for a regular clause, or `Nothing` for an absurd one. clauseType :: Maybe (Arg Type) `Δ ⊢ t`. 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. clauseCatchall :: Bool Clause has been labelled as CATCHALL.

Instances

Show Clause # |
Methods showsPrec :: Int -> Clause -> ShowS # show :: Clause -> String # showList :: [Clause] -> ShowS #
Pretty Clause # |
Methods pretty :: Clause -> Doc # prettyPrec :: Int -> Clause -> Doc #
Null Clause # | A `null` clause is one with no patterns and no rhs. Should not exist in practice.
Methods empty :: Clause # null :: Clause -> Bool #
KillRange Clause # |
Methods killRange :: KillRangeT Clause #
HasRange Clause # |
Methods getRange :: Clause -> Range #
GetDefs Clause # |
Methods getDefs :: MonadGetDefs m => Clause -> m () #
FunArity Clause # | Get the number of initial `Apply` patterns in a clause.
Methods funArity :: Clause -> Int #
Free Clause # |
Methods freeVars' :: Clause -> FreeT
NamesIn Clause # |
Methods namesIn :: Clause -> Set QName #
DropArgs Clause # | NOTE: does not work for recursive functions.
Methods dropArgs :: Int -> Clause -> Clause #
DropArgs FunctionInverse # |
Methods dropArgs :: Int -> FunctionInverse -> FunctionInverse #
PrettyTCM Clause # |
Methods prettyTCM :: Clause -> TCM Doc #
InstantiateFull Clause # |
Methods instantiateFull' :: Clause -> ReduceM Clause #
InstantiateFull FunctionInverse # |
Methods instantiateFull' :: FunctionInverse -> ReduceM FunctionInverse #
NormaliseProjP Clause # |
Methods normaliseProjP :: HasConstInfo m => Clause -> m Clause #
Occurs Clause # |
Methods occurs :: UnfoldStrategy -> OccursCtx -> MetaId -> Vars -> Clause -> TCM Clause # metaOccurs :: MetaId -> Clause -> TCM () #
ComputeOccurrences Clause # |
Methods occurrences :: Clause -> OccM OccurrencesBuilder #
Free' Clause c # |
Methods freeVars' :: Clause -> FreeM c #
FunArity [Clause] # | Get the number of common initial `Apply` patterns in a list of clauses.
Methods funArity :: [Clause] -> Int #
PrettyTCM (QNamed Clause) # |
Methods prettyTCM :: QNamed Clause -> TCM Doc #
Reify (QNamed Clause) Clause # |
Methods reify :: QNamed Clause -> TCM Clause # reifyWhen :: Bool -> QNamed Clause -> TCM Clause #
UniverseBi ([Type], [Clause]) Pattern # |
Methods universeBi :: ([Type], [Clause]) -> [Pattern] #
UniverseBi ([Type], [Clause]) Term # |
Methods universeBi :: ([Type], [Clause]) -> [Term] #

clausePats :: Clause -> [Arg DeBruijnPattern] #

type PatVarName = ArgName #

Pattern variables.

patVarNameToString :: PatVarName -> String #

nameToPatVarName :: Name -> PatVarName #

data Pattern' x #

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 x |
    x
DotP Term |
    .t
ConP ConHead ConPatternInfo [NamedArg (Pattern' x)] | `c ps` The subpatterns do not contain any projection copatterns.
LitP Literal | E.g. `5`, `"hello"`.
ProjP ProjOrigin QName | Projection copattern. Can only appear by itself.

Instances

Functor Pattern' # |
Methods fmap :: (a -> b) -> Pattern' a -> Pattern' b # (<$) :: a -> Pattern' b -> Pattern' a #
Foldable Pattern' # |
Methods fold :: Monoid m => Pattern' m -> m # foldMap :: Monoid m => (a -> m) -> Pattern' a -> m # foldr :: (a -> b -> b) -> b -> Pattern' a -> b # foldr' :: (a -> b -> b) -> b -> Pattern' a -> b # foldl :: (b -> a -> b) -> b -> Pattern' a -> b # foldl' :: (b -> a -> b) -> b -> Pattern' a -> b # foldr1 :: (a -> a -> a) -> Pattern' a -> a # foldl1 :: (a -> a -> a) -> Pattern' a -> a # toList :: Pattern' a -> [a] # null :: Pattern' a -> Bool # length :: Pattern' a -> Int # elem :: Eq a => a -> Pattern' a -> Bool # maximum :: Ord a => Pattern' a -> a # minimum :: Ord a => Pattern' a -> a # sum :: Num a => Pattern' a -> a # product :: Num a => Pattern' a -> a #
Traversable Pattern' # |
Methods traverse :: Applicative f => (a -> f b) -> Pattern' a -> f (Pattern' b) # sequenceA :: Applicative f => Pattern' (f a) -> f (Pattern' a) # mapM :: Monad m => (a -> m b) -> Pattern' a -> m (Pattern' b) # sequence :: Monad m => Pattern' (m a) -> m (Pattern' a) #
MapNamedArg Pattern' # |
Methods mapNamedArg :: (NamedArg a -> NamedArg b) -> NamedArg (Pattern' a) -> NamedArg (Pattern' b) #
UniverseBi Elims Pattern # |
Methods universeBi :: Elims -> [Pattern] #
UniverseBi Args Pattern # |
Methods universeBi :: Args -> [Pattern] #
LabelPatVars Pattern DeBruijnPattern Int # |
Methods labelPatVars :: Pattern -> State [Int] DeBruijnPattern # unlabelPatVars :: DeBruijnPattern -> Pattern #
Show x => Show (Pattern' x) # |
Methods showsPrec :: Int -> Pattern' x -> ShowS # show :: Pattern' x -> String # showList :: [Pattern' x] -> ShowS #
Pretty a => Pretty (Pattern' a) # |
Methods pretty :: Pattern' a -> Doc # prettyPrec :: Int -> Pattern' a -> Doc #
KillRange a => KillRange (Pattern' a) # |
Methods killRange :: KillRangeT (Pattern' a) #
IsProjP (Pattern' a) # |
Methods isProjP :: Pattern' a -> Maybe (ProjOrigin, AmbiguousQName) #
NamesIn (Pattern' a) # |
Methods namesIn :: Pattern' a -> Set QName #
PrettyTCM a => PrettyTCM (Pattern' a) # |
Methods prettyTCM :: Pattern' a -> TCM Doc #
InstantiateFull a => InstantiateFull (Pattern' a) # |
Methods instantiateFull' :: Pattern' a -> ReduceM (Pattern' a) #
Normalise a => Normalise (Pattern' a) # |
Methods normalise' :: Pattern' a -> ReduceM (Pattern' a) #
NormaliseProjP (Pattern' x) # |
Methods normaliseProjP :: HasConstInfo m => Pattern' x -> m (Pattern' x) #
IsFlexiblePattern (Pattern' a) # |
Methods maybeFlexiblePattern :: Pattern' a -> MaybeT TCM FlexibleVarKind # isFlexiblePattern :: Pattern' a -> TCM Bool #
UniverseBi ([Type], [Clause]) Pattern # |
Methods universeBi :: ([Type], [Clause]) -> [Pattern] #

type Pattern #

Arguments

= Pattern' PatVarName | The `PatVarName` is a name suggestion.

varP :: ArgName -> Pattern #

data DBPatVar #

Type used when numbering pattern variables.

Constructors

DBPatVar |
Fields dbPatVarName :: PatVarName dbPatVarIndex :: Int

Instances

Show DBPatVar # |
Methods showsPrec :: Int -> DBPatVar -> ShowS # show :: DBPatVar -> String # showList :: [DBPatVar] -> ShowS #
Pretty DBPatVar # |
Methods pretty :: DBPatVar -> Doc # prettyPrec :: Int -> DBPatVar -> Doc #
KillRange DBPatVar # |
Methods killRange :: KillRangeT DBPatVar #
PrettyTCM DBPatVar # |
Methods prettyTCM :: DBPatVar -> TCM Doc #
InstantiateFull DBPatVar # |
Methods instantiateFull' :: DBPatVar -> ReduceM DBPatVar #
Normalise DBPatVar # |
Methods normalise' :: DBPatVar -> ReduceM DBPatVar #
LabelPatVars Pattern DeBruijnPattern Int # |
Methods labelPatVars :: Pattern -> State [Int] DeBruijnPattern # unlabelPatVars :: DeBruijnPattern -> Pattern #

type DeBruijnPattern = Pattern' DBPatVar #

namedVarP :: PatVarName -> Named_ Pattern #

namedDBVarP :: Int -> PatVarName -> Named_ DeBruijnPattern #

data ConPatternInfo #

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`).

Constructors

ConPatternInfo |
Fields conPRecord :: Maybe ConOrigin `Nothing` if data constructor. `Just` if record constructor. conPType :: Maybe (Arg Type) The type of the whole constructor pattern. Should be present (`Just`) if constructor pattern is is generated ordinarily by type-checking. Could be absent (`Nothing`) if pattern comes from some plugin (like Agsy). Needed e.g. for with-clause stripping.

Instances

Show ConPatternInfo # |
Methods showsPrec :: Int -> ConPatternInfo -> ShowS # show :: ConPatternInfo -> String # showList :: [ConPatternInfo] -> ShowS #
KillRange ConPatternInfo # |
Methods killRange :: KillRangeT ConPatternInfo #
InstantiateFull ConPatternInfo # |
Methods instantiateFull' :: ConPatternInfo -> ReduceM ConPatternInfo #
Normalise ConPatternInfo # |
Methods normalise' :: ConPatternInfo -> ReduceM ConPatternInfo #

noConPatternInfo :: ConPatternInfo #

toConPatternInfo :: ConInfo -> ConPatternInfo #

Build partial `ConPatternInfo` from `ConInfo`

fromConPatternInfo :: ConPatternInfo -> ConInfo #

Build `ConInfo` from `ConPatternInfo`.

patternVars :: Arg (Pattern' a) -> [Arg (Either a Term)] #

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

properlyMatching :: DeBruijnPattern -> Bool #

Does the pattern perform a match that could fail?

# Explicit substitutions

data Substitution' a #

Substitutions.

Constructors

IdS | Identity substitution. `Γ ⊢ IdS : Γ`
EmptyS | Empty substitution, lifts from the empty context. Apply this to closed terms you want to use in a non-empty context. `Γ ⊢ EmptyS : ()`
a :# (Substitution' a) infixr 4 | Substitution extension, ``cons'`. `Γ ⊢ u : Aρ Γ ⊢ ρ : Δ ---------------------- Γ ⊢ u :# ρ : Δ, A`
Strengthen Empty (Substitution' a) | Strengthening substitution. First argument is `IMPOSSIBLE`. Apply this to a term which does not contain variable 0 to lower all de Bruijn indices by one. `Γ ⊢ ρ : Δ --------------------------- Γ ⊢ Strengthen ρ : Δ, A`
Wk !Int (Substitution' a) | Weakning substitution, lifts to an extended context. `Γ ⊢ ρ : Δ ------------------- Γ, Ψ ⊢ Wk |Ψ| ρ : Δ`
Lift !Int (Substitution' a) | Lifting substitution. Use this to go under a binder. `Lift 1 ρ == var 0 :# Wk 1 ρ`. `Γ ⊢ ρ : Δ ------------------------- Γ, Ψρ ⊢ Lift |Ψ| ρ : Δ, Ψ`

Instances

Functor Substitution' # |
Methods fmap :: (a -> b) -> Substitution' a -> Substitution' b # (<$) :: a -> Substitution' b -> Substitution' a #
Foldable Substitution' # |
Methods fold :: Monoid m => Substitution' m -> m # foldMap :: Monoid m => (a -> m) -> Substitution' a -> m # foldr :: (a -> b -> b) -> b -> Substitution' a -> b # foldr' :: (a -> b -> b) -> b -> Substitution' a -> b # foldl :: (b -> a -> b) -> b -> Substitution' a -> b # foldl' :: (b -> a -> b) -> b -> Substitution' a -> b # foldr1 :: (a -> a -> a) -> Substitution' a -> a # foldl1 :: (a -> a -> a) -> Substitution' a -> a # toList :: Substitution' a -> [a] # null :: Substitution' a -> Bool # length :: Substitution' a -> Int # elem :: Eq a => a -> Substitution' a -> Bool # maximum :: Ord a => Substitution' a -> a # minimum :: Ord a => Substitution' a -> a # sum :: Num a => Substitution' a -> a # product :: Num a => Substitution' a -> a #
Traversable Substitution' # |
Methods traverse :: Applicative f => (a -> f b) -> Substitution' a -> f (Substitution' b) # sequenceA :: Applicative f => Substitution' (f a) -> f (Substitution' a) # mapM :: Monad m => (a -> m b) -> Substitution' a -> m (Substitution' b) # sequence :: Monad m => Substitution' (m a) -> m (Substitution' a) #
KillRange Substitution # |
Methods killRange :: KillRangeT Substitution #
InstantiateFull Substitution # |
Methods instantiateFull' :: Substitution -> ReduceM Substitution #
Show a => Show (Substitution' a) # |
Methods showsPrec :: Int -> Substitution' a -> ShowS # show :: Substitution' a -> String # showList :: [Substitution' a] -> ShowS #
Pretty a => Pretty (Substitution' a) # |
Methods pretty :: Substitution' a -> Doc # prettyPrec :: Int -> Substitution' a -> Doc #
Null (Substitution' a) # |
Methods empty :: Substitution' a # null :: Substitution' a -> Bool #
TermSize a => TermSize (Substitution' a) # |
Methods termSize :: Substitution' a -> Int # tsize :: Substitution' a -> Sum Int #
(Show a, PrettyTCM a, Subst a a) => PrettyTCM (Substitution' a) # |
Methods prettyTCM :: Substitution' a -> TCM Doc #

type Substitution = Substitution' Term #

type PatternSubstitution = Substitution' DeBruijnPattern #

# Views

data EqualityView #

View type as equality type.

Constructors

EqualityType |
Fields eqtSort :: Sort Sort of this type. eqtName :: QName Builtin EQUALITY. eqtLevel :: Arg Term Hidden eqtType :: Arg Term Hidden eqtLhs :: Arg Term NotHidden eqtRhs :: Arg Term NotHidden
OtherType Type | reduced

Instances

TermLike EqualityView # |
Methods traverseTerm :: (Term -> Term) -> EqualityView -> EqualityView # traverseTermM :: Monad m => (Term -> m Term) -> EqualityView -> m EqualityView # foldTerm :: Monoid m => (Term -> m) -> EqualityView -> m #
PrettyTCM EqualityView # |
Methods prettyTCM :: EqualityView -> TCM Doc #
InstantiateFull EqualityView # |
Methods instantiateFull' :: EqualityView -> ReduceM EqualityView #
Normalise EqualityView # |
Methods normalise' :: EqualityView -> ReduceM EqualityView #
Simplify EqualityView # |
Methods simplify' :: EqualityView -> ReduceM EqualityView #
Reduce EqualityView # |
Methods reduce' :: EqualityView -> ReduceM EqualityView # reduceB' :: EqualityView -> ReduceM (Blocked EqualityView) #
Instantiate EqualityView # |
Methods instantiate' :: EqualityView -> ReduceM EqualityView #
Free' EqualityView c # |
Methods freeVars' :: EqualityView -> FreeM c #

isEqualityType :: EqualityView -> Bool #

# Absurd Lambda

absurdBody :: Abs Term #

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

isAbsurdBody :: Abs Term -> Bool #

absurdPatternName :: PatVarName #

isAbsurdPatternName :: PatVarName -> Bool #

# Pointers and Sharing

ignoreSharing :: Term -> Term #

Remove top-level `Shared` data constructors.

ignoreSharingType :: Type -> Type #

shared_ :: Term -> Term #

Introduce sharing.

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

Typically m would be TCM and f would be Blocked.

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

updateShared :: (Term -> Term) -> Term -> Term #

pointerChain :: Term -> [Ptr Term] #

compressPointerChain :: Term -> Term #

# Smart constructors

var :: Nat -> Term #

An unapplied variable.

dontCare :: Term -> Term #

Add `DontCare` is it is not already a `DontCare`.

typeDontCare :: Type #

A dummy type.

topSort :: Type #

Top sort (Setomega).

sort :: Sort -> Type #

varSort :: Int -> Sort #

sSuc :: Sort -> Sort #

Get the next higher sort.

levelSuc :: Level -> Level #

mkType :: Integer -> Sort #

impossibleTerm :: String -> Int -> Term #

class SgTel a where #

Constructing a singleton telescope.

Minimal complete definition

sgTel

Methods

sgTel :: a -> Telescope #

Instances

SgTel (Dom (ArgName, Type)) # |
Methods sgTel :: Dom (ArgName, Type) -> Telescope #
SgTel (Dom Type) # |
Methods sgTel :: Dom Type -> Telescope #
SgTel (ArgName, Dom Type) # |
Methods sgTel :: (ArgName, Dom Type) -> Telescope #

hackReifyToMeta :: Term #

isHackReifyToMeta :: Term -> Bool #

# Handling blocked terms.

blockingMeta :: Blocked t -> Maybe MetaId #

blocked :: MetaId -> a -> Blocked a #

notBlocked :: a -> Blocked a #

# Simple operations on terms and types.

stripDontCare :: Term -> Term #

Removing a topmost `DontCare` constructor.

arity :: Type -> Nat #

Doesn't do any reduction.

notInScopeName :: ArgName -> ArgName #

Make a name that is not in scope.

class Suggest a b where #

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

Minimal complete definition

suggest

Methods

suggest :: a -> b -> String #

Instances

Suggest String String # |
Methods suggest :: String -> String -> String #
Suggest String (Abs b) # |
Methods suggest :: String -> Abs b -> String #
Suggest Name (Abs b) # |
Methods suggest :: Name -> Abs b -> String #
Suggest (Abs a) (Abs b) # |
Methods suggest :: Abs a -> Abs b -> String #

# Eliminations.

unSpine :: Term -> Term #

Convert top-level postfix projections into prefix projections.

unSpine' :: (ProjOrigin -> Bool) -> Term -> Term #

Convert `Proj` projection eliminations according to their `ProjOrigin` into `Def` projection applications.

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

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

argFromElim :: Elim' a -> Arg a #

Drop `Apply` constructor. (Unsafe!)

isApplyElim :: Elim' a -> Maybe (Arg a) #

Drop `Apply` constructor. (Safe)

allApplyElims :: [Elim' a] -> Maybe [Arg a] #

Drop `Apply` constructors. (Safe)

splitApplyElims :: [Elim' a] -> ([Arg a], [Elim' a]) #

Split at first non-`Apply`

class IsProjElim e where #

Minimal complete definition

isProjElim

Methods

isProjElim :: e -> Maybe (ProjOrigin, QName) #

Instances

IsProjElim Elim # |
Methods isProjElim :: Elim -> Maybe (ProjOrigin, QName) #
IsProjElim e => IsProjElim (MaybeReduced e) # |
Methods isProjElim :: MaybeReduced e -> Maybe (ProjOrigin, QName) #

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

Discard `Proj f` entries.

argsFromElims :: Elims -> Args #

Discards `Proj f` entries.

allProjElims :: Elims -> Maybe [(ProjOrigin, QName)] #

Drop `Proj` constructors. (Safe)

# Null instances.

# Show instances.

# Sized instances and TermSize.

class TermSize a where #

The size of a term is roughly the number of nodes in its syntax tree. This number need not be precise for logical correctness of Agda, it is only used for reporting (and maybe decisions regarding performance).

Not counting towards the term size are:

- sort and color annotations,
- projections.

Minimal complete definition

tsize

Methods

termSize :: a -> Int #

tsize :: a -> Sum Int #

Instances

TermSize LevelAtom # |
Methods termSize :: LevelAtom -> Int # tsize :: LevelAtom -> Sum Int #
TermSize PlusLevel # |
Methods termSize :: PlusLevel -> Int # tsize :: PlusLevel -> Sum Int #
TermSize Level # |
Methods termSize :: Level -> Int # tsize :: Level -> Sum Int #
TermSize Sort # |
Methods termSize :: Sort -> Int # tsize :: Sort -> Sum Int #
TermSize Term # |
Methods termSize :: Term -> Int # tsize :: Term -> Sum Int #
(Foldable t, TermSize a) => TermSize (t a) # |
Methods termSize :: t a -> Int # tsize :: t a -> Sum Int #
TermSize a => TermSize (Substitution' a) # |
Methods termSize :: Substitution' a -> Int # tsize :: Substitution' a -> Sum Int #

# KillRange instances.

# UniverseBi instances.

# Simple pretty printing

pDom :: LensHiding a => a -> Doc -> Doc #

# NFData instances

module Agda.Syntax.Abstract.Name

module Agda.Utils.Pointer

newtype MetaId #

A meta variable identifier is just a natural number.

Constructors

MetaId |
Fields metaId :: Nat

Instances

Enum MetaId # |
Methods succ :: MetaId -> MetaId # pred :: MetaId -> MetaId # toEnum :: Int -> MetaId # fromEnum :: MetaId -> Int # enumFrom :: MetaId -> [MetaId] # enumFromThen :: MetaId -> MetaId -> [MetaId] # enumFromTo :: MetaId -> MetaId -> [MetaId] # enumFromThenTo :: MetaId -> MetaId -> MetaId -> [MetaId] #
Eq MetaId # |
Methods (==) :: MetaId -> MetaId -> Bool # (/=) :: MetaId -> MetaId -> Bool #
Integral MetaId # |
Methods quot :: MetaId -> MetaId -> MetaId # rem :: MetaId -> MetaId -> MetaId # div :: MetaId -> MetaId -> MetaId # mod :: MetaId -> MetaId -> MetaId # quotRem :: MetaId -> MetaId -> (MetaId, MetaId) # divMod :: MetaId -> MetaId -> (MetaId, MetaId) # toInteger :: MetaId -> Integer #
Num MetaId # |
Methods (+) :: MetaId -> MetaId -> MetaId # (-) :: MetaId -> MetaId -> MetaId # (*) :: MetaId -> MetaId -> MetaId # negate :: MetaId -> MetaId # abs :: MetaId -> MetaId # signum :: MetaId -> MetaId # fromInteger :: Integer -> MetaId #
Ord MetaId # |
Methods compare :: MetaId -> MetaId -> Ordering # (<) :: MetaId -> MetaId -> Bool # (<=) :: MetaId -> MetaId -> Bool # (>) :: MetaId -> MetaId -> Bool # (>=) :: MetaId -> MetaId -> Bool # max :: MetaId -> MetaId -> MetaId # min :: MetaId -> MetaId -> MetaId #
Real MetaId # |
Methods toRational :: MetaId -> Rational #
Show MetaId # | Show non-record version of this newtype.
Methods showsPrec :: Int -> MetaId -> ShowS # show :: MetaId -> String # showList :: [MetaId] -> ShowS #
NFData MetaId # |
Methods rnf :: MetaId -> () #
Pretty MetaId # |
Methods pretty :: MetaId -> Doc # prettyPrec :: Int -> MetaId -> Doc #
GetDefs MetaId # |
Methods getDefs :: MonadGetDefs m => MetaId -> m () #
HasFresh MetaId # |
Methods freshLens :: Lens' MetaId TCState # nextFresh' :: MetaId -> MetaId #
UnFreezeMeta MetaId # |
Methods unfreezeMeta :: MetaId -> TCM () #
IsInstantiatedMeta MetaId # |
Methods isInstantiatedMeta :: MetaId -> TCM Bool #
PrettyTCM MetaId # |
Methods prettyTCM :: MetaId -> TCM Doc #
FromTerm MetaId # |
Methods fromTerm :: TCM (FromTermFunction MetaId) #
ToTerm MetaId # |
Methods toTerm :: TCM (MetaId -> Term) # toTermR :: TCM (MetaId -> ReduceM Term) #
PrimTerm MetaId # |
Methods primTerm :: MetaId -> TCM Term #
Unquote MetaId # |
Methods unquote :: Term -> UnquoteM MetaId #
Reify MetaId Expr # |
Methods reify :: MetaId -> TCM Expr # reifyWhen :: Bool -> MetaId -> TCM Expr #