Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- type ArgumentIndex = Int
- newtype CallMatrix' a = CallMatrix {
- mat :: Matrix ArgumentIndex a
- type CallMatrix = CallMatrix' Order
- class CallComb a where
- (>*<) :: a -> a -> a
- data CallMatrixAug cinfo = CallMatrixAug {
- augCallMatrix :: CallMatrix
- augCallInfo :: cinfo
- noAug :: Monoid cinfo => CallMatrix -> CallMatrixAug cinfo
- newtype CMSet cinfo = CMSet {
- cmSet :: Favorites (CallMatrixAug cinfo)
- insert :: CallMatrixAug cinfo -> CMSet cinfo -> CMSet cinfo
- union :: CMSet cinfo -> CMSet cinfo -> CMSet cinfo
- toList :: CMSet cinfo -> [CallMatrixAug cinfo]
Documentation
type ArgumentIndex = Int Source #
Call matrix indices = function argument indices.
Machine integer Int
is sufficient, since we cannot index more arguments
than we have addresses on our machine.
newtype CallMatrix' a Source #
Call matrices.
A call matrix for a call f --> g
has dimensions ar(g) × ar(f)
.
Each column corresponds to one formal argument of caller f
.
Each row corresponds to one argument in the call to g
.
In the presence of dot patterns, a call argument can be related
to several different formal arguments of f
.
See e.g. testsucceedDotPatternTermination.agda
:
data D : Nat -> Set where cz : D zero c1 : forall n -> D n -> D (suc n) c2 : forall n -> D n -> D n f : forall n -> D n -> Nat f .zero cz = zero f .(suc n) (c1 n d) = f n (c2 n d) f n (c2 .n d) = f n d
Call matrices (without guardedness) are
-1 -1 n < suc n and n < c1 n d ? = c2 n d <= c1 n d = -1 n <= n and n < c2 n d ? -1 d < c2 n d
Here is a part of the original documentation for call matrices (kept for historical reasons):
This datatype encodes information about a single recursive
function application. The columns of the call matrix stand for
source
function arguments (patterns). The rows of the matrix stand for
target
function arguments. Element (i, j)
in the matrix should
be computed as follows:
CallMatrix | |
|
Instances
Pretty CallMatrix Source # | |
Defined in Agda.Termination.CallMatrix pretty :: CallMatrix -> Doc Source # prettyPrec :: Int -> CallMatrix -> Doc Source # prettyList :: [CallMatrix] -> Doc Source # | |
CallComb CallMatrix Source # | Call matrix multiplication.
Note the reversed order of multiplication:
The matrix Preconditions:
Postcondition:
|
Defined in Agda.Termination.CallMatrix (>*<) :: CallMatrix -> CallMatrix -> CallMatrix Source # | |
NotWorse CallMatrix Source # | |
Defined in Agda.Termination.CallMatrix notWorse :: CallMatrix -> CallMatrix -> Bool Source # | |
Functor CallMatrix' Source # | |
Defined in Agda.Termination.CallMatrix fmap :: (a -> b) -> CallMatrix' a -> CallMatrix' b (<$) :: a -> CallMatrix' b -> CallMatrix' a # | |
Foldable CallMatrix' Source # | |
Defined in Agda.Termination.CallMatrix fold :: Monoid m => CallMatrix' m -> m foldMap :: Monoid m => (a -> m) -> CallMatrix' a -> m foldMap' :: Monoid m => (a -> m) -> CallMatrix' a -> m foldr :: (a -> b -> b) -> b -> CallMatrix' a -> b foldr' :: (a -> b -> b) -> b -> CallMatrix' a -> b foldl :: (b -> a -> b) -> b -> CallMatrix' a -> b foldl' :: (b -> a -> b) -> b -> CallMatrix' a -> b foldr1 :: (a -> a -> a) -> CallMatrix' a -> a foldl1 :: (a -> a -> a) -> CallMatrix' a -> a toList :: CallMatrix' a -> [a] null :: CallMatrix' a -> Bool length :: CallMatrix' a -> Int elem :: Eq a => a -> CallMatrix' a -> Bool maximum :: Ord a => CallMatrix' a -> a minimum :: Ord a => CallMatrix' a -> a sum :: Num a => CallMatrix' a -> a product :: Num a => CallMatrix' a -> a | |
Traversable CallMatrix' Source # | |
Defined in Agda.Termination.CallMatrix traverse :: Applicative f => (a -> f b) -> CallMatrix' a -> f (CallMatrix' b) sequenceA :: Applicative f => CallMatrix' (f a) -> f (CallMatrix' a) mapM :: Monad m => (a -> m b) -> CallMatrix' a -> m (CallMatrix' b) sequence :: Monad m => CallMatrix' (m a) -> m (CallMatrix' a) | |
PartialOrd a => PartialOrd (CallMatrix' a) Source # | |
Defined in Agda.Termination.CallMatrix comparable :: Comparable (CallMatrix' a) Source # | |
(HasZero a, Show a) => Show (CallMatrix' a) Source # | |
Defined in Agda.Termination.CallMatrix showsPrec :: Int -> CallMatrix' a -> ShowS show :: CallMatrix' a -> String showList :: [CallMatrix' a] -> ShowS | |
Eq a => Eq (CallMatrix' a) Source # | |
Defined in Agda.Termination.CallMatrix (==) :: CallMatrix' a -> CallMatrix' a -> Bool (/=) :: CallMatrix' a -> CallMatrix' a -> Bool | |
Ord a => Ord (CallMatrix' a) Source # | |
Defined in Agda.Termination.CallMatrix compare :: CallMatrix' a -> CallMatrix' a -> Ordering (<) :: CallMatrix' a -> CallMatrix' a -> Bool (<=) :: CallMatrix' a -> CallMatrix' a -> Bool (>) :: CallMatrix' a -> CallMatrix' a -> Bool (>=) :: CallMatrix' a -> CallMatrix' a -> Bool max :: CallMatrix' a -> CallMatrix' a -> CallMatrix' a min :: CallMatrix' a -> CallMatrix' a -> CallMatrix' a | |
HasZero a => Diagonal (CallMatrix' a) a Source # | |
Defined in Agda.Termination.CallMatrix diagonal :: CallMatrix' a -> [a] Source # |
type CallMatrix = CallMatrix' Order Source #
class CallComb a where Source #
Call matrix multiplication and call combination.
Instances
CallComb CallMatrix Source # | Call matrix multiplication.
Note the reversed order of multiplication:
The matrix Preconditions:
Postcondition:
|
Defined in Agda.Termination.CallMatrix (>*<) :: CallMatrix -> CallMatrix -> CallMatrix Source # | |
Monoid cinfo => CallComb (CMSet cinfo) Source # | Call matrix set product is the Cartesian product. |
Monoid cinfo => CallComb (CallMatrixAug cinfo) Source # | Augmented call matrix multiplication. |
Defined in Agda.Termination.CallMatrix (>*<) :: CallMatrixAug cinfo -> CallMatrixAug cinfo -> CallMatrixAug cinfo Source # |
Call matrix augmented with path information.
data CallMatrixAug cinfo Source #
Call matrix augmented with path information.
CallMatrixAug | |
|
Instances
noAug :: Monoid cinfo => CallMatrix -> CallMatrixAug cinfo Source #
Non-augmented call matrix.
Sets of incomparable call matrices augmented with path information.
Sets of incomparable call matrices augmented with path information.
Use overloaded null
, empty
, singleton
, mappend
.
CMSet | |
|
Instances
Pretty cinfo => Pretty (CMSet cinfo) Source # | |
Monoid cinfo => CallComb (CMSet cinfo) Source # | Call matrix set product is the Cartesian product. |
Null (CMSet cinfo) Source # | |
Monoid (CMSet cinfo) Source # | |
Semigroup (CMSet cinfo) Source # | |
Show cinfo => Show (CMSet cinfo) Source # | |
Collection (Call cinfo) (CallGraph cinfo) Source # | |
Singleton (Call cinfo) (CallGraph cinfo) Source # | |
Singleton (CallMatrixAug cinfo) (CMSet cinfo) Source # | |
Defined in Agda.Termination.CallMatrix singleton :: CallMatrixAug cinfo -> CMSet cinfo Source # |
toList :: CMSet cinfo -> [CallMatrixAug cinfo] Source #
Convert into a list of augmented call matrices.