Mikan
Safe HaskellNone
LanguageHaskell2010

Mikan.TypeChecking.Free.Base

Synopsis

Set of meta variables.

newtype MetaSet Source #

A set of meta variables. Forms a monoid under union.

Constructors

MetaSet 

Instances

Instances details
Pretty MetaSet Source # 
Instance details

Defined in Mikan.TypeChecking.Free.Base

PrettyTCM MetaSet Source # 
Instance details

Defined in Mikan.TypeChecking.Pretty

Methods

prettyTCM :: MonadPretty m => MetaSet -> m Doc Source #

Null MetaSet Source # 
Instance details

Defined in Mikan.TypeChecking.Free.Base

Monoid MetaSet Source # 
Instance details

Defined in Mikan.TypeChecking.Free.Base

Semigroup MetaSet Source # 
Instance details

Defined in Mikan.TypeChecking.Free.Base

Show MetaSet Source # 
Instance details

Defined in Mikan.TypeChecking.Free.Base

Eq MetaSet Source # 
Instance details

Defined in Mikan.TypeChecking.Free.Base

Methods

(==) :: MetaSet -> MetaSet -> Bool #

(/=) :: MetaSet -> MetaSet -> Bool #

Singleton MetaId MetaSet Source # 
Instance details

Defined in Mikan.TypeChecking.Free.Base

foldrMetaSet :: (MetaId -> a -> a) -> a -> MetaSet -> a Source #

Flexible and rigid occurrences (semigroup)

data FlexRig' a Source #

Depending on the surrounding context of a variable, it's occurrence can be classified as flexible or rigid, with finer distinctions.

The constructors are listed in increasing order (wrt. information content).

Constructors

Flexible !a

In arguments of metas. The set of metas is used by 'NonLinMatch' to generate the right blocking information. The semantics is that the status of a variable occurrence may change if one of the metas in the set gets solved. We may say the occurrence is tainted by the meta variables in the set.

WeaklyRigid

In arguments to variables and definitions.

Unguarded

In top position, or only under inductive record constructors (unit).

StronglyRigid

Under at least one and only inductive constructors.

Instances

Instances details
Functor FlexRig' Source # 
Instance details

Defined in Mikan.TypeChecking.Free.Base

Methods

fmap :: (a -> b) -> FlexRig' a -> FlexRig' b #

(<$) :: a -> FlexRig' b -> FlexRig' a #

Foldable FlexRig' Source # 
Instance details

Defined in Mikan.TypeChecking.Free.Base

Methods

fold :: Monoid m => FlexRig' m -> m #

foldMap :: Monoid m => (a -> m) -> FlexRig' a -> m #

foldMap' :: Monoid m => (a -> m) -> FlexRig' a -> m #

foldr :: (a -> b -> b) -> b -> FlexRig' a -> b #

foldr' :: (a -> b -> b) -> b -> FlexRig' a -> b #

foldl :: (b -> a -> b) -> b -> FlexRig' a -> b #

foldl' :: (b -> a -> b) -> b -> FlexRig' a -> b #

foldr1 :: (a -> a -> a) -> FlexRig' a -> a #

foldl1 :: (a -> a -> a) -> FlexRig' a -> a #

toList :: FlexRig' a -> [a] #

null :: FlexRig' a -> Bool #

length :: FlexRig' a -> Int #

elem :: Eq a => a -> FlexRig' a -> Bool #

maximum :: Ord a => FlexRig' a -> a #

minimum :: Ord a => FlexRig' a -> a #

sum :: Num a => FlexRig' a -> a #

product :: Num a => FlexRig' a -> a #

Pretty a => Pretty (FlexRig' a) Source # 
Instance details

Defined in Mikan.TypeChecking.Free.Base

PrettyTCM a => PrettyTCM (FlexRig' a) Source # 
Instance details

Defined in Mikan.TypeChecking.Pretty

Methods

prettyTCM :: MonadPretty m => FlexRig' a -> m Doc Source #

Show a => Show (FlexRig' a) Source # 
Instance details

Defined in Mikan.TypeChecking.Free.Base

Methods

showsPrec :: Int -> FlexRig' a -> ShowS #

show :: FlexRig' a -> String #

showList :: [FlexRig' a] -> ShowS #

Eq a => Eq (FlexRig' a) Source # 
Instance details

Defined in Mikan.TypeChecking.Free.Base

Methods

(==) :: FlexRig' a -> FlexRig' a -> Bool #

(/=) :: FlexRig' a -> FlexRig' a -> Bool #

LensFlexRig (FlexRig' a) a Source # 
Instance details

Defined in Mikan.TypeChecking.Free.Base

class LensFlexRig o a | o -> a where Source #

Instances

Instances details
LensFlexRig (FlexRig' a) a Source # 
Instance details

Defined in Mikan.TypeChecking.Free.Base

LensFlexRig (VarOcc' a) a Source #

Access to varFlexRig in VarOcc.

Instance details

Defined in Mikan.TypeChecking.Free.Base

addFlexRig :: Semigroup a => FlexRig' a -> FlexRig' a -> FlexRig' a Source #

FlexRig aggregation (additive operation of the semiring). For combining occurrences of the same variable in subterms. This is a refinement of the max operation for FlexRig which would work if Flexible did not have the MetaSet as an argument. Now, to aggregate two Flexible occurrences, we union the involved MetaSets.

composeFlexRig :: Semigroup a => FlexRig' a -> FlexRig' a -> FlexRig' a Source #

FlexRig composition (multiplicative operation of the semiring). For accumulating the context of a variable.

Flexible is dominant. Once we are under a meta, we are flexible regardless what else comes. We taint all variable occurrences under a meta by this meta.

WeaklyRigid is next in strength. Destroys strong rigidity.

StronglyRigid is still dominant over Unguarded.

Unguarded is the unit. It is the top (identity) context.

flexRigToBlocker :: FlexRig -> Blocker Source #

Extract a blocker from an occurrence

Variable occurrence (semigroup)

data VarOcc' a Source #

Occurrence of free variables is classified by a FlexRig.

Constructors

VarOcc 

Fields

Instances

Instances details
Pretty a => Pretty (VarOcc' a) Source # 
Instance details

Defined in Mikan.TypeChecking.Free.Base

PrettyTCM a => PrettyTCM (VarOcc' a) Source # 
Instance details

Defined in Mikan.TypeChecking.Pretty

Methods

prettyTCM :: MonadPretty m => VarOcc' a -> m Doc Source #

Monoid a => Monoid (VarOcc' a) Source #

The neutral element for variable occurrence aggregation is least serious occurrence: flexible. This is also the absorptive element for composeVarOcc, if we ignore the MetaSet in Flexible.

Instance details

Defined in Mikan.TypeChecking.Free.Base

Methods

mempty :: VarOcc' a #

mappend :: VarOcc' a -> VarOcc' a -> VarOcc' a #

mconcat :: [VarOcc' a] -> VarOcc' a #

Semigroup a => Semigroup (VarOcc' a) Source #

The default way of aggregating free variable info from subterms is by adding the variable occurrences. For instance, if we have a pair (t₁,t₂) and t₁ has o₁ the occurrences of a variable x and t₂ has o₂ the occurrences of the same variable, then (t₁,t₂) has mappend o₁ o₂ occurrences of that variable.

From counting Quantity, we extrapolate this to FlexRig: we care most about about StronglyRigid occurrences. E.g., if t₁ has a StronglyRigid occurrence and t₂ a Flexible occurrence, then (t₁,t₂) still has a StronglyRigid occurrence.

VarOcc forms a semiring, and this monoid is the addition of the semiring.

Instance details

Defined in Mikan.TypeChecking.Free.Base

Methods

(<>) :: VarOcc' a -> VarOcc' a -> VarOcc' a #

sconcat :: NonEmpty (VarOcc' a) -> VarOcc' a #

stimes :: Integral b => b -> VarOcc' a -> VarOcc' a #

Show a => Show (VarOcc' a) Source # 
Instance details

Defined in Mikan.TypeChecking.Free.Base

Methods

showsPrec :: Int -> VarOcc' a -> ShowS #

show :: VarOcc' a -> String #

showList :: [VarOcc' a] -> ShowS #

Eq a => Eq (VarOcc' a) Source #

Equality up to origin.

Instance details

Defined in Mikan.TypeChecking.Free.Base

Methods

(==) :: VarOcc' a -> VarOcc' a -> Bool #

(/=) :: VarOcc' a -> VarOcc' a -> Bool #

LensFlexRig (VarOcc' a) a Source #

Access to varFlexRig in VarOcc.

Instance details

Defined in Mikan.TypeChecking.Free.Base

topVarOcc :: VarOcc' a Source #

The absorptive element of variable occurrence under aggregation: strongly rigid.

composeVarOcc :: Semigroup a => VarOcc' a -> VarOcc' a -> VarOcc' a Source #

First argument is the outer occurrence (context) and second is the inner. This multiplicative operation is to modify an occurrence under a context.

constructorFlexRig :: ConHead -> Elims -> FlexRig' a Source #

What's the rigidity of a constructor?

Storing variable occurrences (semimodule).

type TheVarMap' a = IntMap (VarOcc' a) Source #

Representation of a variable set as map from de Bruijn indices to VarOcc.

newtype VarMap' a Source #

Constructors

VarMap 

Fields

Instances

Instances details
Singleton Variable (VarMap' a) Source #

A "set"-style Singleton instance with default/initial variable occurrence.

Instance details

Defined in Mikan.TypeChecking.Free.Base

PrettyTCM a => PrettyTCM (VarMap' a) Source # 
Instance details

Defined in Mikan.TypeChecking.Pretty

Methods

prettyTCM :: MonadPretty m => VarMap' a -> m Doc Source #

Semigroup a => Monoid (VarMap' a) Source # 
Instance details

Defined in Mikan.TypeChecking.Free.Base

Methods

mempty :: VarMap' a #

mappend :: VarMap' a -> VarMap' a -> VarMap' a #

mconcat :: [VarMap' a] -> VarMap' a #

Semigroup a => Semigroup (VarMap' a) Source #

Proper monoid instance for VarMap rather than inheriting the broken one from IntMap. We combine two occurrences of a variable using mappend.

Instance details

Defined in Mikan.TypeChecking.Free.Base

Methods

(<>) :: VarMap' a -> VarMap' a -> VarMap' a #

sconcat :: NonEmpty (VarMap' a) -> VarMap' a #

stimes :: Integral b => b -> VarMap' a -> VarMap' a #

Show a => Show (VarMap' a) Source # 
Instance details

Defined in Mikan.TypeChecking.Free.Base

Methods

showsPrec :: Int -> VarMap' a -> ShowS #

show :: VarMap' a -> String #

showList :: [VarMap' a] -> ShowS #

Eq a => Eq (VarMap' a) Source # 
Instance details

Defined in Mikan.TypeChecking.Free.Base

Methods

(==) :: VarMap' a -> VarMap' a -> Bool #

(/=) :: VarMap' a -> VarMap' a -> Bool #

Plain variable occurrence counting.

Environment for collecting free variables.

data IgnoreSorts Source #

Where should we skip sorts in free variable analysis?

Constructors

IgnoreNot

Do not skip.

IgnoreInAnnotations

Skip when annotation to a type.

IgnoreAll

Skip unconditionally.

Instances

Instances details
Show IgnoreSorts Source # 
Instance details

Defined in Mikan.TypeChecking.Free.Base

Eq IgnoreSorts Source # 
Instance details

Defined in Mikan.TypeChecking.Free.Base

type SingleVar c = Variable -> c Source #