Saturday, 15 September 2012

z3 - Finding the weakest precondition using z3py -


I want to find the weakest condition in action and post position using z3py.

N = N + 1 and post status N = 5 5 will be the most vulnerable pre-condition N == 4 given the action.

The use of strategy hal-eq This approach works for the terms of certain terms, but not others. When using post status, N & lt; 5 I get [[no (4 = l =; n =)]] .

But when N == 5 is using [[]] , when I N == 4 needed. N = int ('N') after N # = N2 = Int ('N2') # N Action from weak pre-condition Goyle = target () # 'N2 == N + 1 'Action #' N2 == 5 'post position weak precondition goyle.ed (N2 == N + 1, N2 == 5) T = Wright (' Hull-AQ ') wp = T (weak PreconditionGoyle) Print (WP)

Is this the best way to find the most vulnerable precondition?

I have tried many ways, but it is new to Z3 and it is not able to understand which approach is to be taken or how to implement it.

Yes, hal-eq can be used to end equality The problem is that we have no control on which equality will end. Another option is to use the qe (quantifier elimination) example is also available. N = Int ('N') # N after action # N First action weak precondition Goal = Goal

  N2 = Int ('N2') () # 'N2 == N + 1' Action # 'N2 == 5' Post Status. Weak prediction Goal.add (present ([N2], and (N2 == N + 1, N2 == 5)) T = Tip ('qi') wp = t (weak pledge round) print (wp) < / Code>  

Another option is to use hal-eqs , but the "guard" equation that we do not want to terminate, we have a supporting point guard can be used to protect equations. Here is an example (online also available) Of course, we want to eliminate the guard from the result. A will have to pass a second.

  N2 = Int ('Action Guard = Function (' guard ', ballstar), Bolsert ()) Weak counterparty Goal.add Goal.adding the position of the goal = 'N2 == 5' post # N 'action #' N2 == 5 'after N = int (' n ') # n before goal = target =' N2 == N + 1 ' (N2 == N + 1, Guard (N2 == 5)) T = Tip ('hull-eqs') wp = T (weak follow-up goal) print (wp)    

No comments:

Post a Comment