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

This class serves as data structure of a universally quantified rule. More...

#include <UQRule.h>

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

Public Types

typedef pair< AnonRule, MappingQuantification
 A Quantification consists of a rule and a Mapping from the main rules left-hand side to the Quantifications left-hand side.
 

Public Member Functions

 UQRule (Rule const &mainRule)
 Generates a UQRule without any Quantifications using the given rule as the main rule. More...
 
 UQRule (string name="", AnonHypergraph_sp left=make_shared< AnonHypergraph >(), AnonHypergraph_sp right=make_shared< AnonHypergraph >(), Mapping const &match=Mapping())
 Generates a new UQRule with the given name, left graph, right graph and Mapping. More...
 
virtual ~UQRule ()
 Destroys this UQRule. More...
 
IDType getID () const
 Returns the ID of this UQRule. More...
 
string getName () const
 Returns the name of this UQRule. More...
 
RulegetMainRule ()
 Returns a reference to the main rule encapsulated by this UQRule. More...
 
Rule const & getMainRule () const
 Returns a reference to the main rule encapsulated by this UQRule. More...
 
void addQuantification (AnonRule const &rule, Mapping const &match)
 Adds a Quantification to this UQRule consisting of the given AnonRule and Mapping. More...
 
void addQuantification (Quantification const &quantification)
 Adds the given Quantification to this UQRule. More...
 
size_t getQuantCount () const
 Returns the number of Quantifications of this UQRule. More...
 
vector< Quantification > & getQuantifications ()
 Returns a reference to the vector storing the Quantifications of this UQRule. More...
 
vector< Quantification > const & getQuantifications () const
 Returns a reference to the vector storing the Quantifications of this UQRule. More...
 
UQRuleInstance_sp createInstance (vector< unsigned int > const &quantities, vector< unordered_set< IDType >> *genLeft=nullptr, vector< unordered_set< IDType >> *genRight=nullptr) const
 Generates and returns the instantiation of this UQRule where each Quantification is added as often specified by the given vector of quantities. More...
 
UQRuleInstance_sp createZeroInstance () const
 Generates and returns the instantiation of this UQRule where no Quantification is added. More...
 
UQRuleInstance_sp createOneInstance (vector< unordered_set< IDType >> *genLeft=nullptr, vector< unordered_set< IDType >> *genRight=nullptr) const
 Generates and returns the instantiation of this UQRule where each Quantification is added exactly once. More...
 
UQRuleInstance_sp extendInstance (UQRuleInstance_csp rule, size_t quantID, vector< unordered_set< IDType >> *genLeft=nullptr, vector< unordered_set< IDType >> *genRight=nullptr) const
 Generates and returns a new instantiation of this UQRule by copying the given instance and adding the Quantification with the given index. More...
 
virtual void streamTo (std::ostream &ost) const override
 Streams as string representation of this Streamable object to the given ostream. More...
 

Private Member Functions

void extendRuleByUQ (UQRuleInstance &rule, size_t quantID, vector< unordered_set< IDType >> *genLeft, vector< unordered_set< IDType >> *genRight) const
 Generates a new instantiation of this UQRule by adding the Quantification with the given index to the given instance. More...
 
bool checkVertices (AnonHypergraph_csp graph, IDType const &edgeID, Mapping const &vmap, vector< IDType > &vertices) const
 Checks if all vertices incident to the given edge (given as edge ID) of the given graph have an image in the given Mapping. More...
 

Private Attributes

Rule mainRule
 Stores the main rule of this UQRule. More...
 
vector< Quantificationquantifications
 Stores the Quantifications of this UQRule, which will later be indexed by their position in this vector.
 
unordered_set< IDTypeleftUQVertices
 Every universally quantified vertex in the main rules left-hand side is stored in this set. More...
 
unordered_set< IDTyperightUQVertices
 For all universally quantified vertices this set stores their image in the main rules right-hand side.
 

Detailed Description

This class serves as data structure of a universally quantified rule.

These rules consist of a main rule and a (finite) set of universal quantifications. Before applying such a rule, we first need to instantiate the rule by generating UQRuleInstances. The theory of universally quantified rules is described in "Parameterized verification of graph transformation systems with whole neighbourhood operations" by Delzanno and Stückrath.

See Also
UQRuleInstance
Author
Jan Stückrath

Constructor & Destructor Documentation

UQRule ( Rule const &  mainRule)

Generates a UQRule without any Quantifications using the given rule as the main rule.

Parameters
mainRulethe Rule to be used as main rule (the rule will be copied)
UQRule ( string  name = "",
AnonHypergraph_sp  left = make_shared<AnonHypergraph>(),
AnonHypergraph_sp  right = make_shared<AnonHypergraph>(),
Mapping const &  match = Mapping() 
)

Generates a new UQRule with the given name, left graph, right graph and Mapping.

This constructor does not generate any Quantifications.

Parameters
namethe name of the new UQRule
leftthe left graph of the main rule
rightthe right graph of the main rule
matcha Mapping from the left to the right graph, used for the main rule
~UQRule ( )
virtual

Destroys this UQRule.

This also destroys the encapsulated main rule.

Member Function Documentation

void addQuantification ( AnonRule const &  rule,
Mapping const &  match 
)

Adds a Quantification to this UQRule consisting of the given AnonRule and Mapping.

The AnonRule may be any rule and the Mapping has to be a total injective Mapping from the left-hand side of the main rule to the left-hand side of the given rule. However, the composition of the given mapping and rule must be total and injective, and the given rule may only merge elements which have no preimage in the main rules left-hand side. The validity of the parameters is assumed and not checked!

Parameters
rulethe rule part of the quantification
matcha Mapping from the main rules left-hand side to the given rules left-hand side
void addQuantification ( Quantification const &  quantification)

