summaryrefslogtreecommitdiff
path: root/abstract/formula.ml
diff options
context:
space:
mode:
authorAlex Auvolat <alex.auvolat@ansys.com>2014-07-09 18:06:43 +0200
committerAlex Auvolat <alex.auvolat@ansys.com>2014-07-09 18:06:43 +0200
commite06a4102e5b2a81c7b1c24323cafc863eefbc0cb (patch)
treeb151ddc7ee1e37c161889f1342aead47e5b9c44a /abstract/formula.ml
parentbc9ad2280839677bb46acfd846ff05bb37719b6e (diff)
downloadscade-analyzer-e06a4102e5b2a81c7b1c24323cafc863eefbc0cb.tar.gz
scade-analyzer-e06a4102e5b2a81c7b1c24323cafc863eefbc0cb.zip
Now it's starting to work...
Diffstat (limited to 'abstract/formula.ml')
-rw-r--r--abstract/formula.ml18
1 files changed, 18 insertions, 0 deletions
diff --git a/abstract/formula.ml b/abstract/formula.ml
index f2a3bd1..5cbe0c9 100644
--- a/abstract/formula.ml
+++ b/abstract/formula.ml
@@ -263,3 +263,21 @@ let rec formula_replace_evars repls e =
| x -> x
+
+(*
+ Extract all cases that make a formula true, to a limited degree
+
+ [A || B; not (A || B)] -> A; (B && (not A)); not A && not B]
+*)
+
+let rec split_cases c =
+ let c = List.map eliminate_not c in
+ let u, l = List.fold_left
+ (fun (u, l) c ->
+ match c with
+ | BOr(a, b) ->
+ true, a::(BAnd(BNot a, b))::l
+ | x -> u, x::l)
+ (false, []) c
+ in
+ if u then split_cases l else l