Skip to content

Instantly share code, notes, and snippets.

@leonardoalt
Created January 28, 2021 09:08
Show Gist options
  • Save leonardoalt/8bd4b07dd2230e7085c44216aab88761 to your computer and use it in GitHub Desktop.
Save leonardoalt/8bd4b07dd2230e7085c44216aab88761 to your computer and use it in GitHub Desktop.
(set-logic HORN)
(declare-fun loopInvStart (Int Int Int Int) Bool)
(declare-fun loopHeader (Int Int Int Int) Bool)
(declare-fun loopBody (Int Int Int Int) Bool)
(declare-fun loopInvBlock1 (Int Int Int Int) Bool)
(declare-fun summaryLoopInv (Int Int Int Int) Bool)
(assert
(forall ( (nInit Int) (xInit Int) (nCur Int) (xCur Int) )
(loopInvStart nInit xInit nCur xCur)
))
(assert
(forall ( (nInit Int) (xInit Int) (nCur Int) (xCur Int) )
(=>
(and
(loopInvStart nInit xInit nCur xCur)
(= xInit 0)
(= xCur xInit)
(>= nInit 0)
(< nInit 256)
(= nInit nCur)
)
(loopHeader nInit xInit nCur xCur)
)))
(assert
(forall ( (nInit Int) (xInit Int) (nCur Int) (xCur Int) )
(=>
(and
(loopHeader nInit xInit nCur xCur)
(< xCur nCur)
)
(loopBody nInit xInit nCur xCur)
)))
(assert
(forall ( (nInit Int) (xInit Int) (nCur Int) (xCur Int) )
(=>
(and
(loopHeader nInit xInit nCur xCur)
(>= xCur nCur)
)
(loopInvBlock1 nInit xInit nCur xCur)
)))
(assert
(forall ( (nInit Int) (xInit Int) (nCur Int) (xCur Int) )
(=>
(loopBody nInit xInit nCur xCur)
(loopHeader nInit xInit nCur (+ xCur 1))
)))
(assert
(forall ( (nInit Int) (xInit Int) (nCur Int) (xCur Int) )
(=>
(and
(loopInvBlock1 nInit xInit nCur xCur)
(not (= xCur nCur))
)
false
)))
(assert
(forall ( (nInit Int) (xInit Int) (nCur Int) (xCur Int) )
(=>
(and
(loopInvBlock1 nInit xInit nCur xCur)
(= xCur nCur)
)
(summaryLoopInv nInit xInit nCur xCur)
)))
(check-sat)
(get-model)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment