mirror of
https://github.com/c-cube/sidekick.git
synced 2025-12-06 11:15:43 -05:00
refactor: fix sudoku example
This commit is contained in:
parent
a6d3ed259f
commit
032be221a3
1 changed files with 5 additions and 4 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
(** simple sudoku solver *)
|
(** simple sudoku solver *)
|
||||||
|
|
||||||
open Sidekick_util
|
open Sidekick_util
|
||||||
|
module Proof = Sidekick_proof
|
||||||
|
|
||||||
let errorf msg = Fmt.kasprintf failwith msg
|
let errorf msg = Fmt.kasprintf failwith msg
|
||||||
|
|
||||||
|
|
@ -214,7 +215,7 @@ end = struct
|
||||||
mk_cell_lit self.tst x y (Cell.make (c + 1)))
|
mk_cell_lit self.tst x y (Cell.make (c + 1)))
|
||||||
in
|
in
|
||||||
Log.debugf 4 (fun k -> k "(@[add-clause@ %a@])" pp_c_ c);
|
Log.debugf 4 (fun k -> k "(@[add-clause@ %a@])" pp_c_ c);
|
||||||
A.add_clause ~keep:true c Proof_trace.dummy_step_id
|
A.add_clause ~keep:true c @@ fun () -> Proof.Pterm.dummy
|
||||||
))
|
))
|
||||||
|
|
||||||
(* check constraints *)
|
(* check constraints *)
|
||||||
|
|
@ -242,7 +243,7 @@ end = struct
|
||||||
in
|
in
|
||||||
Stat.incr self.stat_conflict;
|
Stat.incr self.stat_conflict;
|
||||||
logs_conflict c_kind c;
|
logs_conflict c_kind c;
|
||||||
A.raise_conflict c Proof_trace.dummy_step_id
|
A.raise_conflict c @@ fun () -> Proof.Pterm.dummy
|
||||||
))
|
))
|
||||||
in
|
in
|
||||||
all_diff "rows" Grid.rows;
|
all_diff "rows" Grid.rows;
|
||||||
|
|
@ -274,7 +275,7 @@ end = struct
|
||||||
]
|
]
|
||||||
in
|
in
|
||||||
logs_conflict "at-most-one" c;
|
logs_conflict "at-most-one" c;
|
||||||
A.raise_conflict c Proof_trace.dummy_step_id
|
A.raise_conflict c @@ fun () -> Proof.Pterm.dummy
|
||||||
)
|
)
|
||||||
| _ -> ())
|
| _ -> ())
|
||||||
|
|
||||||
|
|
@ -334,7 +335,7 @@ end = struct
|
||||||
let plugin : Sat.plugin = Theory.to_plugin theory in
|
let plugin : Sat.plugin = Theory.to_plugin theory in
|
||||||
{
|
{
|
||||||
tst;
|
tst;
|
||||||
solver = Sat.create ~stat ~proof:Proof_trace.dummy plugin;
|
solver = Sat.create ~stat ~tracer:Sat.Tracer.dummy plugin;
|
||||||
theory;
|
theory;
|
||||||
grid0 = g;
|
grid0 = g;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue