package msat

  1. Overview
  2. Docs
Library containing a SAT solver that can be parametrized by a theory

Install

Dune Dependency

Authors

Maintainers

Sources

v0.8.tar.gz
md5=fe2f507bff99166ad2004786ca1ae59b
sha512=4cd653218e1767152c1d66700ccfc421d6d2da6ddffc8af4ee9151a3b5d25920f9d735a416f962227ffe458bb56e1f1977d180dd91415d37af9e1ea41dbb1045

doc/src/msat.backtrack/Backtrackable_ref.ml.html

Source file Backtrackable_ref.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

type 'a t = {
  mutable cur: 'a;
  stack: 'a Vec.t;
  copy: ('a -> 'a) option;
}

let create ?copy x: _ t =
  {cur=x; stack=Vec.create(); copy}

let[@inline] get self = self.cur
let[@inline] set self x = self.cur <- x
let[@inline] update self f = self.cur <- f self.cur

let[@inline] n_levels self = Vec.size self.stack

let[@inline] push_level self : unit =
  let x = self.cur in
  let x = match self.copy with None -> x | Some f -> f x in
  Vec.push self.stack x

let pop_levels self n : unit =
  assert (n>=0);
  if n > Vec.size self.stack then invalid_arg "Backtrackable_ref.pop_levels";
  let i = Vec.size self.stack-n in
  let x = Vec.get self.stack i in
  self.cur <- x;
  Vec.shrink self.stack i;
  ()
OCaml

Innovation. Community. Security.