@@ -3,7 +3,6 @@ use z3::ast::Bool;
33use crate :: synthesis:: pcode_theory:: conflict_clause:: ConflictClause ;
44use crate :: synthesis:: Decision ;
55
6- const AGGRESSIVE : bool = true ;
76
87#[ derive( Debug , Copy , Clone , PartialEq , Eq ) ]
98pub enum TheoryStage {
@@ -45,66 +44,11 @@ pub(crate) fn gen_conflict_clauses(
4544 constraints : & [ & ConjunctiveConstraint ] ,
4645) -> Option < ConflictClause > {
4746 let mut result = Vec :: new ( ) ;
48- let mut semantics = Vec :: new ( ) ;
49- let mut concat = Vec :: new ( ) ;
50- let mut pre = Vec :: new ( ) ;
51- let mut post = Vec :: new ( ) ;
5247 for x in constraints {
5348 result. push ( x. gen_conflict_clause ( ) ) ;
54- match x. constraint_type {
55- TheoryStage :: CombinedSemantics | TheoryStage :: Branch => {
56- semantics. push ( x. gen_conflict_clause ( ) ) ;
57- }
58- TheoryStage :: Consistency => concat. push ( x. gen_conflict_clause ( ) ) ,
59- TheoryStage :: Precondition => pre. push ( x. gen_conflict_clause ( ) ) ,
60- TheoryStage :: Postcondition => post. push ( x. gen_conflict_clause ( ) ) ,
61- }
6249 }
6350
64- // return Some(ConflictClause::combine(result.as_slice()));
65- if !semantics. is_empty ( ) {
66- if AGGRESSIVE {
67- return Some ( ConflictClause :: combine ( semantics. as_slice ( ) ) ) ;
68- }
69- match ( pre. is_empty ( ) , post. is_empty ( ) ) {
70- ( true , true ) => {
71- let clause = ConflictClause :: combine ( semantics. as_slice ( ) ) ;
72- result. push ( clause)
73- }
74- ( true , false ) => {
75- // only post-condition
76- let max_index = semantics
77- . into_iter ( )
78- . map ( |c| c. decisions ( ) . iter ( ) . map ( |d| d. index ) . max ( ) . unwrap ( ) )
79- . max ( )
80- . unwrap ( ) ;
81- let clauses: Vec < ConflictClause > = concat
82- . into_iter ( )
83- . filter ( |f| f. decisions ( ) . iter ( ) . all ( |d| d. index > max_index) )
84- . collect ( ) ;
85- result. push ( ConflictClause :: combine ( & clauses) )
86- }
87- ( false , true ) => {
88- // only pre-condition
89- let min_index = semantics
90- . into_iter ( )
91- . map ( |c| c. decisions ( ) . iter ( ) . map ( |d| d. index ) . min ( ) . unwrap ( ) )
92- . min ( )
93- . unwrap ( ) ;
94- let clauses: Vec < ConflictClause > = concat
95- . into_iter ( )
96- . filter ( |f| f. decisions ( ) . iter ( ) . all ( |d| d. index <= min_index) )
97- . collect ( ) ;
98- result. push ( ConflictClause :: combine ( & clauses) )
99- }
100- ( false , false ) => {
101- // both :(
102- semantics. extend_from_slice ( & concat) ;
103- result. push ( ConflictClause :: combine ( semantics. as_slice ( ) ) ) ;
104- }
105- }
106- Some ( ConflictClause :: combine ( result. as_slice ( ) ) )
107- } else if result. is_empty ( ) {
51+ if result. is_empty ( ) {
10852 None
10953 } else {
11054 Some ( ConflictClause :: combine ( result. as_slice ( ) ) )
0 commit comments