-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cond synth: generate conditional rewrite rules
- Loading branch information
Showing
4 changed files
with
105 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,30 +2,31 @@ | |
// released under BSD 3-Clause License | ||
// author: Kevin Laeufer <[email protected]> | ||
|
||
use crate::rewrites::ArithRewrite; | ||
use egg::*; | ||
use indicatif::ProgressBar; | ||
use patronus::expr::traversal::TraversalCmd; | ||
use patronus::expr::{Context, ExprRef, TypeCheck, WidthInt}; | ||
use patronus_egraphs::*; | ||
use rayon::prelude::*; | ||
use rustc_hash::{FxHashMap, FxHashSet}; | ||
use serde::{Deserialize, Serialize, Serializer}; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
pub fn get_rule_info(rule: &Rewrite<Arith, ()>) -> RuleInfo { | ||
let (lhs, rhs) = extract_patterns(rule).expect("failed to extract patterns from rewrite rule"); | ||
pub fn get_rule_info(rule: &ArithRewrite) -> RuleInfo { | ||
let (lhs, rhs) = rule.patterns(); | ||
let lhs_info = analyze_pattern(lhs); | ||
let rhs_info = analyze_pattern(rhs); | ||
lhs_info.merge(&rhs_info) | ||
} | ||
|
||
pub fn generate_samples( | ||
rule: &Rewrite<Arith, ()>, | ||
rule: &ArithRewrite, | ||
max_width: WidthInt, | ||
show_progress: bool, | ||
dump_smt: bool, | ||
check_cond: bool, | ||
) -> Samples { | ||
let (lhs, rhs) = extract_patterns(rule).expect("failed to extract patterns from rewrite rule"); | ||
let (lhs, rhs) = rule.patterns(); | ||
let lhs_info = analyze_pattern(lhs); | ||
let rhs_info = analyze_pattern(rhs); | ||
let rule_info = lhs_info.merge(&rhs_info); | ||
|