Skip to content

Instantly share code, notes, and snippets.

@leonardoalt
Created September 15, 2020 15:09
Show Gist options
  • Save leonardoalt/e7459e05b948737ffaa0207649c60bd8 to your computer and use it in GitHub Desktop.
Save leonardoalt/e7459e05b948737ffaa0207649c60bd8 to your computer and use it in GitHub Desktop.
(declare-rel beforeLoop ())
(declare-rel loopCond (Int Int))
(declare-rel loopBody (Int Int))
(declare-rel afterLoop ())
(declare-rel endFunction ())
(declare-var size Int)
(declare-var height Int)
(rule beforeLoop)
(rule (=>
(and beforeLoop (> size 0) (<= size 4294967296))
(loopCond size 0)
))
(rule (=>
(and (loopCond size height) (< height 32))
(loopBody size height)
))
(rule (=>
(and (loopCond size height) (>= height 32))
afterLoop
))
(rule (=>
(and
(loopBody size height)
(= (mod size 2) 1)
)
endFunction
))
(rule (=>
(and
(loopBody size height)
(= (mod size 2) 0)
)
(loopCond (/ size 2) (+ height 1))
))
(query afterLoop :print-certificate true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment