SlideShare a Scribd company logo
SAT/SMT solving in

Haskell
Masahiro Sakai (酒井 政裕)

Haskell Day 2016
2016-09-17
Self Introduction

Masahiro Sakai
Twitter: @masahiro_sakai
github: https://github.com/msakai/
G+: https://plus.google.com/+MasahiroSakai
Translated “Software Abstractions”
and TaPL into Japanese with colleagues
Interests: Categorical Programming,
Theorem Proving / Decision Procedures,

…
Agenda
What are SAT and SMT?
Haskell libraries for SMT solving
sbv
toysat/toysmt
Conclusion
What are

SAT and SMT?
What is SAT?
* SAT = Boolean SATisfiability problem
“Is there an assignment that makes given formula true?”
Examples:
(P∨Q)∧(P∨¬Q)∧(¬P∨¬Q) is satisfiable with

{P ↦ True, Q ↦ False}
(P∨Q)∧(P∨¬Q)∧(¬P∨¬Q)∧(¬P∨Q) is unsatisfiable
SAT is NP complete, but state-of-the-art SAT-solver can
often solve problems with millions of variables /
constraints.
What is SMT?
Weakness of SAT: Really low-level representation
Encoding problems into SAT sometimes blows-up
SAT solver cannot leverage high-level knowledge
SMT = Satisfiability Modulo Theories
An approach to overcome the weakness of SAT
Problem Example:

Is there array a, function f, integers i, j such that

“0 ≤ i ∧ i < 10 ∧ (2i+1=j ∨ read(a,i)=0) ∧
f(read(write(a,i,3), j-2)) ≠ f(j-i+1)”?
SMT Solver Impl.

SAT Solver + Theory solvers
SAT solver is responsible for Boolean reasoning
Theory solvers are responsible for handling specific functions/relations etc.
SAT
Solver
Arithmetic
Solver

+, ×, ≤
BitVector
Solver
Uninterpre
ted Function

Solver

f, g, =
Array

Solver

read, write


・・・
Some Applications

of SAT/SMT
Software/Hardware verification
Model checking, Test-case generation, …
Theorem proving
Puzzles: Sudoku, Numberlink, Nonogram, etc.
Type checking in Liquid Haskell
eg: doubles :: [{x : Int | x >= 0}]→[{x : Int | x `mod` 2 = 0}]
Program Synthesis
and more
Haskell libraries for
SMT solving
Some Haskell packages
for SMT
Binding
sbv, smtlib2, simple-smt
z3, bindings-yices, yices-easy, yices-painless
SMT solvers written in Haskell:
toysolver, Smooth
SMT-LIB2 file parser/printer
smt-lib, SmtLib
SMT-LIB2 is a standard

input/output format
for SMT solvers
SBV: SMT Based
Verification in Haskell
SMT library developed by Levent Erkok
It provides:
High-Level DSL for specifying problems in
Haskell, and
Interfaces to multiple SMT solver
backends including Z3, CVC4, Yices,
Boolector.
You can install simply using stack/cabal
“stack install sbv” or “cabal install sbv"
SBV Example: “send more money”

Data.SBV.Examples.Puzzles.SendMoreMoney module
sendMoreMoney :: IO SatResult
sendMoreMoney = sat $ do
ds@[s,e,n,d,m,o,r,y] <- mapM sInteger ["s", "e", "n", "d", "m", "o", "r", "y"]
let isDigit x = x .>= 0 &&& x .<= 9
val xs = sum $ zipWith (*) (reverse xs) (iterate (*10) 1)
send = val [s,e,n,d]
more = val [m,o,r,e]
money = val [m,o,n,e,y]
constrain $ bAll isDigit ds
constrain $ allDifferent ds
constrain $ s ./= 0 &&& m ./= 0
solve [send + more .== money]
SEND

+MORE
————

MONEY
SBV Example: “send more money”

Data.SBV.Examples.Puzzles.SendMoreMoney module
sendMoreMoney :: IO SatResult
sendMoreMoney = sat $ do
ds@[s,e,n,d,m,o,r,y] <- mapM sInteger ["s", "e", "n", "d", "m", "o", "r", "y"]
let isDigit x = x .>= 0 &&& x .<= 9
val xs = sum $ zipWith (*) (reverse xs) (iterate (*10) 1)
send = val [s,e,n,d]
more = val [m,o,r,e]
money = val [m,o,n,e,y]
constrain $ bAll isDigit ds
constrain $ allDifferent ds
constrain $ s ./= 0 &&& m ./= 0
solve [send + more .== money]
SMT problem is defined using Symbolic monad,
and SMT solving is performed by

sat :: Symbolic SBool → IO SatResult
SBV Example: “send more money”

Data.SBV.Examples.Puzzles.SendMoreMoney module
sendMoreMoney :: IO SatResult
sendMoreMoney = sat $ do
ds@[s,e,n,d,m,o,r,y] <- mapM sInteger ["s", "e", "n", "d", "m", "o", "r", "y"]
let isDigit x = x .>= 0 &&& x .<= 9
val xs = sum $ zipWith (*) (reverse xs) (iterate (*10) 1)
send = val [s,e,n,d]
more = val [m,o,r,e]
money = val [m,o,n,e,y]
constrain $ bAll isDigit ds
constrain $ allDifferent ds
constrain $ s ./= 0 &&& m ./= 0
solve [send + more .== money]
sInteger :: String → Symbolic SInteger

creates integer variable
SBV Example: “send more money”

Data.SBV.Examples.Puzzles.SendMoreMoney module
sendMoreMoney :: IO SatResult
sendMoreMoney = sat $ do
ds@[s,e,n,d,m,o,r,y] <- mapM sInteger ["s", "e", "n", "d", "m", "o", "r", "y"]
let isDigit x = x .>= 0 &&& x .<= 9
val xs = sum $ zipWith (*) (reverse xs) (iterate (*10) 1)
send = val [s,e,n,d]
more = val [m,o,r,e]
money = val [m,o,n,e,y]
constrain $ bAll isDigit ds
constrain $ allDifferent ds
constrain $ s ./= 0 &&& m ./= 0
solve [send + more .== money]
Comparison over symbolic values:
we have to use slightly difference operators like (.>=), (&&&).
Because Haskell’s (>=), (&&) returns Bool, but we want SBool.
SBV Example: “send more money”

Data.SBV.Examples.Puzzles.SendMoreMoney module
sendMoreMoney :: IO SatResult
sendMoreMoney = sat $ do
ds@[s,e,n,d,m,o,r,y] <- mapM sInteger ["s", "e", "n", "d", "m", "o", "r", "y"]
let isDigit x = x .>= 0 &&& x .<= 9
val xs = sum $ zipWith (*) (reverse xs) (iterate (*10) 1)
send = val [s,e,n,d]
more = val [m,o,r,e]
money = val [m,o,n,e,y]
constrain $ bAll isDigit ds
constrain $ allDifferent ds
constrain $ s ./= 0 &&& m ./= 0
solve [send + more .== money]
val :: [SInteger] → SInteger is defined as in normal Haskell.
Thanks to the Num type class.
SBV Example: “send more money”

Data.SBV.Examples.Puzzles.SendMoreMoney module
sendMoreMoney :: IO SatResult
sendMoreMoney = sat $ do
ds@[s,e,n,d,m,o,r,y] <- mapM sInteger ["s", "e", "n", "d", "m", "o", "r", "y"]
let isDigit x = x .>= 0 &&& x .<= 9
val xs = sum $ zipWith (*) (reverse xs) (iterate (*10) 1)
send = val [s,e,n,d]
more = val [m,o,r,e]
money = val [m,o,n,e,y]
constrain $ bAll isDigit ds
constrain $ allDifferent ds
constrain $ s ./= 0 &&& m ./= 0
solve [send + more .== money]
Actual constraints specification
SBV Example: “send more money”

Data.SBV.Examples.Puzzles.SendMoreMoney module
sendMoreMoney :: IO SatResult
sendMoreMoney = sat $ do
ds@[s,e,n,d,m,o,r,y] <- mapM sInteger ["s", "e", "n", "d", "m", "o", "r", "y"]
let isDigit x = x .>= 0 &&& x .<= 9
val xs = sum $ zipWith (*) (reverse xs) (iterate (*10) 1)
send = val [s,e,n,d]
more = val [m,o,r,e]
money = val [m,o,n,e,y]
constrain $ bAll isDigit ds
constrain $ allDifferent ds
constrain $ s ./= 0 &&& m ./= 0
solve [send + more .== money]
Satisfiable. Model:
s = 9 :: Integer
e = 5 :: Integer
n = 6 :: Integer
d = 7 :: Integer
m = 1 :: Integer
o = 0 :: Integer
r = 8 :: Integer
y = 2 :: Integer
You need SMT solver Z3

to run the code.
SBV Example: “send more money”

Data.SBV.Examples.Puzzles.SendMoreMoney module
sendMoreMoney :: IO AllSatResult
sendMoreMoney = allSat $ do
ds@[s,e,n,d,m,o,r,y] <- mapM sInteger ["s", "e", "n", "d", "m", "o", "r", "y"]
let isDigit x = x .>= 0 &&& x .<= 9
val xs = sum $ zipWith (*) (reverse xs) (iterate (*10) 1)
send = val [s,e,n,d]
more = val [m,o,r,e]
money = val [m,o,n,e,y]
constrain $ bAll isDigit ds
constrain $ allDifferent ds
constrain $ s ./= 0 &&& m ./= 0
solve [send + more .== money]
By changing sat :: Symbolic SBool → IO SatResult with

allSat :: Symbolic SBool → IO AllSatResult
SBV Summary
This is only one example and sbv includes
variety of examples. You should try!
toysolver package
I’m implementing some decision procedure in Haskell
to leaning the algorithms
https://github.com/msakai/toysolver
http://hackage.haskell.org/package/toysolver
It contains some algorithms/solvers.
In particular, it contains a SAT solver ‘toysat’ and
SMT solver ‘toysmt’
Recalling Last Year …
At Proof Summit 2015,

I talked about how SAT/SMT

solver works.
At that time, I already had implemented SAT
solver ‘toysat’, but not implemented SMT solver
yet.
It triggered my motivation to implement a SMT
solver, I worked hard, and finally I did it!
http://www.slideshare.net/sakai/satsmt
toysat / toysmt
Written in pure Haskell
but implemented in very imperative way
toysat is modestly fast.
It was once the fastest among SAT solvers
written in Haskell. But now mios by Shoji
Narazaki is faster.
toysmt is slow, and has very limited features.
toysmt
toysat based SMT solver
implementation is really native and not-
efficient at all
Theories
Equality and Uninterpreted functions ✓
Linear Real Arithmetic ✓
Bit-vector (currently implementing)
Linear Integer Arithmetic, Array, etc. (not yet)
toysmt: demonstration
(set-option :produce-models true)
(set-logic QF_UFLRA)
(declare-sort U 0)
(declare-fun x () Real)
(declare-fun f (U) Real)
(declare-fun P (U) Bool)
(declare-fun g (U) U)
(declare-fun c () U)
(declare-fun d () U)
(assert (= (P c) (= (g c) c)))
(assert (ite (P c) (> x (f d)) (< x (f d))))
(check-sat)
(get-model)
(exit)
QF_UFLRA.smt2

toysmt: demonstration
$ toysmt QF_UFLRA.smt2

success
…
sat
((define-fun P ((x!1 U)) Bool

(ite (= x!1 (as @3 U)) true false))

(define-fun c () U (as @3 U))

(define-fun d () U (as @4 U))

(define-fun f ((x!1 U)) Real

(ite (= x!1 (as @4 U)) 0 (/ 555555 1)))

(define-fun g ((x!1 U)) U

(ite (= x!1 (as @3 U)) (as @3 U) (as @-1 U)))

(define-fun x () Real (/ 1 10)))
For those who do not
read SEXP
U = {@-1, @1, …, @4, …}
x = 1/10 : Real
c = @3 : U
d = @4 : U
P(x) = if x = @3 then true else false
f(x) = if x = @4 then 0 else 55555
g(x) = if x = @3 then @3 else @-1
toysmt in SMT-COMP 2016
QF_LRA (Main Track)
http://smtcomp.sourceforge.net/2016/results-QF_LRA.shtml?v=1467876482
‘toysmt’ ended up dead last.

But without wrong results! (Thanks to QuickCheck!)
toysmt: Future work
Fill the gap with state-of-the-art solvers (even a little)
There’re lots of rooms for performance improvement.
More theories: Bit-vectors, Integer arithmetic,
Array, …
More features: e.g. Proof-generation
Using ‘toysmt’ as a backend of ‘sbv'.
Re-challenge in next year's SMT-COMP competition.
Conclusion
SAT solvers are amazingly fast for solving many
combinatorial problems
SMT is an extension of SAT to handle high-level
constraints using specialized solvers.
sbv is a neat Haskell library for using SMT
solvers
toysmt is a SMT solver written in Haskell
Further readings
http://www.slideshare.net/sakai/satsmt
http://www.slideshare.net/sakai/
how-a-cdcl-sat-solver-works
Further readings
Handbook of Satisfiability
A. Biere, M. Heule, H. Van
Maaren, and T. Walsh, Eds.
IOS Press, Feb. 2009.
It is a very good book covering
variety of topics related to SAT/
SMT.

More Related Content

What's hot

OSS強化学習向けゲーム環境の動向
OSS強化学習向けゲーム環境の動向OSS強化学習向けゲーム環境の動向
OSS強化学習向けゲーム環境の動向
gree_tech
 
画像キャプションの自動生成
画像キャプションの自動生成画像キャプションの自動生成
画像キャプションの自動生成
Yoshitaka Ushiku
 
ChatGPT、 何が「できる」「みえる」ようになってきたのか!
ChatGPT、 何が「できる」「みえる」ようになってきたのか!ChatGPT、 何が「できる」「みえる」ようになってきたのか!
ChatGPT、 何が「できる」「みえる」ようになってきたのか!
Jingun Jung
 
transformer解説~Chat-GPTの源流~
transformer解説~Chat-GPTの源流~transformer解説~Chat-GPTの源流~
transformer解説~Chat-GPTの源流~
MasayoshiTsutsui
 
Unityを活用した3Dシミュレーション環境の構築
Unityを活用した3Dシミュレーション環境の構築Unityを活用した3Dシミュレーション環境の構築
Unityを活用した3Dシミュレーション環境の構築
UnityTechnologiesJapan002
 
Anaconda navigatorのアップデートが終わらないときの対処方法メモ
Anaconda navigatorのアップデートが終わらないときの対処方法メモAnaconda navigatorのアップデートが終わらないときの対処方法メモ
Anaconda navigatorのアップデートが終わらないときの対処方法メモ
ayohe
 
ConditionalPointDiffusion.pdf
ConditionalPointDiffusion.pdfConditionalPointDiffusion.pdf
ConditionalPointDiffusion.pdf
Takuya Minagawa
 
【DL輪読会】Dropout Reduces Underfitting
【DL輪読会】Dropout Reduces Underfitting【DL輪読会】Dropout Reduces Underfitting
【DL輪読会】Dropout Reduces Underfitting
Deep Learning JP
 
[DL輪読会]A System for General In-Hand Object Re-Orientation
[DL輪読会]A System for General In-Hand Object Re-Orientation[DL輪読会]A System for General In-Hand Object Re-Orientation
[DL輪読会]A System for General In-Hand Object Re-Orientation
Deep Learning JP
 
RAPIDS 概要
RAPIDS 概要RAPIDS 概要
RAPIDS 概要
NVIDIA Japan
 
ROS2勉強会 4章前半
ROS2勉強会 4章前半ROS2勉強会 4章前半
ROS2勉強会 4章前半
tomohiro kuwano
 
MLflowで学ぶMLOpsことはじめ
MLflowで学ぶMLOpsことはじめMLflowで学ぶMLOpsことはじめ
MLflowで学ぶMLOpsことはじめ
Kenichi Sonoda
 
畳み込みLstm
畳み込みLstm畳み込みLstm
畳み込みLstm
tak9029
 
2018/12/28 LiDARで取得した道路上点群に対するsemantic segmentation
2018/12/28 LiDARで取得した道路上点群に対するsemantic segmentation2018/12/28 LiDARで取得した道路上点群に対するsemantic segmentation
2018/12/28 LiDARで取得した道路上点群に対するsemantic segmentation
Takuya Minagawa
 
C++20 モジュールの概要 / Introduction to C++ modules (part 1)
C++20 モジュールの概要 / Introduction to C++ modules (part 1)C++20 モジュールの概要 / Introduction to C++ modules (part 1)
C++20 モジュールの概要 / Introduction to C++ modules (part 1)
TetsuroMatsumura
 
AlmaLinux と Rocky Linux の誕生経緯&比較
AlmaLinux と Rocky Linux の誕生経緯&比較AlmaLinux と Rocky Linux の誕生経緯&比較
AlmaLinux と Rocky Linux の誕生経緯&比較
beyond Co., Ltd.
 
SSII2019OS: 深層学習にかかる時間を短くしてみませんか? ~分散学習の勧め~
SSII2019OS: 深層学習にかかる時間を短くしてみませんか? ~分散学習の勧め~SSII2019OS: 深層学習にかかる時間を短くしてみませんか? ~分散学習の勧め~
SSII2019OS: 深層学習にかかる時間を短くしてみませんか? ~分散学習の勧め~
SSII
 
ROS2勉強会@別府 第7章Pythonクライアントライブラリrclpy
ROS2勉強会@別府 第7章PythonクライアントライブラリrclpyROS2勉強会@別府 第7章Pythonクライアントライブラリrclpy
ROS2勉強会@別府 第7章Pythonクライアントライブラリrclpy
Atsuki Yokota
 
プログラミング言語のマスコットとか紹介
プログラミング言語のマスコットとか紹介プログラミング言語のマスコットとか紹介
プログラミング言語のマスコットとか紹介
Takaaki Hirano
 
画像生成・生成モデル メタサーベイ
画像生成・生成モデル メタサーベイ画像生成・生成モデル メタサーベイ
画像生成・生成モデル メタサーベイ
cvpaper. challenge
 

What's hot (20)

OSS強化学習向けゲーム環境の動向
OSS強化学習向けゲーム環境の動向OSS強化学習向けゲーム環境の動向
OSS強化学習向けゲーム環境の動向
 
画像キャプションの自動生成
画像キャプションの自動生成画像キャプションの自動生成
画像キャプションの自動生成
 
ChatGPT、 何が「できる」「みえる」ようになってきたのか!
ChatGPT、 何が「できる」「みえる」ようになってきたのか!ChatGPT、 何が「できる」「みえる」ようになってきたのか!
ChatGPT、 何が「できる」「みえる」ようになってきたのか!
 
transformer解説~Chat-GPTの源流~
transformer解説~Chat-GPTの源流~transformer解説~Chat-GPTの源流~
transformer解説~Chat-GPTの源流~
 
Unityを活用した3Dシミュレーション環境の構築
Unityを活用した3Dシミュレーション環境の構築Unityを活用した3Dシミュレーション環境の構築
Unityを活用した3Dシミュレーション環境の構築
 
Anaconda navigatorのアップデートが終わらないときの対処方法メモ
Anaconda navigatorのアップデートが終わらないときの対処方法メモAnaconda navigatorのアップデートが終わらないときの対処方法メモ
Anaconda navigatorのアップデートが終わらないときの対処方法メモ
 
ConditionalPointDiffusion.pdf
ConditionalPointDiffusion.pdfConditionalPointDiffusion.pdf
ConditionalPointDiffusion.pdf
 
【DL輪読会】Dropout Reduces Underfitting
【DL輪読会】Dropout Reduces Underfitting【DL輪読会】Dropout Reduces Underfitting
【DL輪読会】Dropout Reduces Underfitting
 
[DL輪読会]A System for General In-Hand Object Re-Orientation
[DL輪読会]A System for General In-Hand Object Re-Orientation[DL輪読会]A System for General In-Hand Object Re-Orientation
[DL輪読会]A System for General In-Hand Object Re-Orientation
 
RAPIDS 概要
RAPIDS 概要RAPIDS 概要
RAPIDS 概要
 
ROS2勉強会 4章前半
ROS2勉強会 4章前半ROS2勉強会 4章前半
ROS2勉強会 4章前半
 
MLflowで学ぶMLOpsことはじめ
MLflowで学ぶMLOpsことはじめMLflowで学ぶMLOpsことはじめ
MLflowで学ぶMLOpsことはじめ
 
畳み込みLstm
畳み込みLstm畳み込みLstm
畳み込みLstm
 
2018/12/28 LiDARで取得した道路上点群に対するsemantic segmentation
2018/12/28 LiDARで取得した道路上点群に対するsemantic segmentation2018/12/28 LiDARで取得した道路上点群に対するsemantic segmentation
2018/12/28 LiDARで取得した道路上点群に対するsemantic segmentation
 
C++20 モジュールの概要 / Introduction to C++ modules (part 1)
C++20 モジュールの概要 / Introduction to C++ modules (part 1)C++20 モジュールの概要 / Introduction to C++ modules (part 1)
C++20 モジュールの概要 / Introduction to C++ modules (part 1)
 
AlmaLinux と Rocky Linux の誕生経緯&比較
AlmaLinux と Rocky Linux の誕生経緯&比較AlmaLinux と Rocky Linux の誕生経緯&比較
AlmaLinux と Rocky Linux の誕生経緯&比較
 
SSII2019OS: 深層学習にかかる時間を短くしてみませんか? ~分散学習の勧め~
SSII2019OS: 深層学習にかかる時間を短くしてみませんか? ~分散学習の勧め~SSII2019OS: 深層学習にかかる時間を短くしてみませんか? ~分散学習の勧め~
SSII2019OS: 深層学習にかかる時間を短くしてみませんか? ~分散学習の勧め~
 
ROS2勉強会@別府 第7章Pythonクライアントライブラリrclpy
ROS2勉強会@別府 第7章PythonクライアントライブラリrclpyROS2勉強会@別府 第7章Pythonクライアントライブラリrclpy
ROS2勉強会@別府 第7章Pythonクライアントライブラリrclpy
 
プログラミング言語のマスコットとか紹介
プログラミング言語のマスコットとか紹介プログラミング言語のマスコットとか紹介
プログラミング言語のマスコットとか紹介
 
画像生成・生成モデル メタサーベイ
画像生成・生成モデル メタサーベイ画像生成・生成モデル メタサーベイ
画像生成・生成モデル メタサーベイ
 

Viewers also liked

自然言語をラムダ式で解釈する体系PTQのHaskell実装
自然言語をラムダ式で解釈する体系PTQのHaskell実装自然言語をラムダ式で解釈する体系PTQのHaskell実装
自然言語をラムダ式で解釈する体系PTQのHaskell実装
Masahiro Sakai
 
RClassify: Classifying Race Conditions in Web Applications via Deterministic ...
RClassify: Classifying Race Conditions in Web Applications via Deterministic ...RClassify: Classifying Race Conditions in Web Applications via Deterministic ...
RClassify: Classifying Race Conditions in Web Applications via Deterministic ...
Masahiro Sakai
 
Run-time Code Generation and Modal-ML の紹介@PLDIr#2
Run-time Code Generation and Modal-ML の紹介@PLDIr#2Run-time Code Generation and Modal-ML の紹介@PLDIr#2
Run-time Code Generation and Modal-ML の紹介@PLDIr#2
Masahiro Sakai
 
ゼロピッチ: MOOC
ゼロピッチ: MOOCゼロピッチ: MOOC
ゼロピッチ: MOOC
Masahiro Sakai
 
Writing a SAT solver as a hobby project
Writing a SAT solver as a hobby projectWriting a SAT solver as a hobby project
Writing a SAT solver as a hobby project
Masahiro Sakai
 
自動定理証明の紹介
自動定理証明の紹介自動定理証明の紹介
自動定理証明の紹介
Masahiro Sakai
 
ディープラーニングの産業応用とそれを支える技術
ディープラーニングの産業応用とそれを支える技術ディープラーニングの産業応用とそれを支える技術
ディープラーニングの産業応用とそれを支える技術
Shohei Hido
 
機械学習モデルフォーマットの話:さようならPMML、こんにちはPFA
機械学習モデルフォーマットの話:さようならPMML、こんにちはPFA機械学習モデルフォーマットの話:さようならPMML、こんにちはPFA
機械学習モデルフォーマットの話:さようならPMML、こんにちはPFA
Shohei Hido
 

Viewers also liked (8)

自然言語をラムダ式で解釈する体系PTQのHaskell実装
自然言語をラムダ式で解釈する体系PTQのHaskell実装自然言語をラムダ式で解釈する体系PTQのHaskell実装
自然言語をラムダ式で解釈する体系PTQのHaskell実装
 
RClassify: Classifying Race Conditions in Web Applications via Deterministic ...
RClassify: Classifying Race Conditions in Web Applications via Deterministic ...RClassify: Classifying Race Conditions in Web Applications via Deterministic ...
RClassify: Classifying Race Conditions in Web Applications via Deterministic ...
 
Run-time Code Generation and Modal-ML の紹介@PLDIr#2
Run-time Code Generation and Modal-ML の紹介@PLDIr#2Run-time Code Generation and Modal-ML の紹介@PLDIr#2
Run-time Code Generation and Modal-ML の紹介@PLDIr#2
 
ゼロピッチ: MOOC
ゼロピッチ: MOOCゼロピッチ: MOOC
ゼロピッチ: MOOC
 
Writing a SAT solver as a hobby project
Writing a SAT solver as a hobby projectWriting a SAT solver as a hobby project
Writing a SAT solver as a hobby project
 
自動定理証明の紹介
自動定理証明の紹介自動定理証明の紹介
自動定理証明の紹介
 
ディープラーニングの産業応用とそれを支える技術
ディープラーニングの産業応用とそれを支える技術ディープラーニングの産業応用とそれを支える技術
ディープラーニングの産業応用とそれを支える技術
 
機械学習モデルフォーマットの話:さようならPMML、こんにちはPFA
機械学習モデルフォーマットの話:さようならPMML、こんにちはPFA機械学習モデルフォーマットの話:さようならPMML、こんにちはPFA
機械学習モデルフォーマットの話:さようならPMML、こんにちはPFA
 

Similar to SAT/SMT solving in Haskell

Stefan Kanev: Clojure, ClojureScript and Why They're Awesome at I T.A.K.E. Un...
Stefan Kanev: Clojure, ClojureScript and Why They're Awesome at I T.A.K.E. Un...Stefan Kanev: Clojure, ClojureScript and Why They're Awesome at I T.A.K.E. Un...
Stefan Kanev: Clojure, ClojureScript and Why They're Awesome at I T.A.K.E. Un...
Mozaic Works
 
Kotlin: maybe it's the right time
Kotlin: maybe it's the right timeKotlin: maybe it's the right time
Kotlin: maybe it's the right time
Davide Cerbo
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with Clojure
Dmitry Buzdin
 
ddd+scala
ddd+scaladdd+scala
ddd+scala
潤一 加藤
 
Monadologie
MonadologieMonadologie
Monadologie
league
 
Metaprogramming in Haskell
Metaprogramming in HaskellMetaprogramming in Haskell
Metaprogramming in Haskell
Hiromi Ishii
 
A bit about Scala
A bit about ScalaA bit about Scala
A bit about Scala
Vladimir Parfinenko
 
Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語
ikdysfm
 
Send + More = Money – Let’s mash 2 monads to solve a simple CSP
Send + More = Money – Let’s mash 2 monads to solve a simple CSPSend + More = Money – Let’s mash 2 monads to solve a simple CSP
Send + More = Money – Let’s mash 2 monads to solve a simple CSP
Filippo Vitale
 
SDC - Einführung in Scala
SDC - Einführung in ScalaSDC - Einführung in Scala
SDC - Einführung in Scala
Christian Baranowski
 
Introduction to Groovy
Introduction to GroovyIntroduction to Groovy
Introduction to Groovy
André Faria Gomes
 
An Elephant of a Different Colour: Hack
An Elephant of a Different Colour: HackAn Elephant of a Different Colour: Hack
An Elephant of a Different Colour: Hack
Vic Metcalfe
 
Let’s Talk About Ruby
Let’s Talk About RubyLet’s Talk About Ruby
Let’s Talk About Ruby
Ian Bishop
 
Ns2programs
Ns2programsNs2programs
Ns2programs
Meenakshi Devi
 
The Functional Programming Triad of Folding, Scanning and Iteration - a first...
The Functional Programming Triad of Folding, Scanning and Iteration - a first...The Functional Programming Triad of Folding, Scanning and Iteration - a first...
The Functional Programming Triad of Folding, Scanning and Iteration - a first...
Philip Schwarz
 
Rewriting Java In Scala
Rewriting Java In ScalaRewriting Java In Scala
Rewriting Java In Scala
Skills Matter
 
Mips1
Mips1Mips1
Perl6 a whistle stop tour
Perl6 a whistle stop tourPerl6 a whistle stop tour
Perl6 a whistle stop tour
Simon Proctor
 
Perl6 a whistle stop tour
Perl6 a whistle stop tourPerl6 a whistle stop tour
Perl6 a whistle stop tour
Simon Proctor
 
An Introduction to Scala (2014)
An Introduction to Scala (2014)An Introduction to Scala (2014)
An Introduction to Scala (2014)
William Narmontas
 

Similar to SAT/SMT solving in Haskell (20)

Stefan Kanev: Clojure, ClojureScript and Why They're Awesome at I T.A.K.E. Un...
Stefan Kanev: Clojure, ClojureScript and Why They're Awesome at I T.A.K.E. Un...Stefan Kanev: Clojure, ClojureScript and Why They're Awesome at I T.A.K.E. Un...
Stefan Kanev: Clojure, ClojureScript and Why They're Awesome at I T.A.K.E. Un...
 
Kotlin: maybe it's the right time
Kotlin: maybe it's the right timeKotlin: maybe it's the right time
Kotlin: maybe it's the right time
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with Clojure
 
ddd+scala
ddd+scaladdd+scala
ddd+scala
 
Monadologie
MonadologieMonadologie
Monadologie
 
Metaprogramming in Haskell
Metaprogramming in HaskellMetaprogramming in Haskell
Metaprogramming in Haskell
 
A bit about Scala
A bit about ScalaA bit about Scala
A bit about Scala
 
Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語
 
Send + More = Money – Let’s mash 2 monads to solve a simple CSP
Send + More = Money – Let’s mash 2 monads to solve a simple CSPSend + More = Money – Let’s mash 2 monads to solve a simple CSP
Send + More = Money – Let’s mash 2 monads to solve a simple CSP
 
SDC - Einführung in Scala
SDC - Einführung in ScalaSDC - Einführung in Scala
SDC - Einführung in Scala
 
Introduction to Groovy
Introduction to GroovyIntroduction to Groovy
Introduction to Groovy
 
An Elephant of a Different Colour: Hack
An Elephant of a Different Colour: HackAn Elephant of a Different Colour: Hack
An Elephant of a Different Colour: Hack
 
Let’s Talk About Ruby
Let’s Talk About RubyLet’s Talk About Ruby
Let’s Talk About Ruby
 
Ns2programs
Ns2programsNs2programs
Ns2programs
 
The Functional Programming Triad of Folding, Scanning and Iteration - a first...
The Functional Programming Triad of Folding, Scanning and Iteration - a first...The Functional Programming Triad of Folding, Scanning and Iteration - a first...
The Functional Programming Triad of Folding, Scanning and Iteration - a first...
 
Rewriting Java In Scala
Rewriting Java In ScalaRewriting Java In Scala
Rewriting Java In Scala
 
Mips1
Mips1Mips1
Mips1
 
Perl6 a whistle stop tour
Perl6 a whistle stop tourPerl6 a whistle stop tour
Perl6 a whistle stop tour
 
Perl6 a whistle stop tour
Perl6 a whistle stop tourPerl6 a whistle stop tour
Perl6 a whistle stop tour
 
An Introduction to Scala (2014)
An Introduction to Scala (2014)An Introduction to Scala (2014)
An Introduction to Scala (2014)
 

More from Masahiro Sakai

DeepXplore: Automated Whitebox Testing of Deep Learning
DeepXplore: Automated Whitebox Testing of Deep LearningDeepXplore: Automated Whitebox Testing of Deep Learning
DeepXplore: Automated Whitebox Testing of Deep Learning
Masahiro Sakai
 
Towards formal verification of neural networks
Towards formal verification of neural networksTowards formal verification of neural networks
Towards formal verification of neural networks
Masahiro Sakai
 
関数プログラマから見たPythonと機械学習
関数プログラマから見たPythonと機械学習関数プログラマから見たPythonと機械学習
関数プログラマから見たPythonと機械学習
Masahiro Sakai
 
SAT/SMTソルバの仕組み
SAT/SMTソルバの仕組みSAT/SMTソルバの仕組み
SAT/SMTソルバの仕組み
Masahiro Sakai
 
Introduction to Max-SAT and Max-SAT Evaluation
Introduction to Max-SAT and Max-SAT EvaluationIntroduction to Max-SAT and Max-SAT Evaluation
Introduction to Max-SAT and Max-SAT Evaluation
Masahiro Sakai
 
Aluminum: Principled Scenario Exploration through Minimality
Aluminum: Principled Scenario Exploration through MinimalityAluminum: Principled Scenario Exploration through Minimality
Aluminum: Principled Scenario Exploration through Minimality
Masahiro Sakai
 
代数的実数とCADの実装紹介
代数的実数とCADの実装紹介代数的実数とCADの実装紹介
代数的実数とCADの実装紹介
Masahiro Sakai
 
How a CDCL SAT solver works
How a CDCL SAT solver worksHow a CDCL SAT solver works
How a CDCL SAT solver works
Masahiro Sakai
 
Omega test and beyond
Omega test and beyondOmega test and beyond
Omega test and beyond
Masahiro Sakai
 
萩野服部研究室 スキー合宿 2012 自己紹介(酒井)
萩野服部研究室 スキー合宿 2012 自己紹介(酒井)萩野服部研究室 スキー合宿 2012 自己紹介(酒井)
萩野服部研究室 スキー合宿 2012 自己紹介(酒井)
Masahiro Sakai
 
“Adoption and Focus: Practical Linear Types for Imperative Programming”他の紹介@P...
“Adoption and Focus: Practical Linear Types for Imperative Programming”他の紹介@P...“Adoption and Focus: Practical Linear Types for Imperative Programming”他の紹介@P...
“Adoption and Focus: Practical Linear Types for Imperative Programming”他の紹介@P...
Masahiro Sakai
 
“Design and Implementation of Generics for the .NET Common Language Runtime”他...
“Design and Implementation of Generics for the .NET Common Language Runtime”他...“Design and Implementation of Generics for the .NET Common Language Runtime”他...
“Design and Implementation of Generics for the .NET Common Language Runtime”他...
Masahiro Sakai
 
Relaxed Dependency Analysis
Relaxed Dependency AnalysisRelaxed Dependency Analysis
Relaxed Dependency Analysis
Masahiro Sakai
 
“Symbolic bounds analysis of pointers, array indices, and accessed memory reg...
“Symbolic bounds analysis of pointers, array indices, and accessed memory reg...“Symbolic bounds analysis of pointers, array indices, and accessed memory reg...
“Symbolic bounds analysis of pointers, array indices, and accessed memory reg...
Masahiro Sakai
 
Whole Program Paths 等の紹介@PLDIr#3
Whole Program Paths 等の紹介@PLDIr#3Whole Program Paths 等の紹介@PLDIr#3
Whole Program Paths 等の紹介@PLDIr#3
Masahiro Sakai
 
Introduction to Categorical Programming (Revised)
Introduction to Categorical Programming (Revised)Introduction to Categorical Programming (Revised)
Introduction to Categorical Programming (Revised)
Masahiro Sakai
 
Introduction to Categorical Programming
Introduction to Categorical ProgrammingIntroduction to Categorical Programming
Introduction to Categorical Programming
Masahiro Sakai
 
融合変換による最適化の理論的基盤と正当性 (2006-06-27)
融合変換による最適化の理論的基盤と正当性 (2006-06-27)融合変換による最適化の理論的基盤と正当性 (2006-06-27)
融合変換による最適化の理論的基盤と正当性 (2006-06-27)Masahiro Sakai
 
融合変換による最適化の理論的基盤と正当性 (2006-06-20)
融合変換による最適化の理論的基盤と正当性 (2006-06-20)融合変換による最適化の理論的基盤と正当性 (2006-06-20)
融合変換による最適化の理論的基盤と正当性 (2006-06-20)Masahiro Sakai
 
Ruby-GNOME2におけるGC問題
Ruby-GNOME2におけるGC問題Ruby-GNOME2におけるGC問題
Ruby-GNOME2におけるGC問題
Masahiro Sakai
 

More from Masahiro Sakai (20)

DeepXplore: Automated Whitebox Testing of Deep Learning
DeepXplore: Automated Whitebox Testing of Deep LearningDeepXplore: Automated Whitebox Testing of Deep Learning
DeepXplore: Automated Whitebox Testing of Deep Learning
 
Towards formal verification of neural networks
Towards formal verification of neural networksTowards formal verification of neural networks
Towards formal verification of neural networks
 
関数プログラマから見たPythonと機械学習
関数プログラマから見たPythonと機械学習関数プログラマから見たPythonと機械学習
関数プログラマから見たPythonと機械学習
 
SAT/SMTソルバの仕組み
SAT/SMTソルバの仕組みSAT/SMTソルバの仕組み
SAT/SMTソルバの仕組み
 
Introduction to Max-SAT and Max-SAT Evaluation
Introduction to Max-SAT and Max-SAT EvaluationIntroduction to Max-SAT and Max-SAT Evaluation
Introduction to Max-SAT and Max-SAT Evaluation
 
Aluminum: Principled Scenario Exploration through Minimality
Aluminum: Principled Scenario Exploration through MinimalityAluminum: Principled Scenario Exploration through Minimality
Aluminum: Principled Scenario Exploration through Minimality
 
代数的実数とCADの実装紹介
代数的実数とCADの実装紹介代数的実数とCADの実装紹介
代数的実数とCADの実装紹介
 
How a CDCL SAT solver works
How a CDCL SAT solver worksHow a CDCL SAT solver works
How a CDCL SAT solver works
 
Omega test and beyond
Omega test and beyondOmega test and beyond
Omega test and beyond
 
萩野服部研究室 スキー合宿 2012 自己紹介(酒井)
萩野服部研究室 スキー合宿 2012 自己紹介(酒井)萩野服部研究室 スキー合宿 2012 自己紹介(酒井)
萩野服部研究室 スキー合宿 2012 自己紹介(酒井)
 
“Adoption and Focus: Practical Linear Types for Imperative Programming”他の紹介@P...
“Adoption and Focus: Practical Linear Types for Imperative Programming”他の紹介@P...“Adoption and Focus: Practical Linear Types for Imperative Programming”他の紹介@P...
“Adoption and Focus: Practical Linear Types for Imperative Programming”他の紹介@P...
 
“Design and Implementation of Generics for the .NET Common Language Runtime”他...
“Design and Implementation of Generics for the .NET Common Language Runtime”他...“Design and Implementation of Generics for the .NET Common Language Runtime”他...
“Design and Implementation of Generics for the .NET Common Language Runtime”他...
 
Relaxed Dependency Analysis
Relaxed Dependency AnalysisRelaxed Dependency Analysis
Relaxed Dependency Analysis
 
“Symbolic bounds analysis of pointers, array indices, and accessed memory reg...
“Symbolic bounds analysis of pointers, array indices, and accessed memory reg...“Symbolic bounds analysis of pointers, array indices, and accessed memory reg...
“Symbolic bounds analysis of pointers, array indices, and accessed memory reg...
 
Whole Program Paths 等の紹介@PLDIr#3
Whole Program Paths 等の紹介@PLDIr#3Whole Program Paths 等の紹介@PLDIr#3
Whole Program Paths 等の紹介@PLDIr#3
 
Introduction to Categorical Programming (Revised)
Introduction to Categorical Programming (Revised)Introduction to Categorical Programming (Revised)
Introduction to Categorical Programming (Revised)
 
Introduction to Categorical Programming
Introduction to Categorical ProgrammingIntroduction to Categorical Programming
Introduction to Categorical Programming
 
融合変換による最適化の理論的基盤と正当性 (2006-06-27)
融合変換による最適化の理論的基盤と正当性 (2006-06-27)融合変換による最適化の理論的基盤と正当性 (2006-06-27)
融合変換による最適化の理論的基盤と正当性 (2006-06-27)
 
融合変換による最適化の理論的基盤と正当性 (2006-06-20)
融合変換による最適化の理論的基盤と正当性 (2006-06-20)融合変換による最適化の理論的基盤と正当性 (2006-06-20)
融合変換による最適化の理論的基盤と正当性 (2006-06-20)
 
Ruby-GNOME2におけるGC問題
Ruby-GNOME2におけるGC問題Ruby-GNOME2におけるGC問題
Ruby-GNOME2におけるGC問題
 

Recently uploaded

5g-5G SA reg. -standalone-access-registration.pdf
5g-5G SA reg. -standalone-access-registration.pdf5g-5G SA reg. -standalone-access-registration.pdf
5g-5G SA reg. -standalone-access-registration.pdf
devtomar25
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
kandramariana6
 
CEC 352 - SATELLITE COMMUNICATION UNIT 1
CEC 352 - SATELLITE COMMUNICATION UNIT 1CEC 352 - SATELLITE COMMUNICATION UNIT 1
CEC 352 - SATELLITE COMMUNICATION UNIT 1
PKavitha10
 
Generative AI Use cases applications solutions and implementation.pdf
Generative AI Use cases applications solutions and implementation.pdfGenerative AI Use cases applications solutions and implementation.pdf
Generative AI Use cases applications solutions and implementation.pdf
mahaffeycheryld
 
Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...
Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...
Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...
PriyankaKilaniya
 
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
shadow0702a
 
Introduction to Computer Networks & OSI MODEL.ppt
Introduction to Computer Networks & OSI MODEL.pptIntroduction to Computer Networks & OSI MODEL.ppt
Introduction to Computer Networks & OSI MODEL.ppt
Dwarkadas J Sanghvi College of Engineering
 
SCALING OF MOS CIRCUITS m .pptx
SCALING OF MOS CIRCUITS m                 .pptxSCALING OF MOS CIRCUITS m                 .pptx
SCALING OF MOS CIRCUITS m .pptx
harshapolam10
 
Pressure Relief valve used in flow line to release the over pressure at our d...
Pressure Relief valve used in flow line to release the over pressure at our d...Pressure Relief valve used in flow line to release the over pressure at our d...
Pressure Relief valve used in flow line to release the over pressure at our d...
cannyengineerings
 
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURSCompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
RamonNovais6
 
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
MadhavJungKarki
 
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by AnantLLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
Anant Corporation
 
smart pill dispenser is designed to improve medication adherence and safety f...
smart pill dispenser is designed to improve medication adherence and safety f...smart pill dispenser is designed to improve medication adherence and safety f...
smart pill dispenser is designed to improve medication adherence and safety f...
um7474492
 
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
Paris Salesforce Developer Group
 
Computational Engineering IITH Presentation
Computational Engineering IITH PresentationComputational Engineering IITH Presentation
Computational Engineering IITH Presentation
co23btech11018
 
Transformers design and coooling methods
Transformers design and coooling methodsTransformers design and coooling methods
Transformers design and coooling methods
Roger Rozario
 
Design and optimization of ion propulsion drone
Design and optimization of ion propulsion droneDesign and optimization of ion propulsion drone
Design and optimization of ion propulsion drone
bjmsejournal
 
An Introduction to the Compiler Designss
An Introduction to the Compiler DesignssAn Introduction to the Compiler Designss
An Introduction to the Compiler Designss
ElakkiaU
 
Digital Twins Computer Networking Paper Presentation.pptx
Digital Twins Computer Networking Paper Presentation.pptxDigital Twins Computer Networking Paper Presentation.pptx
Digital Twins Computer Networking Paper Presentation.pptx
aryanpankaj78
 
Bayesian Decision Theory details ML.pptx
Bayesian Decision Theory details ML.pptxBayesian Decision Theory details ML.pptx
Bayesian Decision Theory details ML.pptx
amrita chaturvedi
 

Recently uploaded (20)

5g-5G SA reg. -standalone-access-registration.pdf
5g-5G SA reg. -standalone-access-registration.pdf5g-5G SA reg. -standalone-access-registration.pdf
5g-5G SA reg. -standalone-access-registration.pdf
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
 
CEC 352 - SATELLITE COMMUNICATION UNIT 1
CEC 352 - SATELLITE COMMUNICATION UNIT 1CEC 352 - SATELLITE COMMUNICATION UNIT 1
CEC 352 - SATELLITE COMMUNICATION UNIT 1
 
Generative AI Use cases applications solutions and implementation.pdf
Generative AI Use cases applications solutions and implementation.pdfGenerative AI Use cases applications solutions and implementation.pdf
Generative AI Use cases applications solutions and implementation.pdf
 
Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...
Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...
Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...
 
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
 
Introduction to Computer Networks & OSI MODEL.ppt
Introduction to Computer Networks & OSI MODEL.pptIntroduction to Computer Networks & OSI MODEL.ppt
Introduction to Computer Networks & OSI MODEL.ppt
 
SCALING OF MOS CIRCUITS m .pptx
SCALING OF MOS CIRCUITS m                 .pptxSCALING OF MOS CIRCUITS m                 .pptx
SCALING OF MOS CIRCUITS m .pptx
 
Pressure Relief valve used in flow line to release the over pressure at our d...
Pressure Relief valve used in flow line to release the over pressure at our d...Pressure Relief valve used in flow line to release the over pressure at our d...
Pressure Relief valve used in flow line to release the over pressure at our d...
 
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURSCompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
 
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
 
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by AnantLLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
 
smart pill dispenser is designed to improve medication adherence and safety f...
smart pill dispenser is designed to improve medication adherence and safety f...smart pill dispenser is designed to improve medication adherence and safety f...
smart pill dispenser is designed to improve medication adherence and safety f...
 
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
 
Computational Engineering IITH Presentation
Computational Engineering IITH PresentationComputational Engineering IITH Presentation
Computational Engineering IITH Presentation
 
Transformers design and coooling methods
Transformers design and coooling methodsTransformers design and coooling methods
Transformers design and coooling methods
 
Design and optimization of ion propulsion drone
Design and optimization of ion propulsion droneDesign and optimization of ion propulsion drone
Design and optimization of ion propulsion drone
 
An Introduction to the Compiler Designss
An Introduction to the Compiler DesignssAn Introduction to the Compiler Designss
An Introduction to the Compiler Designss
 
Digital Twins Computer Networking Paper Presentation.pptx
Digital Twins Computer Networking Paper Presentation.pptxDigital Twins Computer Networking Paper Presentation.pptx
Digital Twins Computer Networking Paper Presentation.pptx
 
Bayesian Decision Theory details ML.pptx
Bayesian Decision Theory details ML.pptxBayesian Decision Theory details ML.pptx
Bayesian Decision Theory details ML.pptx
 

