|
|
|
|
|
| Description |
This module defines the refinement problem we are solving in all
generality.
Given the definitions here the goal is to allow construction
of Derivation from Core.DerivationTree.
|
|
| Synopsis |
|
|
|
|
| Program and Region
|
|
| class Syn syn => Prog syn prog | prog -> syn where |
| The program we are reasoning about with syntax defined by syn.
| | | Methods | | | Instances | |
|
|
| type Code syn = Tree syn |
| Syntax tree of a program
|
|
| class Eq syn => Syn syn where |
| Syntactic element of a program. In other words, a node in the syntax tree.
| | | Methods | | arity :: syn -> Arity | | How many children does this node have?
| | | isAssoc :: syn -> Bool | | Does associativity rule hold for this node?
|
| | Instances | |
|
|
| data Arity |
| Number of children of a node in a syntax tree.
| | Constructors | | Instances | |
|
|
| data Region |
Regions are used to adress a subprogram withing a program. All functions
working with regions may assume a correct region, which
- contains only non-negative values
- has (length firstNode) == (length lastNode)
- has firstNode !! i == lastNode !! i for all i < length firstNode
The result p' of select p (Region firstNode lastNode) given a correct region
is defined as follows:
- if firstNode == lastNode then p' is the node addressed by firstNode in p.
- If last firstNode < last lastNode and the node x adressed by
init firstNode in p is associative (see isAssoc) then p'
consists of x with children numbered last firstNode to last lastNode.
- Otherwise an error.
For instance the whole program is given by Region [] [].
| | Constructors | | Instances | |
|
|
| Rules
|
|
| data Rule prog |
|
|
| data RuleApp prog |
| Result of a rule application
| | Constructors | | RuleApp | | | rule :: String | The name of the rule used
| | region :: (Maybe Region) | Nothing for rules that replace the whole program.
| | args :: [RuleArg] | All the arguments passed to the rule
| | origin :: prog | The original program to which the rule was applied.
| | result :: prog | | | cond :: [Condition] | |
|
| Instances | |
|
|
| data RuleArg |
| Constructors | | forall a . Boxable a => RuleArg a | |
| Instances | |
|
|
| Monad for user interaction
|
|
| class Monad m => MonadI_ m where |
| | Methods | | | Instances | |
|
|
| class (MonadI_ m, MonadError' e m) => MonadI e m |
| Instances | |
|
|
| Conditions
|
|
| data Condition |
| Side conditions produced when applying rules together
with their proofs.
| | Constructors | | forall cond proof . ConditionPair cond proof => Condition cond proof | |
| Instances | |
|
|
| class (Boxable cond, Boxable proof, Solve cond, Check cond proof) => ConditionPair cond proof |
| Instances | |
|
|
| class Solve cond where |
| Basic solver. If you want advanced condition solving
(for instance depending on the program state), implement
it through plugin for the corresponding shell.
| | | Methods | | | Instances | |
|
|
| data Solver cond |
| Constructors | | forall proof . (Boxable proof, Check cond proof) => Solver Doc (cond -> IO proof) | |
|
|
|
| class Check cond proof where |
| Checking should go without user interaction.
That means the proof must contain all information
to automatically check the condition. Checking
might involve reading from an external file
(e.g. Isabelle theory), that's why IO.
| | | Methods | | check :: cond -> proof -> IO (Maybe SError) |
| | Instances | |
|
|
| Boxable values
|
|
| class (Interfaced a, Storable a) => Boxable a |
| Instances | |
|
|
| class (Typeable a, Show a) => Storable a |
| All objects inside an existential box must belong to
this class in order for the box to be storable
(serializable).
| | Instances | |
|
|
| The Goal:
|
|
| data Derivation prog |
| Constructors | | Instances | |
|
|
| Errors
|
|
| type SError = String |
|
| type NodeError syn = (SError, NodePos, Code syn) |
| Error corresponding to some node in the program
|
|
| Produced by Haddock version 0.8 |