UnCoVer (Using Coverability for Verification)
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PreparedGTS Class Reference

The PreparedGTS class represents a graph transformation system that was prepared for use in the backward procedure. More...

#include <PreparedGTS.h>

Inheritance diagram for PreparedGTS:
Inheritance graph
[legend]
Collaboration diagram for PreparedGTS:
Collaboration graph
[legend]

Classes

class  StdRuleMapCB
 The StdRuleMapCB is a helper class defining a CollectionCallback to a PreparedGTS standard rule map. More...
 
class  uqinst_iterator
 The uqinst_iterator generates UQRuleInstances for backward application. More...
 

Public Types

typedef unordered_map< IDType,
Rule_sp > 
RuleMap
 An alias for the map storing standard rules.
 
typedef unordered_map< IDType,
UQRule_sp > 
UQRuleMap
 An alias for the map storing universally quantified rules.
 

Public Member Functions

 PreparedGTS (GTS const &gts, RulePreparer_sp rulePrep, bool opt=true)
 Creates a Prepared GTS using the given GTS and RulePreparer. More...
 
virtual ~PreparedGTS ()
 Destroys this PreparedGTS.
 
PreparedGTS::uqinst_iterator beginUQInstances (IDType const &ruleID, graphs::Hypergraph const &graph)
 Creates and returns an iterator, iterating over all UQRuleInstances of the UQRule with the given ID, which need to be applied backward to the given graph. More...
 
shared_ptr< vector
< graphs::AnonRule_csp > > 
getOriginalRules (IDType id) const
 Creates a new collection which contains all original rules from which the prepared rule with the given ID could have been generated from. More...
 
vector< Hypergraph_sp > const & getInitialGraphs () const
 Returns a reference to the collection of initial graphs of this GTS. More...
 
bool addInitialGraph (Hypergraph_sp graph)
 Adds the given graph to the collection of initial graphs of this GTS. More...
 
size_t getInitialCount () const
 Returns the number of initial graphs of this GTS. More...
 
string getName () const
 Returns the name of this GTS. More...
 
RuleMap const & getStdRules () const
 Returns a reference to the standard rules of this GTS. More...
 
bool addStdRule (Rule_sp rule)
 Adds the given Rule to the standard rules of this GTS. More...
 
size_t getStdRuleCount () const
 Returns the number of standard rules stored in this GTS. More...
 
UQRuleMap const & getUQRules () const
 Returns a reference to the universally quantified rules of this GTS. More...
 
bool addUQRule (UQRule_sp rule)
 Adds the given UQRule to the quantified rules of this GTS. More...
 
size_t getUQRuleCount () const
 Returns the number of universally quantified rules stored in this GTS. More...
 
virtual void streamTo (std::ostream &ost) const
 Prints a string representation of this GTS to the given steam. More...
 

Protected Member Functions

void createInstancesUpTo (IDType const &ruleID, size_t bound)
 Creates and stores all UQRuleInstances for the given UQRule up to the given bound. More...
 

Protected Attributes

const RuleMap oldStdRules
 Stores the RuleMap containing the (unprepared) rules of the original GTS.
 
map< IDType, vector< IDType > > prepFrom
 Stores for every new (prepared) rule the ID of the original rules from which it was prepared. More...
 
RulePreparer_sp rulePreparer
 Stores the RulePreparer used by this PreparedGTS.
 
unordered_map< IDType, vector
< graphs::UQRuleInstance_sp > > 
uqRuleInstances
 For each ID of a UQRule (key) this map stores all UQRuleInstances (value) generated for the corresponding UQRule.
 
unordered_map< IDType, vector
< size_t > > 
uqRuleLengths
 For each ID of a UQRule (key) this map stores a vector of positions (value). More...
 
string name
 Stores the name of the GTS.
 
vector< Hypergraph_sp > initialGraphs
 Stores all initial graphs of this GTS.
 
RuleMap stdRules
 Stores all standard rules of this GTS, indexed by ID.
 
UQRuleMap uqRules
 Stores all quantified rules of this GTS, indexed by ID.
 

Detailed Description

The PreparedGTS class represents a graph transformation system that was prepared for use in the backward procedure.

It is instantiated with a GTS and a RulePreparer object. The standard rules of the GTS are prepared and stored as standard rules of the PreparedGTS. For UQRules, this class provides the uqinst_iterator to iterate over all UQRuleInstances which have to be applied backwards to a given UQRule and graph.

Author
Jan Stückrath
See Also
graphs::GTS
RulePreparer

Constructor & Destructor Documentation

PreparedGTS ( GTS const &  gts,
RulePreparer_sp  rulePrep,
bool  opt = true 
)

Creates a Prepared GTS using the given GTS and RulePreparer.

All rules of the given GTS are prepared and all resulting rules added to this PreparedGTS. If optimization is enabled (default), rules are only added if they are no order morphism wrt. to the order used by the RulePreparer (these rules do not produce new results during the backward search). UQRules are not prepared and just copied.

Parameters
gtsthe GTS of which the rules will be prepared
rulePrepthe RulePreparer used for preparation
optif true (default), then order morphisms will not be added to this PreparedGTS

Member Function Documentation

bool addInitialGraph ( Hypergraph_sp  graph)
inherited

Adds the given graph to the collection of initial graphs of this GTS.

Parameters
graphthe graph to be added to the initial graphs
Returns
true, iff the graph was added (i.e. it was not null)
bool addStdRule ( Rule_sp  rule)
inherited

Adds the given Rule to the standard rules of this GTS.

Parameters
rulethe Rule to be added
Returns
true, iff the rule was added (i.e. it was not null and not already added before)
bool addUQRule ( UQRule_sp  rule)
inherited

Adds the given UQRule to the quantified rules of this GTS.

Parameters
rulethe UQRule to be added
Returns
true, iff the rule was added (i.e. it was not null and not already added before)
PreparedGTS::uqinst_iterator beginUQInstances ( IDType const &  ruleID,
graphs::Hypergraph const &  graph 
)

Creates and returns an iterator, iterating over all UQRuleInstances of the UQRule with the given ID, which need to be applied backward to the given graph.

The number of UQRuleInstance increases exponentially with the complexity of the rule (i.e. the basis is the number of Quantifications) and the size of the graph (the exponent).

Parameters
ruleIDthe ID of the UQRule to be instantiated
graphthe graph to which the UQRule should be applied backwards to
Returns
an iterator, enumerating all necessary instances of the UQRule
void createInstancesUpTo ( IDType const &  ruleID,
size_t  bound 
)
protected

Creates and stores all UQRuleInstances for the given UQRule up to the given bound.

The generated UQRuleInstances are stored in uqRuleInstances and indexed by uqRuleLengths.

Parameters
ruleIDthe ID of the UQRule to be instantiated
boundthe size up to which instances should be generated
size_t getInitialCount ( ) const
inherited

Returns the number of initial graphs of this GTS.

Returns
the number of initial graphs of this GTS
vector< shared_ptr< Hypergraph > > const & getInitialGraphs ( ) const
inherited

Returns a reference to the collection of initial graphs of this GTS.

Returns
a reference to the collection of initial graphs of this GTS
string getName ( ) const
inherited

Returns the name of this GTS.

Returns
the name of this GTS
shared_ptr< vector< AnonRule_csp > > getOriginalRules ( IDType  id) const

Creates a new collection which contains all original rules from which the prepared rule with the given ID could have been generated from.

Parameters
idthe ID of the prepared rule
Returns
the collection of original rules
size_t getStdRuleCount ( ) const
inherited

Returns the number of standard rules stored in this GTS.

Returns
the number of standard rules stored in this GTS
unordered_map< IDType, shared_ptr< Rule > > const & getStdRules ( ) const
inherited

Returns a reference to the standard rules of this GTS.

Returns
a reference to the standard rules of this GTS
size_t getUQRuleCount ( ) const
inherited

Returns the number of universally quantified rules stored in this GTS.

Returns
the number of quantified rules of this GTS
unordered_map< IDType, UQRule_sp > const & getUQRules ( ) const
inherited

Returns a reference to the universally quantified rules of this GTS.

Returns
a reference to the quantified rules of this GTS
void streamTo ( std::ostream &  ost) const
virtualinherited

Prints a string representation of this GTS to the given steam.

Parameters
ostthe stream on which the string will be printed

Implements Streamable.

Member Data Documentation

map<IDType, vector<IDType> > prepFrom
protected

Stores for every new (prepared) rule the ID of the original rules from which it was prepared.

Note that a prepared rule may have multiple original rules from which it was generated, even if these rules where not isomorphic.

unordered_map<IDType, vector<size_t> > uqRuleLengths
protected

For each ID of a UQRule (key) this map stores a vector of positions (value).

The i-th value in the vector is the first position in the corresponding vector of uqRuleInstances (with the same UQRule ID) where the length of the instantiation is i.


The documentation for this class was generated from the following files: