Skip to content

Instantly share code, notes, and snippets.

@Lipen
Created August 21, 2020 08:47
Show Gist options
  • Save Lipen/1bbf6586ad180ef8334a5e5a7efa1576 to your computer and use it in GitHub Desktop.
Save Lipen/1bbf6586ad180ef8334a5e5a7efa1576 to your computer and use it in GitHub Desktop.
(Minimal) Boolean Formula Synthesis using SyGuS
; EXPECT: unsat
; COMMAND-LINE: --lang=sygus2
(set-logic ALL)
(synth-fun f ((x Bool) (y Bool) (z Bool)) Bool
((Start Bool)) (
(Start Bool (
x y z
(not Start)
(and Start Start)
(or Start Start)
))
))
(declare-var x Bool)
(declare-var y Bool)
(declare-var z Bool)
(define-fun toint ((b Bool)) Int (ite b 1 0))
(define-fun f2 ((x Int) (y Int) (z Int)) Int
(toint (f (not (= x 0)) (not (= y 0)) (not (= z 0)))))
; 00011111, x1 | (x2 & x3), 5
; Solution: (or x (and y z)) == x | (y & z)
(constraint (= (f2 0 0 0) 0 ))
(constraint (= (f2 0 0 1) 0 ))
(constraint (= (f2 0 1 0) 0 ))
(constraint (= (f2 0 1 1) 1 ))
(constraint (= (f2 1 0 0) 1 ))
(constraint (= (f2 1 0 1) 1 ))
(constraint (= (f2 1 1 0) 1 ))
(constraint (= (f2 1 1 1) 1 ))
(check-synth)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment