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

Safe HaskellNone
LanguageHaskell2010

Agda.TypeChecking.Monad.SizedTypes

Contents

Description

Stuff for sized types that does not require modules Agda.TypeChecking.Reduce or Agda.TypeChecking.Constraints (which import Agda.TypeChecking.Monad).

Synopsis

Testing for type Size

data BoundedSize #

Result of querying whether size variable i is bounded by another size.

Constructors

BoundedLt Term

yes i : Size< t

BoundedNo 

class IsSizeType a where #

Check if a type is the primSize type. The argument should be reduced.

Minimal complete definition

isSizeType

Methods

isSizeType :: a -> TCM (Maybe BoundedSize) #

haveSizedTypes :: TCM Bool #

Test whether OPTIONS --sized-types and whether the size built-ins are defined.

builtinSizeHook :: String -> QName -> Type -> TCM () #

Add polarity info to a SIZE builtin.

Constructors

sizeSort :: Sort #

The sort of built-in types SIZE and SIZELT.

sizeUniv :: Type #

The type of built-in types SIZE and SIZELT.

sizeType_ :: QName -> Type #

The built-in type SIZE with user-given name.

sizeType :: TCM Type #

The built-in type SIZE.

sizeSucName :: TCM (Maybe QName) #

The name of SIZESUC.

sizeMax :: [Term] -> TCM Term #

Transform list of terms into a term build from binary maximum.

Viewing and unviewing sizes

data SizeView #

A useful view on sizes.

type Offset = Nat #

sizeViewComparable :: DeepSizeView -> DeepSizeView -> SizeViewComparable () #

sizeViewComparable v w checks whether v >= w (then Left) or v <= w (then Right). If uncomparable, it returns NotComparable.

sizeViewPred :: Nat -> DeepSizeView -> DeepSizeView #

sizeViewPred k v decrements v by k (must be possible!).

sizeViewOffset :: DeepSizeView -> Maybe Offset #

sizeViewOffset v returns the number of successors or Nothing when infty.

removeSucs :: (DeepSizeView, DeepSizeView) -> (DeepSizeView, DeepSizeView) #

Remove successors common to both sides.

unSizeView :: SizeView -> TCM Term #

Turn a size view into a term.

View on sizes where maximum is pulled to the top

maxViewCons :: DeepSizeView -> SizeMaxView -> SizeMaxView #

maxViewCons v ws = max v ws. It only adds v to ws if it is not subsumed by an element of ws.

sizeViewComparableWithMax :: DeepSizeView -> SizeMaxView -> SizeViewComparable SizeMaxView #

sizeViewComparableWithMax v ws tries to find w in ws that compares with v and singles this out. Precondition: v /= DSizeInv.