SAT/SMT solving in Haskell

  • 1. SAT/SMT solving in
 Haskell Masahiro Sakai (酒井 政裕)
 Haskell Day 2016 2016-09-17
  • 2. Self Introduction
 Masahiro Sakai Twitter: @masahiro_sakai github: https://github.com/msakai/ G+: https://plus.google.com/+MasahiroSakai Translated “Software Abstractions” and TaPL into Japanese with colleagues Interests: Categorical Programming, Theorem Proving / Decision Procedures,
 …
  • 3. Agenda What are SAT and SMT? Haskell libraries for SMT solving sbv toysat/toysmt Conclusion
  • 5. What is SAT? * SAT = Boolean SATisfiability problem “Is there an assignment that makes given formula true?” Examples: (P∨Q)∧(P∨¬Q)∧(¬P∨¬Q) is satisfiable with
 {P ↦ True, Q ↦ False} (P∨Q)∧(P∨¬Q)∧(¬P∨¬Q)∧(¬P∨Q) is unsatisfiable SAT is NP complete, but state-of-the-art SAT-solver can often solve problems with millions of variables / constraints.
  • 6. What is SMT? Weakness of SAT: Really low-level representation Encoding problems into SAT sometimes blows-up SAT solver cannot leverage high-level knowledge SMT = Satisfiability Modulo Theories An approach to overcome the weakness of SAT Problem Example:
 Is there array a, function f, integers i, j such that
 “0 ≤ i ∧ i < 10 ∧ (2i+1=j ∨ read(a,i)=0) ∧ f(read(write(a,i,3), j-2)) ≠ f(j-i+1)”?
  • 7. SMT Solver Impl.
 SAT Solver + Theory solvers SAT solver is responsible for Boolean reasoning Theory solvers are responsible for handling specific functions/relations etc. SAT Solver Arithmetic Solver
 +, ×, ≤ BitVector Solver Uninterpre ted Function
 Solver
 f, g, = Array
 Solver
 read, write 
 ・・・
  • 8. Some Applications
 of SAT/SMT Software/Hardware verification Model checking, Test-case generation, … Theorem proving Puzzles: Sudoku, Numberlink, Nonogram, etc. Type checking in Liquid Haskell eg: doubles :: [{x : Int | x >= 0}]→[{x : Int | x `mod` 2 = 0}] Program Synthesis and more
  • 10. Some Haskell packages for SMT Binding sbv, smtlib2, simple-smt z3, bindings-yices, yices-easy, yices-painless SMT solvers written in Haskell: toysolver, Smooth SMT-LIB2 file parser/printer smt-lib, SmtLib SMT-LIB2 is a standard
 input/output format for SMT solvers
  • 11. SBV: SMT Based Verification in Haskell SMT library developed by Levent Erkok It provides: High-Level DSL for specifying problems in Haskell, and Interfaces to multiple SMT solver backends including Z3, CVC4, Yices, Boolector. You can install simply using stack/cabal “stack install sbv” or “cabal install sbv"
  • 12. SBV Example: “send more money”
 Data.SBV.Examples.Puzzles.SendMoreMoney module sendMoreMoney :: IO SatResult sendMoreMoney = sat $ do ds@[s,e,n,d,m,o,r,y] <- mapM sInteger ["s", "e", "n", "d", "m", "o", "r", "y"] let isDigit x = x .>= 0 &&& x .<= 9 val xs = sum $ zipWith (*) (reverse xs) (iterate (*10) 1) send = val [s,e,n,d] more = val [m,o,r,e] money = val [m,o,n,e,y] constrain $ bAll isDigit ds constrain $ allDifferent ds constrain $ s ./= 0 &&& m ./= 0 solve [send + more .== money] SEND
 +MORE ————
 MONEY
  • 13. SBV Example: “send more money”
 Data.SBV.Examples.Puzzles.SendMoreMoney module sendMoreMoney :: IO SatResult sendMoreMoney = sat $ do ds@[s,e,n,d,m,o,r,y] <- mapM sInteger ["s", "e", "n", "d", "m", "o", "r", "y"] let isDigit x = x .>= 0 &&& x .<= 9 val xs = sum $ zipWith (*) (reverse xs) (iterate (*10) 1) send = val [s,e,n,d] more = val [m,o,r,e] money = val [m,o,n,e,y] constrain $ bAll isDigit ds constrain $ allDifferent ds constrain $ s ./= 0 &&& m ./= 0 solve [send + more .== money] SMT problem is defined using Symbolic monad, and SMT solving is performed by
 sat :: Symbolic SBool → IO SatResult
  • 14. SBV Example: “send more money”
 Data.SBV.Examples.Puzzles.SendMoreMoney module sendMoreMoney :: IO SatResult sendMoreMoney = sat $ do ds@[s,e,n,d,m,o,r,y] <- mapM sInteger ["s", "e", "n", "d", "m", "o", "r", "y"] let isDigit x = x .>= 0 &&& x .<= 9 val xs = sum $ zipWith (*) (reverse xs) (iterate (*10) 1) send = val [s,e,n,d] more = val [m,o,r,e] money = val [m,o,n,e,y] constrain $ bAll isDigit ds constrain $ allDifferent ds constrain $ s ./= 0 &&& m ./= 0 solve [send + more .== money] sInteger :: String → Symbolic SInteger
 creates integer variable
  • 15. SBV Example: “send more money”
 Data.SBV.Examples.Puzzles.SendMoreMoney module sendMoreMoney :: IO SatResult sendMoreMoney = sat $ do ds@[s,e,n,d,m,o,r,y] <- mapM sInteger ["s", "e", "n", "d", "m", "o", "r", "y"] let isDigit x = x .>= 0 &&& x .<= 9 val xs = sum $ zipWith (*) (reverse xs) (iterate (*10) 1) send = val [s,e,n,d] more = val [m,o,r,e] money = val [m,o,n,e,y] constrain $ bAll isDigit ds constrain $ allDifferent ds constrain $ s ./= 0 &&& m ./= 0 solve [send + more .== money] Comparison over symbolic values: we have to use slightly difference operators like (.>=), (&&&). Because Haskell’s (>=), (&&) returns Bool, but we want SBool.
  • 16. SBV Example: “send more money”
 Data.SBV.Examples.Puzzles.SendMoreMoney module sendMoreMoney :: IO SatResult sendMoreMoney = sat $ do ds@[s,e,n,d,m,o,r,y] <- mapM sInteger ["s", "e", "n", "d", "m", "o", "r", "y"] let isDigit x = x .>= 0 &&& x .<= 9 val xs = sum $ zipWith (*) (reverse xs) (iterate (*10) 1) send = val [s,e,n,d] more = val [m,o,r,e] money = val [m,o,n,e,y] constrain $ bAll isDigit ds constrain $ allDifferent ds constrain $ s ./= 0 &&& m ./= 0 solve [send + more .== money] val :: [SInteger] → SInteger is defined as in normal Haskell. Thanks to the Num type class.
  • 17. SBV Example: “send more money”
 Data.SBV.Examples.Puzzles.SendMoreMoney module sendMoreMoney :: IO SatResult sendMoreMoney = sat $ do ds@[s,e,n,d,m,o,r,y] <- mapM sInteger ["s", "e", "n", "d", "m", "o", "r", "y"] let isDigit x = x .>= 0 &&& x .<= 9 val xs = sum $ zipWith (*) (reverse xs) (iterate (*10) 1) send = val [s,e,n,d] more = val [m,o,r,e] money = val [m,o,n,e,y] constrain $ bAll isDigit ds constrain $ allDifferent ds constrain $ s ./= 0 &&& m ./= 0 solve [send + more .== money] Actual constraints specification
  • 18. SBV Example: “send more money”
 Data.SBV.Examples.Puzzles.SendMoreMoney module sendMoreMoney :: IO SatResult sendMoreMoney = sat $ do ds@[s,e,n,d,m,o,r,y] <- mapM sInteger ["s", "e", "n", "d", "m", "o", "r", "y"] let isDigit x = x .>= 0 &&& x .<= 9 val xs = sum $ zipWith (*) (reverse xs) (iterate (*10) 1) send = val [s,e,n,d] more = val [m,o,r,e] money = val [m,o,n,e,y] constrain $ bAll isDigit ds constrain $ allDifferent ds constrain $ s ./= 0 &&& m ./= 0 solve [send + more .== money] Satisfiable. Model: s = 9 :: Integer e = 5 :: Integer n = 6 :: Integer d = 7 :: Integer m = 1 :: Integer o = 0 :: Integer r = 8 :: Integer y = 2 :: Integer You need SMT solver Z3
 to run the code.
  • 19. SBV Example: “send more money”
 Data.SBV.Examples.Puzzles.SendMoreMoney module sendMoreMoney :: IO AllSatResult sendMoreMoney = allSat $ do ds@[s,e,n,d,m,o,r,y] <- mapM sInteger ["s", "e", "n", "d", "m", "o", "r", "y"] let isDigit x = x .>= 0 &&& x .<= 9 val xs = sum $ zipWith (*) (reverse xs) (iterate (*10) 1) send = val [s,e,n,d] more = val [m,o,r,e] money = val [m,o,n,e,y] constrain $ bAll isDigit ds constrain $ allDifferent ds constrain $ s ./= 0 &&& m ./= 0 solve [send + more .== money] By changing sat :: Symbolic SBool → IO SatResult with
 allSat :: Symbolic SBool → IO AllSatResult
  • 20. SBV Summary This is only one example and sbv includes variety of examples. You should try!
  • 21. toysolver package I’m implementing some decision procedure in Haskell to leaning the algorithms https://github.com/msakai/toysolver http://hackage.haskell.org/package/toysolver It contains some algorithms/solvers. In particular, it contains a SAT solver ‘toysat’ and SMT solver ‘toysmt’
  • 22. Recalling Last Year … At Proof Summit 2015,
 I talked about how SAT/SMT
 solver works. At that time, I already had implemented SAT solver ‘toysat’, but not implemented SMT solver yet. It triggered my motivation to implement a SMT solver, I worked hard, and finally I did it! http://www.slideshare.net/sakai/satsmt
  • 23. toysat / toysmt Written in pure Haskell but implemented in very imperative way toysat is modestly fast. It was once the fastest among SAT solvers written in Haskell. But now mios by Shoji Narazaki is faster. toysmt is slow, and has very limited features.
  • 24. toysmt toysat based SMT solver implementation is really native and not- efficient at all Theories Equality and Uninterpreted functions ✓ Linear Real Arithmetic ✓ Bit-vector (currently implementing) Linear Integer Arithmetic, Array, etc. (not yet)
  • 25. toysmt: demonstration (set-option :produce-models true) (set-logic QF_UFLRA) (declare-sort U 0) (declare-fun x () Real) (declare-fun f (U) Real) (declare-fun P (U) Bool) (declare-fun g (U) U) (declare-fun c () U) (declare-fun d () U) (assert (= (P c) (= (g c) c))) (assert (ite (P c) (> x (f d)) (< x (f d)))) (check-sat) (get-model) (exit) QF_UFLRA.smt2

  • 26. toysmt: demonstration $ toysmt QF_UFLRA.smt2
 success … sat ((define-fun P ((x!1 U)) Bool
 (ite (= x!1 (as @3 U)) true false))
 (define-fun c () U (as @3 U))
 (define-fun d () U (as @4 U))
 (define-fun f ((x!1 U)) Real
 (ite (= x!1 (as @4 U)) 0 (/ 555555 1)))
 (define-fun g ((x!1 U)) U
 (ite (= x!1 (as @3 U)) (as @3 U) (as @-1 U)))
 (define-fun x () Real (/ 1 10)))
  • 27. For those who do not read SEXP U = {@-1, @1, …, @4, …} x = 1/10 : Real c = @3 : U d = @4 : U P(x) = if x = @3 then true else false f(x) = if x = @4 then 0 else 55555 g(x) = if x = @3 then @3 else @-1
  • 28. toysmt in SMT-COMP 2016 QF_LRA (Main Track) http://smtcomp.sourceforge.net/2016/results-QF_LRA.shtml?v=1467876482 ‘toysmt’ ended up dead last.
 But without wrong results! (Thanks to QuickCheck!)
  • 29. toysmt: Future work Fill the gap with state-of-the-art solvers (even a little) There’re lots of rooms for performance improvement. More theories: Bit-vectors, Integer arithmetic, Array, … More features: e.g. Proof-generation Using ‘toysmt’ as a backend of ‘sbv'. Re-challenge in next year's SMT-COMP competition.
  • 30. Conclusion SAT solvers are amazingly fast for solving many combinatorial problems SMT is an extension of SAT to handle high-level constraints using specialized solvers. sbv is a neat Haskell library for using SMT solvers toysmt is a SMT solver written in Haskell
  • 32. Further readings Handbook of Satisfiability A. Biere, M. Heule, H. Van Maaren, and T. Walsh, Eds. IOS Press, Feb. 2009. It is a very good book covering variety of topics related to SAT/ SMT.