Consider the following while program:
func main() {
Int a = 2;
if(a > 0){
Int b = 3;
} else {
skip;
}
}
(conjecture
(= (b main_end) 3)
)
My assumption is that the variable b should be local to the if block and therefore, the conjecture should not be provable as it refers to b outside of the scope in which it is defined. However, this is not the case. The translation to SMT is:
; {
; a = 2 @l3
; if (a > 0) @l4
; {
; b = 3 @l5
; }
; else
; {
; skip @l7
; }
; }
;
(set-logic UFDTLIA)
(declare-nat Nat zero s p Sub)
(declare-sort Time 0)
(declare-sort Trace 0)
(declare-fun to-int (Nat) Int)
(declare-fun a (Time) Int)
(declare-fun b (Time) Int)
(declare-const l3 Time)
(declare-const l4 Time)
(declare-const l5 Time)
(declare-const l7 Time)
(declare-const main_end Time)
(declare-const t1 Trace)
(declare-const tp Time)
; Axiom: Semantics of function main
(assert
;Semantics of IfElse at location l4
(and
;Semantics of left branch
(=>
(> 2 0)
(= (b main_end) 3)
)
;Semantics of right branch
(=>
(not
(> 2 0)
)
(= (b main_end) (b l7))
)
)
)
; Conjecture: user-conjecture-0
(assert-not
(= (b main_end) 3)
)
(check-sat)
Which is easily refutable by Vampire
Consider the following while program:
My assumption is that the variable
bshould be local to theifblock and therefore, the conjecture should not be provable as it refers toboutside of the scope in which it is defined. However, this is not the case. The translation to SMT is:Which is easily refutable by Vampire