UnCoVer (Using Coverability for Verification)
|
The PartialPOCEnumerator computes a subset of all pushout complement of a partial rule and a total match. More...
#include <PartialPOCEnumerator.h>
Public Member Functions | |
PartialPOCEnumerator (graphs::AnonRule_csp rule, graphs::Hypergraph_csp graph, bool inj, shared_ptr< vector< graphs::AnonRule_csp >> orRules) | |
Generates a new PartialPOCEnumerator with the given rule and graph. More... | |
PartialPOCEnumerator (PartialPOCEnumerator &&oldEnum) | |
Move constructor. More... | |
virtual | ~PartialPOCEnumerator () |
Destroys this PartialPOCEnumerator. | |
bool | ended () const |
Returns true, if the enumerator has ended. More... | |
void | reset (graphs::AnonRule_csp rule, graphs::Hypergraph_csp graph, bool inj, shared_ptr< vector< graphs::AnonRule_csp >> orRules) |
Reinitializes the enumerator with the given rule and graph. More... | |
PartialPOCEnumerator & | operator++ () |
Computes the next element in the enumeration. More... | |
graphs::Mapping const & | getCurrentCoMatch () const |
Returns the co-match currently used for the backwards application of the rule. More... | |
graphs::Mapping_sp | getMapping () const |
Returns the last computed match from the left hand-side to the (last computed) pushout complement. More... | |
graphs::Hypergraph_sp | getGraph () const |
Returns the last computed pushout complement. More... | |
Private Member Functions | |
void | genTemplates () |
Uses the current graph and mapping returned by the TotalPOCEnumerator and initializes the template fields with them. More... | |
void | computeCurrent () |
Generates the current graph and mapping from the template graph and mapping. More... | |
void | mergeNodes () |
Sets the current graph and mapping to a copy of the template graph and mapping. More... | |
void | prepEdgeMergings () |
Calls mergeNodes() to merge vertices and then initializes edgeMergings to enumerate all possible mergings of parallel edges. | |
void | mergeEdges () |
Merges the edges of the current graph (adjusting also the mapping) according to the content of edgeMergings. | |
bool | incEdgeMergings () |
Increments the edgeMergings vector to return the next merging on parallel edges. More... | |
bool | getNext () |
Implements the core functionality of the increment operator in the following way: More... | |
bool | cfWrtOriginalRule () const |
Checks whether there exists an original rule (from which the current rule was generated) such that the current match is conflict-free wrt. More... | |
Private Attributes | |
graphs::AnonRule_csp | partialRule |
Stores the partial part of the rule. More... | |
shared_ptr< vector < graphs::AnonRule_csp > > | originalRules |
Stores the collection of original rules. More... | |
bool | injective |
Stores whether injective or conflict-free matches should be used. | |
TotalPOCEnumerator * | totalPOCs |
Stores a TotalPOCEnumerator for computing pushout complement for the total part of the rule. | |
graphs::Hypergraph_sp | currentGraph |
Stores the last computed (partial) pushout complement. | |
graphs::Mapping_sp | currentMapp |
Stores the last computed mapping from the left hand-side to the (partial) pushout complement. | |
graphs::Hypergraph_sp | templateGraph |
Will contain the total poc with added nodes and edges. | |
graphs::Mapping_sp | templateMapp |
Will contain the mapping from the left side to the template graph. | |
basic_types::IDPartitionEnumerator * | vertexMergings |
Stores an IDPartitionEnumerator to enumerate all possible node mergings. | |
vector< IDType > * | mergableEdges |
Stores the subset of edges which can (potentially) be merged. | |
vector < basic_types::IDPartitionEnumerator > * | edgeMergings |
Stores a sequence of IDPartitionEnumerators for enumerating all possible mergings of parallel edges. | |
bool | nodesAlreadyMerged |
Stores whether the nodes need to be merged or not when computing the current graph. | |
The PartialPOCEnumerator computes a subset of all pushout complement of a partial rule and a total match.
This is done by first splitting the rule into a total and a partial part. First the pushout complement for the total part is computed by the TotalPOCEnumerator. The result is then modified to be the pushout complement of the original rule. These modifications only add elements to the pushout complement which have a preimage in the left rule side. Note that this enumerator does only compute a finite subset of all pushout complement, but not all, since there may be infinitely many. The computed set can be used to calculate a representative set wrt. some criteria.
PartialPOCEnumerator | ( | graphs::AnonRule_csp | rule, |
graphs::Hypergraph_csp | graph, | ||
bool | inj, | ||
shared_ptr< vector< graphs::AnonRule_csp >> | orRules | ||
) |
Generates a new PartialPOCEnumerator with the given rule and graph.
The rule may be any (partial) morphism. The matches can be set to either injective or conflict-free matches. A collection of original rules, i.e. rules from which the current rule could have been generated, can be given if inj=false. Computed pushout complements are then only kept if the match is conflict-free wrt. at least one of these rules.
rule | the rule which will be applied backwards |
graph | the graph to which the rule will be applied backwards |
inj | set to true iff only injective matching should be used |
orRules | a collection of all original rules; this parameter is ignored if inj=true, it is null or it is empty |
PartialPOCEnumerator | ( | PartialPOCEnumerator && | oldEnum | ) |
Move constructor.
Creates a new PartialPOCEnumerator using the data of the given one. The given enumerator will be invalidated in the process and must be reset before being usable again.
oldEnum | the enumerator from which the data will be copied |
|
inlineprivate |
Checks whether there exists an original rule (from which the current rule was generated) such that the current match is conflict-free wrt.
this rule.
|
private |
Generates the current graph and mapping from the template graph and mapping.
If matches may be non-injective, vertex and edge mergings are also performed according to the current values of vertexMergings and edgeMergings.
bool ended | ( | ) | const |
Returns true, if the enumerator has ended.
This is the case if the enumerator was incremented, but unable to compute any further elements to enumerate.
|
private |
Uses the current graph and mapping returned by the TotalPOCEnumerator and initializes the template fields with them.
These include templateGraph, templateMapp and additionally vertexMergings, mergableEdges, edgeMergings if matches may be non-injective.
Mapping const & getCurrentCoMatch | ( | ) | const |
Returns the co-match currently used for the backwards application of the rule.
graphs::Hypergraph_sp getGraph | ( | ) | const |
Returns the last computed pushout complement.
If the enumerator has ended, null is returned.
graphs::Mapping_sp getMapping | ( | ) | const |
Returns the last computed match from the left hand-side to the (last computed) pushout complement.
If the enumerator has ended, null is returned.
|
private |
Implements the core functionality of the increment operator in the following way:
|
private |
Increments the edgeMergings vector to return the next merging on parallel edges.
Returns false if the increment was not possible, i.e. all possibilities where enumerated. false if all edge mergings where enumerated
|
private |
Sets the current graph and mapping to a copy of the template graph and mapping.
Then merges the vertices according to the current content of vertexMergings.
PartialPOCEnumerator & operator++ | ( | ) |
Computes the next element in the enumeration.
If the last element was already computed, this call is ignored.
void reset | ( | graphs::AnonRule_csp | rule, |
graphs::Hypergraph_csp | graph, | ||
bool | inj, | ||
shared_ptr< vector< graphs::AnonRule_csp >> | orRules | ||
) |
Reinitializes the enumerator with the given rule and graph.
Any previous computations performed by this enumerator are discarded and the first element for its new content is enumerated. A collection of original rules, i.e. rules from which the current rule could have been generated, can be given if inj=false. Computed pushout complements are then only kept if the match is conflict-free wrt. at least one of these rules.
rule | the rule which will be applied backwards |
graph | the graph to which the rule will be applied backwards |
inj | set to true iff only injective matching should be used |
orRules | a collection of all original rules; this parameter is ignored if inj=true, it is null or it is empty |
|
private |
Stores the collection of original rules.
(only used for non-injective matches)
|
private |
Stores the partial part of the rule.
This morphism is injective, surjective, but partial.