Adds the given Quantification to this UQRule.

The validity of the given Quantification is assumed and not checked!

See Also
addQuantification(AnonRule const&, Mapping const&)
Parameters
quantificationthe Quantification to be added
bool checkVertices ( AnonHypergraph_csp  graph,
IDType const &  edgeID,
Mapping const &  vmap,
vector< IDType > &  vertices 
) const
private

Checks if all vertices incident to the given edge (given as edge ID) of the given graph have an image in the given Mapping.

If this is the case, the images of all incident vertices are stores in the given vector, maintaining their order.

Parameters
graphthe graph to which the edgeID belongs
edgeIDthe ID of the edge of which the incident vertices will be checked
vmapthe Mapping used for checking the vertex IDs
verticesa vector in which the images of incident vertices will be stored
Returns
true iff all incident vertices have an image under the given Mapping
UQRuleInstance_sp createInstance ( vector< unsigned int > const &  quantities,
vector< unordered_set< IDType >> *  genLeft = nullptr,
vector< unordered_set< IDType >> *  genRight = nullptr 
) const

Generates and returns the instantiation of this UQRule where each Quantification is added as often specified by the given vector of quantities.

The i-th value in the vector specifies how often the i-th Quantification is used. If desired, the set of IDs generated by this function in the left and right graphs can be stored.

Parameters
quantitiesspecifies how often each Quantification is used for this instantiation
genLeftif non-null, all IDs of elements generated in the left-hand side for this instantiation will be stored in this vector, sorted by Quantification
genRightif non-null, all IDs of elements generated in the right-hand side for this instantiation will be stored in this vector, sorted by Quantification
Returns
the generated instantiation; the returned pointed object may be freely changed without affecting this UQRule
UQRuleInstance_sp createOneInstance ( vector< unordered_set< IDType >> *  genLeft = nullptr,
vector< unordered_set< IDType >> *  genRight = nullptr 
) const

Generates and returns the instantiation of this UQRule where each Quantification is added exactly once.

If desired, the set of IDs generated by this function in the left and right graphs can be stored.

Parameters
genLeftif non-null, all IDs of elements generated in the left-hand side for this instantiation will be stored in this vector, sorted by Quantification
genRightif non-null, all IDs of elements generated in the right-hand side for this instantiation will be stored in this vector, sorted by Quantification
Returns
the generated instantiation; the returned pointed object may be freely changed without affecting this UQRule
UQRuleInstance_sp createZeroInstance ( ) const

Generates and returns the instantiation of this UQRule where no Quantification is added.

Returns
the zero instance of this UQRule; the returned pointed object may be freely changed without affecting this UQRule
UQRuleInstance_sp extendInstance ( UQRuleInstance_csp  rule,
size_t  quantID,
vector< unordered_set< IDType >> *  genLeft = nullptr,
vector< unordered_set< IDType >> *  genRight = nullptr 
) const

Generates and returns a new instantiation of this UQRule by copying the given instance and adding the Quantification with the given index.

If desired, the set of IDs generated by this function in the left and right graphs can be stored.

Parameters
rulethe instance to be copied
quantIDthe ID/index of the Quantification to be added
genLeftif non-null, all IDs of elements generated in the left-hand side for this instantiation will be stored in this vector, sorted by Quantification
genRightif non-null, all IDs of elements generated in the right-hand side for this instantiation will be stored in this vector, sorted by Quantification
Returns
the generated instantiation; the returned pointed object may be freely changed without affecting this UQRule of the given instantiation
void extendRuleByUQ ( UQRuleInstance rule,
size_t  quantID,
vector< unordered_set< IDType >> *  genLeft,
vector< unordered_set< IDType >> *  genRight 
) const
private

Generates a new instantiation of this UQRule by adding the Quantification with the given index to the given instance.

If desired, the set of IDs generated by this function in the left and right graphs can be stored.

Parameters
rulethe instantiation to which the Quantification will be added
quantIDthe ID/index of the Quantification to be added
genLeftif non-null, all IDs of elements generated in the left-hand side for this instantiation will be stored in this vector, sorted by Quantification
genRightif non-null, all IDs of elements generated in the right-hand side for this instantiation will be stored in this vector, sorted by Quantification
IDType getID ( ) const

Returns the ID of this UQRule.

Returns
the ID of this UQRule
Rule & getMainRule ( )

Returns a reference to the main rule encapsulated by this UQRule.

Returns
a reference to the main rule
Rule const & getMainRule ( ) const

Returns a reference to the main rule encapsulated by this UQRule.

Returns
a reference to the main rule
string getName ( ) const

Returns the name of this UQRule.

Returns
the name of this UQRule
size_t getQuantCount ( ) const

Returns the number of Quantifications of this UQRule.

Returns
the number of Quantifications of this UQRule
vector< UQRule::Quantification > & getQuantifications ( )

Returns a reference to the vector storing the Quantifications of this UQRule.

Returns
a reference to the vector storing the Quantifications of this UQRule
vector< UQRule::Quantification > const & getQuantifications ( ) const

Returns a reference to the vector storing the Quantifications of this UQRule.

Returns
a reference to the vector storing the Quantifications of this UQRule
void streamTo ( std::ostream &  ost) const
overridevirtual

Streams as string representation of this Streamable object to the given ostream.

Parameters
ostthe stream to which the string representation will be written

Implements Streamable.

Member Data Documentation

unordered_set<IDType> leftUQVertices
private

Every universally quantified vertex in the main rules left-hand side is stored in this set.

A vertex is universally quantified if its image in the left-hand side of some Quantification is incident to an edge which has no preimage in the main rules left-hand side.

Rule mainRule
private

Stores the main rule of this UQRule.

Also contains this UQRules ID and name.


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