tip-lib-0.2.2: tons of inductive problems - support library and tools

Safe HaskellNone
LanguageHaskell2010

Tip.Core

Contents

Description

General functions for constructing and examining Tip syntax.

Synopsis

Documentation

module Tip.Types

Constructing expressions

(===) :: Expr a -> Expr a -> Expr a infix 4 Source

(=/=) :: Expr a -> Expr a -> Expr a Source

neg :: Expr a -> Expr a Source

(/\) :: Expr a -> Expr a -> Expr a Source

(\/) :: Expr a -> Expr a -> Expr a Source

ands :: [Expr a] -> Expr a Source

ors :: [Expr a] -> Expr a Source

(==>) :: Expr a -> Expr a -> Expr a infixr 1 Source

(===>) :: [Expr a] -> Expr a -> Expr a infixr 0 Source

mkQuant :: Quant -> [Local a] -> Expr a -> Expr a Source

makeIf :: Expr a -> Expr a -> Expr a -> Expr a Source

applyFunction :: Function a -> [Type a] -> [Expr a] -> Expr a Source

applySignature :: Signature a -> [Type a] -> [Expr a] -> Expr a Source

apply :: Expr a -> [Expr a] -> Expr a Source

applyTypeIn :: Ord a => ((Type a -> Type a) -> f a -> f a) -> [a] -> [Type a] -> f a -> f a Source

applyType :: Ord a => [a] -> [Type a] -> Type a -> Type a Source

applyTypeInExpr :: Ord a => [a] -> [Type a] -> Expr a -> Expr a Source

applyTypeInDecl :: Ord a => [a] -> [Type a] -> Decl a -> Decl a Source

applyPolyType :: Ord a => PolyType a -> [Type a] -> ([Type a], Type a) Source

gblType :: Ord a => Global a -> ([Type a], Type a) Source

makeLets :: [(Local a, Expr a)] -> Expr a -> Expr a Source

Predicates and examinations on expressions

collectLets :: Expr a -> ([(Local a, Expr a)], Expr a) Source

forallView :: Expr a -> ([Local a], Expr a) Source

data DeepPattern a Source

A representation of Nested patterns, used in patternMatchingView

patternMatchingView :: Ord a => [Local a] -> Expr a -> [([DeepPattern a], Expr a)] Source

Match as left-hand side pattern-matching definitions

Stops at default patterns, for simplicity

ifView :: Expr a -> Maybe (Expr a, Expr a, Expr a) Source

projAt :: Expr a -> Maybe (Expr a, Expr a) Source

occurrences :: Eq a => Local a -> Expr a -> Int Source

signature :: Function a -> Signature a Source

The signature of a function

funcType :: Function a -> PolyType a Source

The type of a function

bound :: Ord a => Expr a -> [Local a] Source

free :: Ord a => Expr a -> [Local a] Source

locals :: Ord a => Expr a -> [Local a] Source

globals :: (UniverseBi (t a) (Global a), UniverseBi (t a) (Type a), Ord a) => t a -> [a] Source

tyVars :: Ord a => Type a -> [a] Source

freeTyVars :: Ord a => Expr a -> [a] Source

exprType :: Ord a => Expr a -> Type a Source

The type of an expression

builtinType :: Ord a => Builtin -> [Type a] -> Type a Source

The result type of a built in function, applied to some types

theoryTypes :: (UniverseBi (t a) (Type a), Ord a) => t a -> [Type a] Source

Substition and refreshing

freshen :: Name a => Expr a -> Fresh (Expr a) Source

freshenNames :: (TransformBi a (f a), Name a) => [a] -> f a -> Fresh (f a) Source

(//) :: Name a => Expr a -> Local a -> Expr a -> Fresh (Expr a) Source

Substitution, of local variables

Since there are only rank-1 types, bound variables from lambdas and case never have a forall type and thus are not applied to any types.

substMany :: Name a => [(Local a, Expr a)] -> Expr a -> Fresh (Expr a) Source

letExpr :: Name a => Expr a -> (Local a -> Fresh (Expr a)) -> Fresh (Expr a) Source

unsafeSubst :: Ord a => Expr a -> Local a -> Expr a -> Expr a Source

Substitution, but without refreshing. Only use when the replacement expression contains no binders (i.e. no lambdas, no lets, no quantifiers), since the binders are not refreshed at every insertion point.

Making new locals and functions

Matching

matchTypesIn :: Ord a => [a] -> [(Type a, Type a)] -> Maybe [Type a] Source

matchTypes :: Ord a => [(Type a, Type a)] -> Maybe [(a, Type a)] Source

makeGlobal :: Ord a => a -> PolyType a -> [Type a] -> Maybe (Type a) -> Maybe (Global a) Source

Data types

Operations on theories

theoryGoals :: Theory a -> ([Formula a], [Formula a]) Source

Goals in first component, assertions in second

partitionGoals :: [Formula a] -> ([Formula a], [Formula a]) Source

Goals in first component, assertions in second

mapDecls :: forall a b. (forall t. Traversable t => t a -> t b) -> Theory a -> Theory b Source

Topologically sorting definitions

topsort :: (Ord a, Definition f) => [f a] -> [[f a]] Source

data (f :+: g) a Source

Constructors

InL (f a) 
InR (g a) 

Instances

(Functor f, Functor g) => Functor ((:+:) f g) Source 
(Definition f, Definition g) => Definition ((:+:) f g) Source 
(Eq (f a), Eq (g a)) => Eq ((:+:) f g a) Source 
(Ord (f a), Ord (g a)) => Ord ((:+:) f g a) Source 
(Show (f a), Show (g a)) => Show ((:+:) f g a) Source