|
SMTStabilizer API
Public API documentation for SMTStabilizer
|
Internal canonicalization kernel for SMTStabilizer. More...
#include <kernel.h>
Public Member Functions | |
| Kernel ()=delete | |
| Kernel (node::NodeManager &nm, const bool &context_propagation=true, const bool &symmetry_breaking_perturbation=true) | |
| Build kernel state from the current node manager assertions. | |
| void | apply (node::NodeManager &nm) |
| Run the full stabilization pass and mutate node manager state. | |
Private Member Functions | |
| bool | is_commutative (const size_t &i, const bool &from_cache=true) |
Check whether node kind at index i is treated as commutative. | |
| void | context_propagate (const std::vector< size_t > &processing, const std::vector< size_t > &symbols) |
| Run propagation to a fixed point over a selected subgraph. | |
| void | specific_propagate () |
| Apply local perturbation to break remaining hash collisions. | |
| void | rebuild_graph () |
| Keep only currently ambiguous graph regions for next iteration. | |
| void | sort_propagate (std::unordered_map< std::string, node::Sort > &sort_key_map, std::vector< std::vector< parser::Parser::DTTypeDecl > > &datatype_blocks) |
| Incorporate sort/datatype structure into propagation and naming. | |
| void | propagate (const std::vector< size_t > &processing) |
| One directional propagation pass on the selected nodes. | |
Private Attributes | |
| std::vector< std::vector< size_t > > | d_graph |
| std::vector< std::vector< std::pair< size_t, size_t > > > | d_reversed_graph |
| std::vector< size_t > | d_hash_table |
| std::vector< size_t > | d_context_hash |
| std::vector< node::Node > | d_nodes |
| std::vector< size_t > | d_processing |
| std::vector< size_t > | d_symbols |
| std::vector< size_t > | d_unique_symbols |
| std::vector< uint8_t > | d_visited |
| std::vector< uint8_t > | d_is_commutative |
| std::vector< uint8_t > | d_is_symbol |
| size_t | d_symbol_num |
| bool | d_context_propagation = true |
| bool | d_symmetry_breaking_perturbation = true |
Internal canonicalization kernel for SMTStabilizer.
The kernel owns graph-oriented views over the assertion DAG and applies multi-stage hash propagation to derive a deterministic symbol/function ordering. It is intentionally documented for maintainers even though most stage methods are private.
|
delete |
| stabilizer::kernel::Kernel::Kernel | ( | node::NodeManager & | nm, |
| const bool & | context_propagation = true, |
||
| const bool & | symmetry_breaking_perturbation = true |
||
| ) |
Build kernel state from the current node manager assertions.
Construct graph caches and reverse-topological node storage.
| nm | Node manager that provides the DAG roots and symbol tables. |
| context_propagation | Enable fixed-point context propagation. |
| symmetry_breaking_perturbation | Enable iterative subgraph-based tie breaking for colliding symbols. |
Algorithm outline:
Definition at line 48 of file kernel.cpp.
References d_graph, d_hash_table, d_is_commutative, d_is_symbol, d_nodes, d_processing, d_reversed_graph, d_symbol_num, d_symbols, d_visited, stabilizer::util::hash_combine(), stabilizer::util::hash_node(), is_commutative(), stabilizer::parser::NT_AND, stabilizer::parser::NT_EXISTS, stabilizer::parser::NT_FORALL, stabilizer::parser::NT_FP_ADD, and stabilizer::parser::NT_FP_MUL.
| void stabilizer::kernel::Kernel::apply | ( | node::NodeManager & | nm | ) |
Run the full stabilization pass and mutate node manager state.
Execute the full kernel pipeline on node manager state.
Side effects include:
| nm | Node manager to be rewritten in place. |
High-level flow:
Definition at line 575 of file kernel.cpp.
References context_propagate(), d_context_hash, d_hash_table, d_nodes, d_processing, d_symbol_num, d_symbols, d_symmetry_breaking_perturbation, d_unique_symbols, stabilizer::util::hash_combine(), stabilizer::parser::NT_DT_TESTER, rebuild_graph(), stabilizer::parser::SK_DEC, sort_propagate(), and specific_propagate().
Referenced by stabilizer::api::SMTStabilizer::run_pipeline().
|
private |
Run propagation to a fixed point over a selected subgraph.
Repeat propagation until symbol hash cardinality converges.
| processing | Node indices participating in propagation. |
| symbols | Symbol indices monitored for convergence. |
The stage tracks unique symbol hashes after each round and stops when the number of unique values no longer increases.
Definition at line 205 of file kernel.cpp.
References propagate().
Referenced by apply(), sort_propagate(), and specific_propagate().
|
private |
Check whether node kind at index i is treated as commutative.
| i | Node index in the internal node vector. |
| from_cache | Use cached commutativity when true. |
Definition at line 110 of file kernel.cpp.
References d_is_commutative, d_nodes, stabilizer::parser::NT_ADD, stabilizer::parser::NT_AND, stabilizer::parser::NT_BV_ADD, stabilizer::parser::NT_BV_AND, stabilizer::parser::NT_BV_COMP, stabilizer::parser::NT_BV_MUL, stabilizer::parser::NT_BV_NAND, stabilizer::parser::NT_BV_NOR, stabilizer::parser::NT_BV_OR, stabilizer::parser::NT_BV_SADDO, stabilizer::parser::NT_BV_UADDO, stabilizer::parser::NT_BV_UMULO, stabilizer::parser::NT_BV_XNOR, stabilizer::parser::NT_BV_XOR, stabilizer::parser::NT_DISTINCT, stabilizer::parser::NT_EQ, stabilizer::parser::NT_EXISTS, stabilizer::parser::NT_FORALL, stabilizer::parser::NT_FP_ADD, stabilizer::parser::NT_FP_EQ, stabilizer::parser::NT_FP_MAX, stabilizer::parser::NT_FP_MIN, stabilizer::parser::NT_FP_MUL, stabilizer::parser::NT_IAND, stabilizer::parser::NT_MAX, stabilizer::parser::NT_MIN, stabilizer::parser::NT_MUL, stabilizer::parser::NT_OR, and stabilizer::parser::NT_XOR.
Referenced by Kernel(), propagate(), and sort_propagate().
|
private |
One directional propagation pass on the selected nodes.
| processing | Node indices to process in the current round. |
Definition at line 157 of file kernel.cpp.
References d_context_propagation, d_graph, d_hash_table, d_reversed_graph, stabilizer::util::hash_children(), stabilizer::util::hash_communative_children(), stabilizer::util::hash_parents(), and is_commutative().
Referenced by context_propagate().
|
private |
Keep only currently ambiguous graph regions for next iteration.
Rebuild active processing graph to unresolved nodes only.
Nodes with unique hash values are pruned from subsequent iterations; the remaining ambiguous nodes keep only edges to other ambiguous nodes.
Definition at line 306 of file kernel.cpp.
References d_graph, d_hash_table, d_is_symbol, d_processing, d_reversed_graph, d_symbols, d_unique_symbols, and d_visited.
Referenced by apply().
|
private |
Incorporate sort/datatype structure into propagation and naming.
Propagate sort/datatype constraints into hash refinement.
| sort_key_map | Mutable sort name map from node manager/parser. |
| datatype_blocks | Mutable datatype declaration blocks. |
This stage temporarily augments the graph with sort vertices, stabilizes their ordering, renames sort/datatype symbols, and then restores core graph structures while keeping updated hash information.
Definition at line 360 of file kernel.cpp.
References context_propagate(), d_graph, d_hash_table, d_is_commutative, d_nodes, d_reversed_graph, d_symbols, stabilizer::util::hash_combine(), and is_commutative().
Referenced by apply().
|
private |
Apply local perturbation to break remaining hash collisions.
Resolve collisions within connected regions by targeted perturbation.
Algorithm outline:
Definition at line 229 of file kernel.cpp.
References context_propagate(), d_graph, d_hash_table, d_is_symbol, d_processing, d_reversed_graph, d_symbols, d_visited, stabilizer::util::hash_combine(), and stabilizer::util::hash_communative_children().
Referenced by apply().
|
private |
|
private |
Definition at line 84 of file kernel.h.
Referenced by propagate().
|
private |
Definition at line 65 of file kernel.h.
Referenced by Kernel(), propagate(), rebuild_graph(), sort_propagate(), and specific_propagate().
|
private |
Definition at line 67 of file kernel.h.
Referenced by apply(), Kernel(), propagate(), rebuild_graph(), sort_propagate(), and specific_propagate().
|
private |
Definition at line 77 of file kernel.h.
Referenced by is_commutative(), Kernel(), and sort_propagate().
|
private |
Definition at line 78 of file kernel.h.
Referenced by Kernel(), rebuild_graph(), and specific_propagate().
|
private |
Definition at line 69 of file kernel.h.
Referenced by apply(), is_commutative(), Kernel(), and sort_propagate().
|
private |
Definition at line 70 of file kernel.h.
Referenced by apply(), Kernel(), rebuild_graph(), and specific_propagate().
|
private |
Definition at line 66 of file kernel.h.
Referenced by Kernel(), propagate(), rebuild_graph(), sort_propagate(), and specific_propagate().
|
private |
|
private |
Definition at line 72 of file kernel.h.
Referenced by apply(), Kernel(), rebuild_graph(), sort_propagate(), and specific_propagate().
|
private |
|
private |
Definition at line 73 of file kernel.h.
Referenced by apply(), and rebuild_graph().
|
private |
Definition at line 76 of file kernel.h.
Referenced by Kernel(), rebuild_graph(), and specific_propagate().