• Aucun résultat trouvé

mSAT:An OCaml SAT Solver

N/A
N/A
Protected

Academic year: 2021

Partager "mSAT:An OCaml SAT Solver"

Copied!
2
0
0

Texte intégral

(1)

HAL Id: hal-01670765

https://hal.inria.fr/hal-01670765

Submitted on 21 Dec 2017

HAL is a multi-disciplinary open access archive for the deposit and dissemination of sci- entific research documents, whether they are pub- lished or not. The documents may come from teaching and research institutions in France or abroad, or from public or private research centers.

L’archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d’enseignement et de recherche français ou étrangers, des laboratoires publics ou privés.

mSAT:An OCaml SAT Solver

Guillaume Bury

To cite this version:

Guillaume Bury. mSAT:An OCaml SAT Solver. OCaml Users and Developers Workshop, Sep 2017, Oxford, United Kingdom. �hal-01670765�

(2)

mSAT:AnOCamlSATSolver

Guillaume Bury

DEDUC`EAM (INRIA) - LSV / CNRS

guillaume.bury@inria.fr

mSAT : a SAT solving library in OCaml. It solves the satisfibility of pro- positional clauses. It is Modular : the user provides the theory. And it produces formal proofs.

Introduction

Propagation If there exists a clause C = C 0 ∨ a, where C 0 is false in the partial model, then add a 7→ > to the partial model, and record C as the reason for a.

Decision Take an atom a that is not yet in the partial model, and add a 7→ > to the model.

Conflict A conflict is a clause C that is false in the current partial model.

Analyze Perform resolution between the analyzed clause and the reason behind the propagation of its most recently assigned litteral, until the analyzed clause is suitable for backumping.

Backjump A clause is suitable for backjumping if its most recently assi- gned litteral a is a decision. We can then backtrack to before the decision, and add the analyzed clause to the solver, which will then enable to pro- pagate a 7→ ⊥.

SMT Formulas using first-order theories can be handled using a theory.

Each formula propagated or decided is sent to the theory, which then has the duty to check whether the conjunction of all formulas seen so far is satisfiable, if not, it should return a theory tautology (as a clause), that is not satisfied in the current partial model.

Conflict Driven Clause Learning

I Imperative design X 2-watch litteral

X Backtrackable theories (less demanding than immutable theories) I Features

X Functorized design, using generative functors X Local assumptions

X Model output and proof output (Coq, dot)

Implementation

module Make(Th: Theory_intf.S)() : sig

type ' f sat_state = { eval : ' f -> bool; ... } type ( ' c, ' p) unsat_state =

{ conflict: unit -> ' c; proof : unit -> ' p } type res = Sat of formula sat_state

| Unsat of (clause, proof) unsat_state val assume : ?tag:int -> atom list list -> unit

val solve : ?assumptions:atom list -> unit -> res end

Solver Interface

regstab SAT binary only only pure SAT minisat

sattools

ocaml-sat-solvers

SAT C bindings only pure SAT Alt-ergo SMT binary only Fixed theory Alt-ergo-zero SMT OCaml lib Fixed theory

ocamlyices

yices2 SMT C bindings Fixed theory

Other Solvers

Are the following H 1 : a = b H 2 : b = c ∨ b = d hypotheses satisfiable ? H 3 : a <> d H 4 : a <> c

⟦b != d⟧, ⟦b != a⟧, ⟦a == d⟧

lemma T2

⟦a == d⟧

⟦a != d⟧

hypothesis H3

⟦b != a⟧, ⟦b != d⟧

Resolution R3

⟦b == a⟧

⟦b == a⟧

hypothesis H1

⟦b == a⟧

⟦b != d⟧

Resolution C2

⟦b == d⟧

⟦b == d⟧, ⟦b == c⟧

hypothesis H2

⟦b == c⟧

⟦b != c⟧, ⟦b != a⟧, ⟦a == c⟧

lemma T1

⟦a == c⟧

⟦a != c⟧

hypothesis H4

⟦b != a⟧, ⟦b != c⟧

Resolution R4

⟦b != c⟧

Resolution C1

⟦b == d⟧

Resolution R1

Resolution R2

Problem Example

type ( ' f, ' p) res = Sat | Unsat of ' f list * ' p

type ' f slice = { start:int; length:int; get:int -> ' f } module type S = sig

val backtrack : level -> unit

val current_level : unit -> level

val assume : formula slice -> (formula, proof) res end

Theory Interface

X Each clause records its ”history” which is the clauses used during analyzing X Minimal impact on proof search (already done to compute unsat-core) X Sufficient to rebuild the whole resolution tree

X A proof is a clause and proof nodes are expanded on demand

→ no memory issue

X Enables various proof outputs :

• Dot/Graphviz (see example above)

• Coq (and soon Dedukti) formal proofs

Proof Generation

solver

(package)

Alt-ergo-zero

aez

mSAT

msat

minisat

(minisat/sattools)

cryptominisat

(sattools)

uuf100 (1000 pbs) 0.125 0.012 0.004 0.006

uuf125 (100 pbs) 2.217 0.030 0.006 0.013

uuf150 (100 pbs) 67.563 0.087 0.017 0.045

pigeon/hole6 0.120 0.018 0.006 0.006

pigeon/hole7 4.257 0.213 0.015 0.073

pigeon/hole8 31.450 0.941 0.096 2.488

pigeon/hole9 timeout (600) 8.886 0.634 4.075 pigeon/hole10 timeout (600) 161.478 9.579 (minisat)

160.376 (sattools) 72.050

Performances

Références

Documents relatifs

normative influence to reduce the consumption of hot drinks sold in to-go cups.. To that end, we

Most of it is indeed caused by the sharp discussions on the relationship between the first-order predicate logic-based Web Ontology Language OWL and logic programming-based

1 In the different policies that I consider, the changes in mortality risk faced by different age classes remain moderate, so that v i can be interpreted as the Value of

S everal years ago, at the urging of some nonmedical friends, a small group of physicians and our spouses created a new board game called “Diagnosis.” Each player was a

Residency in a family medicine–run hospital Many programs offer family medicine training in secondary and primary care hospitals, run primarily by family doctors (including McGill’s

First we make this set into a set of

Keywords: Behavioural Science, Behavioural Economics, Health Promotion, Public Health, Nudge.. David McDaid is Senior Research Fellow at LSE Health and Social Care and at

Suppose R is a right noetherian, left P-injective, and left min-CS ring such that every nonzero complement left ideal is not small (or not singular).. Then R