440 likes | 461 Views
Semantic Minimization of 3-Valued Propositional Formulas. Thomas Reps Alexey Loginov University of Wisconsin Mooly Sagiv Tel-Aviv University. Semantic Minimization. p p = 1, right? ( A ): Value of formula under assignment A In 3-valued logic, ( A ) may equal ?
E N D
Semantic Minimizationof 3-Valued Propositional Formulas Thomas Reps Alexey Loginov University of Wisconsin Mooly Sagiv Tel-Aviv University
Semantic Minimization • pp = 1, right? • (A): Value of formula under assignment A • In 3-valued logic, (A) may equal? pp([p 0]) = 1 pp([p?]) = ? pp([p 1]) = 1 • However, 1([p 0]) = 1 = pp([p 0]) 1([p?]) = 1 ? = pp([p?]) 1([p 1]) = 1 = pp([p 1])
Motivation • Dataflow analysis • Hardware verification • Symbolic trajectory evaluation • Shape analysis
Questions • What does “best” mean? • Can one find a best formula? • How?
Two-valued logic Three-valued logic {0,1} 0 1 {0} {1} Two- vs. Three-Valued Logic {0} {0,1} {1} {0,1}
Two-valued logic Three-valued logic 1 1 {1} ½ 0 {0,1} 0 {0} Two- vs. Three-Valued Logic
Two-valued logic Three-valued logic 0 1 {0,1} {0} {1} Two- vs. Three-Valued Logic
Two-valued logic Three-valued logic 0 1 ½ 0 1 Two- vs. Three-Valued Logic 0 3½ 1 3½
½ Information order 0 1 Three-Valued Logic • 1: True • 0: False • 1/2: Unknown • A join semi-lattice: 0 1 = 1/2 0 ½ 1 ½
1([p 0]) = 1 = pp([p 0]) 1([p½]) = 1 ½ = pp([p½]) 1([p 1]) = 1 = pp([p 1]) Semantic Minimization 2-valued logic: 1 is equivalent to pp 3-valued logic: 1 is better thanpp For a given , is there a best formula? Yes!
Minimal? x +x’ x x’ xy + x’z xy + x’y’ xy + x’z+ yz xy’+ x’z’+ yz No! Yes! No! Yes! Yes! No!
Rewrite Rules? 1 0
2-Valued Propositional Meaning 0(a) = 0 1(a) = 1 xi(a) = a(xi) (a) = 1 – (a) 1 2(a) = min(1(a), 2(a)) 1 2(a) = max(1(a), 2(a))
3-Valued Propositional Meaning ½(a) = ½ 0(a) = 0 1(a) = 1 xi(a) = a(xi) (a) = 1 – (a) 1 2(a) = min(1(a), 2(a)) 1 2(a) = max(1(a), 2(a))
3-Valued Propositional Meaning ½(A) = ½ 0(A) = 0 1(A) = 1 xi(A) = A(xi) (A) = 1 – (A) 1 2(A) = min(1(A), 2(A)) 1 2(A) = max(1(A), 2(A))
[ p 0,q 0, r 1,s½ ] [ p½,q 0, r 1,s 0] [ p½,q 0, r 1,s 1] [ p 1, q 0, r 1,s½ ] [ p 0, q 0, r 1, s 0 ] [ p 0, q 0, r 1, s 1 ] [ p 1, q 0, r 1, s 0 ] [ p 1, q 0, r 1, s 1 ] Represented by A A = [ p½,q 0,r 1,s½ ]
½ 0 1 The Right Definition of “Best”? Observation If for all A, (A) (A), is better than
The Right Definition of “Best”? Observation If for all A, (A) (A), is better than 0(A) = 0 ½ = ½ (A) 0 is better than ½ 1(A) = 1 ½ = ½ (A) 1 is better than ½
1 ½ ½ 0 1 0 Acceptance Device A iff (A) 1 “Potentially accepts ”
1 ½ ½ 0 1 0 Acceptance Device A iff (A) 0 “Potentially rejects ”
Acceptance Device 3-valued 2-valued • Suppose that A represents a, and • a 2-valued assignments. We want: • Ifa , then A • Ifa , then A
½ Acceptance Device 3-valued 2-valued • Suppose that A represents a, and • a 2-valued assignments. We want: • Ifa ½, then A 0 • Ifa ½, then A 0 Violated!
½ Acceptance Device 3-valued 2-valued • Suppose that A represents a, and • a 2-valued assignments. We want: • Ifa ½, then A 1 • Ifa ½, then A 1 Violated!
The Right Definition of “Best”? Observation If for all A, (A) (A), is better than Not all “better” formulas preserve potential acceptance of 2-valued assignments
What Does “Best” Mean? Supervaluational meaning (A) = (a) a rep. by A
Truth-functional semantics Non-truth-functional semantics Minimization Semantic Minimization (A) = (A)
Example pp([p½]) = pp(a) a{[p 0], [p 1]} = pp([p 0]) pp([p 1]) = 1 1 = 1 = 1([p½])
Example ½([p½]) = ½(a) a{[p 0], [p 1]} = ½([p 0]) ½([p 1]) = ½ ½ = ½ =½([p½])
Truth-functional semantics Non-truth-functional semantics Minimization Semantic Minimization (A) = (A) For all A, (A) (A) “ is better than ”
Realization of aMonotonic Boolean Function[Blamey 1980] f Formula[ f ] b a a’b + 1b + ab + a1 + ab’ (a’b’)’
Realization of aMonotonic Boolean Function[Blamey 1980] f Formula[ f ] b a a’b + ab + a1 + ab’ (a’b’ + 1b)’
([½, 1]) = (a) a{[0,1], [1,1]} = ([0,0]) ([1,1]) = 1 1 = 1 Our Problem Formula[] b a
Special Case: contains no occurrences of ½ or contains no occurrences of ½ in corners b a’b + 1b + ab + a1 + ab’ (a’b’)’ a a’b + 1b + ab + a1 + ab’ (a’b’)’
Special Case: contains no occurrences of ½ or contains no occurrences of ½ in corners b b a a
How Do We Obtain ? • Represent with a pair • floor: ½ = 0 • ceiling: ½ = 1
How Do We Obtain (, )? 0 (a.0, a.0) 1 (a.1, a.1) ½ (a.0, a.1) xi (a.a(xi), a.a(xi)) ( f , f ) ( f , f ) ( f 1, f1 ) ( f2, f2 ) ( f 1 f2, f1 f2 ) ( f 1, f1 ) ( f2, f2 ) ( f 1 f2, f1 f2 ) BDD operations
Semantically Minimal Formula • General case primes( ) ( primes( )) • When contains no occurrences of ½ and primes( )
Example Original formula () xy’+ x’z’+ yz Minimal formula () x’y + x’z’+ yz + xy’+ xz + y’z’ A(A) (A) [x ½, y 0, z 0] 1 ½ [x 0, y 1, z ½] 1 ½ [x 1, y ½, z 1] 1 ½
Example Original formula ( = if x then y else z) xy + x’z Minimal formula () xy+ x’z+ yz A(A) (A) [x ½, y 1, z 1] 1 ½
Related Work • [Blamey 1980, 1986] • Realization of a monotonic Boolean function • [Godefroid & Bruns 2000] • Supervaluational (“thorough”) semantics for model checking partial Kripke structures • For propositional formulas Deciding “(A) 1?” is NP-complete
Our Questions • What does “best” mean? For all A, (A) = (A) • Can one find a best formula? Yes • How? Create (, ) Return primes( ) ( primes( ))