Z3 – Make a model under Tseitin encoding

I used the following code fragment in z3 4.0 to convert the formula to CNF.

(set-logic QF_UF)< br />(
set-option
:produce-models
true
)

; ------ snip ----- --
;
; declarations,
; and assert statement
; of "original" formula
; here.
;
;- ----- snap -------

(
apply
(
then
(
!
simplify
:elim-and
true
)
tseitin-cnf
)
)

I get something like the following:

(goals
(goal

; ------ snip -------
;
; Lot's of lines here
;
; ------ snap -------

:precision precise :depth 2)
)

I assume that every expression after the target is a clause of CNF, that is, all these expressions should be combined to produce the actual formula. I call this conjunction the “coding” formula .

Obviously, the original formula and the coding formula are not equivalent, because the coding formula contains a new variable k! 0,k! 1,…Tseitin coding. However, I expect them to be completely satisfied, or in fact they are satisfied with the same model (when ignoring the k!i variable).

That is, I expect ( Encoding formula) AND (non-original formula) is not satisfiable. Unfortunately, this does not seem to be the case; I have a counter-example, this check actually returns sat.

This is an error in z3, and I use it Is it wrong, or is any of my assumptions invalid?

This is a bug in the new tseitin-cnf tactics. I fixed the bug, fix the program Will be available in the next version (Z3 4.1). In the meantime, you can solve this problem by using simplified rounds.
That is, use

< pre>(apply
(then (! simplify :elim-and true)
(! simplify :elim-and true)
tseitin-cnf))

Replace< /p>

(apply 
(then (! simplify :elim-and true)
tseitin-cnf))

I used the following code snippet in z3 4.0 to convert the formula to CNF.

(set-logic QF_UF)
(
set-option
:produce-models
true
)

; ------ snip -------
;
; declarations,
; and assert statement
; of "original" formula
; here.
;
; ------ snap- ------

(
apply
(
then
(
!
simplify
: elim-and
true
)
tseitin-cnf
)
)

I get something like the following:

(goals
(goal

; ------ snip - -----
;
; Lot's of lines here
;
; ------ snap -------

:precision precise :depth 2)
)

I assume that every expression after the target is a clause of CNF, i.e. all these expressions should be combined to produce the actual formula. I call this conjunction the “coding” formula.

Obviously, the original formula and the coding formula are not equivalent, because the coding formula contains a new variable k! 0,k! 1,…Tseitin coding. However, I expect them to be completely satisfied, or in fact they are satisfied with the same model (when ignoring the k!i variable).

That is, I expect ( Encoding formula) AND (non-original formula) is not satisfiable. Unfortunately, this does not seem to be the case; I have a counter-example, this check actually returns sat.

This is an error in z3, and I use it Is it wrong, or is any of my assumptions invalid?

This is a bug in the new tseitin-cnf tactics. I fixed the bug and the fix will be provided in the next version (Z3 4.1). In In the meantime, you can solve this problem by using simplified rounds.
That is, use

(apply 
(then (! simplify :elim-and true)
(! simplify :elim-and true)
tseitin-cnf))

Replace

(apply 
(then (! simplify :elim-and true)
tseitin-cnf))

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 4939 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.