1
(**************************************************************************)
3
(* This file is part of Frama-C. *)
5
(* Copyright (C) 2007-2008 *)
6
(* CEA (Commissariat � l'�nergie Atomique) *)
8
(* you can redistribute it and/or modify it under the terms of the GNU *)
9
(* Lesser General Public License as published by the Free Software *)
10
(* Foundation, version 2.1. *)
12
(* It is distributed in the hope that it will be useful, *)
13
(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)
14
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)
15
(* GNU Lesser General Public License for more details. *)
17
(* See the GNU Lesser General Public License version 2.1 *)
18
(* for more details (enclosed in the file licenses/LGPLv2.1). *)
20
(**************************************************************************)
22
(* $Id: state_set.ml,v 1.7 2008/04/01 09:25:22 uid568 Exp $ *)
24
type t = Relations_type.Model.t list
25
let fold = List.fold_right
27
let exists = List.exists
28
let for_all = List.for_all
29
let filter = List.filter
30
let is_empty l = l =[]
33
let length s = List.length s
39
Format.fprintf fmt "set contains %a@\n"
40
Relations_type.Model.pretty state)
43
let rec length_at_most_n l n =
48
| _ :: t -> length_at_most_n t (pred n)
51
(* let len = List.length s in if len >= 3 then
52
Format.printf "State_set:%4d@." (List.length s); *)
53
if length_at_most_n s 50
55
if (not (Relations_type.Model.is_reachable v)) ||
57
(fun e -> Relations_type.Model.is_included v e)
63
(fun e -> not (Relations_type.Model.is_included e v))
69
if Relations_type.Model.is_reachable v then v :: s else raise Unchanged
75
let unchanged = ref true in
78
let r = add_exn e acc in
84
let result = List.fold_left f b a in
85
if !unchanged then raise Unchanged;
93
let singleton v = add v []
95
let cardinal = List.length
98
List.fold_left Relations_type.Model.join Relations_type.Model.bottom l
102
compile-command: "LC_ALL=C make -C ../.. -j"