Skip to content

Instantly share code, notes, and snippets.

@zsrkmyn
Created December 26, 2024 15:02
Show Gist options
  • Save zsrkmyn/b176d3a5031d6261f1b41bae44b209c6 to your computer and use it in GitHub Desktop.
Save zsrkmyn/b176d3a5031d6261f1b41bae44b209c6 to your computer and use it in GitHub Desktop.
declare-datatypes syntax
; z3 supports two types of syntax for declare-datatypes -- z3's own one and smt-lib 2.6 one
; smt-lib 2.6 syntax
(declare-datatypes (
(Pair 2) ; datatype
)
(
(par (T1 T2) (
(nil) ; constructor 1
(mk-pair (first T1) (second T2)) ; constructor 2
))
))
; Z3 syntax
;(declare-datatypes (T1 T2) (
; (Pair ; datatype
; (nil) ; constructor 1
; (mk-pair (first T1) (second T2)) ; constructor 2
; )
;))
(declare-const p (Pair Int Int))
(declare-const q (Pair Int Bool))
(simplify (mk-pair 1 2))
(simplify (as nil (Pair Int Int)) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment