Common — library colibrilib.bdd — module NodeH
232
module NodeH

Stay abstract: Node.H with lists as values

233
use map.Map
234
use Node
235
use list.List
236
use list.Length
237
use option.Option
238
use mach.int.Int63
239
use int.Int
240
241
type
t
'a = abstract mutable { mutable
contents
: Node.t -> list 'a }
242
243
val
create
(_n: int63) : t 'a
244
ensures { forall k. result.contents k = Nil }

Node.H.add_change (fun a -> [a]) (fun b a -> a :: b) h n x

247
val
add_cons
(h: t 'a) (n: Node.t) (x: 'a) : unit
248
writes { h }
249
ensures { h.contents = Map.set (old h.contents) n (Cons x (old h.contents n)) }

A binding with the shortest non–empty list (the Node.H.fold of get_var_less_shift in bddbitv.ml)

253
val
fold_min
(h: t 'a) : option (Node.t, int, list 'a)
254
ensures { match result with
255
| None -> forall k. h.contents k = Nil
256
| Some (n, len, l) -> l = h.contents n /\ l <> Nil /\ len = length l /\
257
(forall k. h.contents k <> Nil -> len <= length (h.contents k))
258
end }
259
end