-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add enode blame asserted * Clean up summary, misc improvements * Fix overlay style
- Loading branch information
1 parent
38f1d0a
commit 44a71e8
Showing
23 changed files
with
413 additions
and
153 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
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
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 |
---|---|---|
@@ -1,36 +1,26 @@ | ||
use std::cmp::Reverse; | ||
|
||
use crate::{items::ProofIdx, F64Ord, FxHashMap, Z3Parser}; | ||
use crate::{items::TermIdx, F64Ord, FxHashMap, Z3Parser}; | ||
|
||
use super::InstGraph; | ||
|
||
pub struct ProofAnalysis { | ||
/// The cost approximation that it took to disprove the hypothesis (may have | ||
/// been disproved in conjunction with other hypotheses). | ||
pub hypothesis_cost: Vec<(ProofIdx, f64)>, | ||
/// The cost approximation that it took to prove each lemma (by | ||
/// contradiction). | ||
pub lemmas_cost: Vec<(TermIdx, f64)>, | ||
} | ||
|
||
impl ProofAnalysis { | ||
pub fn new(parser: &Z3Parser, graph: &InstGraph) -> Self { | ||
let mut hypothesis = FxHashMap::<_, f64>::default(); | ||
for (idx, _) in parser.proofs().iter_enumerated() { | ||
let node = &graph.raw[idx]; | ||
if !node.proof.proves_false() { | ||
let mut lemmas = FxHashMap::<_, f64>::default(); | ||
for (idx, proof) in parser.proofs().iter_enumerated() { | ||
if !proof.kind.is_lemma() { | ||
continue; | ||
} | ||
let cost = node.cost; | ||
let hypotheses = graph.raw.hypotheses(parser, idx); | ||
if hypotheses.is_empty() { | ||
// proved unsat | ||
continue; | ||
} | ||
let cost_div = cost / hypotheses.len() as f64; | ||
for h in hypotheses { | ||
*hypothesis.entry(h).or_default() += cost_div; | ||
} | ||
*lemmas.entry(proof.result).or_default() += graph.raw[idx].cost; | ||
} | ||
let mut hypothesis_cost = hypothesis.into_iter().collect::<Vec<_>>(); | ||
hypothesis_cost.sort_by_key(|&(idx, cost)| (Reverse(F64Ord(cost)), idx)); | ||
Self { hypothesis_cost } | ||
let mut lemmas_cost = lemmas.into_iter().collect::<Vec<_>>(); | ||
lemmas_cost.sort_unstable_by_key(|&(lemma, cost)| (Reverse(F64Ord(cost)), lemma)); | ||
Self { lemmas_cost } | ||
} | ||
} |
Oops, something went wrong.