UnCoVer (Using Coverability for Verification)
|
This class serves as data structure of a universally quantified rule. More...
#include <UQRule.h>
Public Types | |
typedef pair< AnonRule, Mapping > | Quantification |
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... | |
Rule & | getMainRule () |
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< Quantification > | quantifications |
Stores the Quantifications of this UQRule, which will later be indexed by their position in this vector. | |
unordered_set< IDType > | leftUQVertices |
Every universally quantified vertex in the main rules left-hand side is stored in this set. More... | |
unordered_set< IDType > | rightUQVertices |
For all universally quantified vertices this set stores their image in the main rules right-hand side. | |
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.
UQRule | ( | string | name = "" , |
AnonHypergraph_sp | left = make_shared<AnonHypergraph>() , |
||
AnonHypergraph_sp | right = make_shared<AnonHypergraph>() , |
||
Mapping const & | match = Mapping() |
||
) |
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!
rule | the rule part of the quantification |
match | a 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!
quantification | the Quantification to be added |
|
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.
graph | the graph to which the edgeID belongs |
edgeID | the ID of the edge of which the incident vertices will be checked |
vmap | the Mapping used for checking the vertex IDs |
vertices | a vector in which the images of incident vertices will be stored |
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.
quantities | specifies how often each Quantification is used for this instantiation |
genLeft | if non-null, all IDs of elements generated in the left-hand side for this instantiation will be stored in this vector, sorted by Quantification |
genRight | if non-null, all IDs of elements generated in the right-hand side for this instantiation will be stored in this vector, sorted by Quantification |
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.
genLeft | if non-null, all IDs of elements generated in the left-hand side for this instantiation will be stored in this vector, sorted by Quantification |
genRight | if non-null, all IDs of elements generated in the right-hand side for this instantiation will be stored in this vector, sorted by Quantification |
UQRuleInstance_sp createZeroInstance | ( | ) | const |
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.
rule | the instance to be copied |
quantID | the ID/index of the Quantification to be added |
genLeft | if non-null, all IDs of elements generated in the left-hand side for this instantiation will be stored in this vector, sorted by Quantification |
genRight | if non-null, all IDs of elements generated in the right-hand side for this instantiation will be stored in this vector, sorted by Quantification |
|
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.
rule | the instantiation to which the Quantification will be added |
quantID | the ID/index of the Quantification to be added |
genLeft | if non-null, all IDs of elements generated in the left-hand side for this instantiation will be stored in this vector, sorted by Quantification |
genRight | if non-null, all IDs of elements generated in the right-hand side for this instantiation will be stored in this vector, sorted by Quantification |
Rule & getMainRule | ( | ) |
Returns a reference to the main rule encapsulated by this UQRule.
Rule const & getMainRule | ( | ) | const |
Returns a reference to the main rule encapsulated by this UQRule.
size_t getQuantCount | ( | ) | const |
vector< UQRule::Quantification > & getQuantifications | ( | ) |
vector< UQRule::Quantification > const & getQuantifications | ( | ) | const |
|
overridevirtual |
Streams as string representation of this Streamable object to the given ostream.
ost | the stream to which the string representation will be written |
Implements Streamable.
|
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.