Skip to content

Commit

Permalink
Starting to add support for multipattern. Need to change existance\un…
Browse files Browse the repository at this point in the history
…ion to multiple reasons and update apply_matches
  • Loading branch information
eytans committed Jul 1, 2024
1 parent 591f234 commit 241df81
Show file tree
Hide file tree
Showing 7 changed files with 280 additions and 39 deletions.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ serde_json = { version = "1.0.81", optional = true }
saturating = "0.1.0"
rayon = { version = "1.10.0", optional = true }
crossbeam = { version = "0.8.4", optional = true, features = ["crossbeam-channel"] }
itertools = "0.13.0"

[dev-dependencies]
ordered-float = "3.0.0"
Expand All @@ -55,6 +56,7 @@ serde-1 = [
]
wasm-bindgen = []
parallel = ["rayon", "crossbeam"]
check_proof = []

# private features for testing
test-explanations = []
Expand Down
5 changes: 3 additions & 2 deletions src/egraph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -854,9 +854,10 @@ impl<L: Language, N: Analysis<L>> EGraph<L, N> {
for node in nodes {
let new_node = node.clone().map_children(|i| new_ids[usize::from(i)]);
let size_before = self.unionfind.size();
let next_id = self.add_uncanonical(new_node);
let next_id = self.add_uncanonical(new_node.clone());
if self.unionfind.size() > size_before {
new_node_q.push(true);
println!("Pushed new node {new_node} to egraph");
} else {
new_node_q.push(false);
}
Expand Down Expand Up @@ -1144,7 +1145,6 @@ impl<L: Language, N: Analysis<L>> EGraph<L, N> {
let size_before = self.unionfind.size();
let id2 = self.add_instantiation_noncanonical(to_pat, subst);
let rhs_new = self.unionfind.size() > size_before;

let did_union = self.perform_union(
id1,
id2,
Expand Down Expand Up @@ -1492,6 +1492,7 @@ impl<L: Language, N: Analysis<L>> EGraph<L, N> {
n_unions
}

#[cfg(feature = "check_proof")]
pub(crate) fn check_each_explain(&mut self, rules: &[&Rewrite<L, N>]) -> bool {
if let Some(explain) = &mut self.explain {
explain.with_nodes(&self.nodes).check_each_explain(rules)
Expand Down
Loading

0 comments on commit 241df81

Please sign in to comment.