forked from backtracking/ocaml-bdd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add quantifier elimination, together with a textual print function
- Loading branch information
1 parent
0e86794
commit e493ab2
Showing
6 changed files
with
113 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
_build | ||
*merlin | ||
*.install | ||
*~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
|
||
|
||
let x = 1 | ||
let y = 2 | ||
let z = 3 | ||
|
||
let print_var fmt x = | ||
match x with | ||
| 1 -> Format.fprintf fmt "x" | ||
| 2 -> Format.fprintf fmt "y" | ||
| 3 -> Format.fprintf fmt "z" | ||
| _ -> Format.fprintf fmt "b%d" x | ||
|
||
module B = Bdd.Make(struct | ||
let print_var = print_var | ||
let size = 7001 | ||
let max_var = 100 | ||
end) | ||
|
||
open Format | ||
|
||
let test () = | ||
(* x /\ y *) | ||
let andxy = B.mk_and (B.mk_var x) (B.mk_var y) in | ||
(* x \/ y *) | ||
let orxy = B.mk_or (B.mk_var x) (B.mk_var y) in | ||
(* y /\ z *) | ||
let andyz = B.mk_and (B.mk_var y) (B.mk_var z) in | ||
(* y \/ z *) | ||
let oryz = B.mk_or (B.mk_var y) (B.mk_var z) in | ||
let b = B.mk_exist ((==) y) andxy in | ||
printf "exists y. x /\\ y ===> @[%a@]@." B.print b; | ||
let b = B.mk_exist ((==) y) orxy in | ||
printf "exists y. x \\/ y ===> @[%a@]@." B.print b; | ||
let b = B.mk_exist ((==) y) andyz in | ||
printf "exists y. y /\\ z ===> @[%a@]@." B.print b; | ||
let b = B.mk_exist ((==) y) oryz in | ||
printf "exists y. y \\/ z ===> @[%a@]@." B.print b; | ||
let b = B.mk_forall ((==) y) andxy in | ||
printf "forall y. x /\\ y ===> @[%a@]@." B.print b; | ||
let b = B.mk_forall ((==) y) orxy in | ||
printf "forall y. x \\/ y ===> @[%a@]@." B.print b; | ||
let b = B.mk_forall ((==) y) andyz in | ||
printf "forall y. y /\\ z ===> @[%a@]@." B.print b; | ||
let b = B.mk_forall ((==) y) oryz in | ||
printf "forall y. y \\/ z ===> @[%a@]@." B.print b; | ||
() | ||
|
||
|
||
|
||
let () = test () |