Thank you for your suggestion. I think BDD is good solution for me,
because I also need to compare two boolean exprssion.
And I aslo want to thank all people replied my question. Really
appreciate it.
Best,
--- In ocaml_beginners%40yahoogroups.com">ocaml_beginners
yahoogroups.com, "Jim Grundy" <Jim.Grundy
...>
wrote:
>
> If I understand you correctly, you want to be able to pose boolean
> problems with variables (or symbolic constants) and simply those.
For
> example, you might want to the system to show that "a or (not a)"
is
> "true".
>
> There are a couple of technologies that work well for this kind of
> problems. Ordered BDDs (Binary Decision Diagrams) are a canonical
> representation of Boolean expressions. These systems are great for
> determining the equivalence of boolean expressions. There is an
OCaml
> interface to the well-known CUDD package for BDDs that may help you
> here. Google for OCaml and BDD and you'll find what you need.
>
> Alternatively, if you want to answer satisfiability and validity
> questions (is there an assignment to the variables in this boolean
> expression that makes it true, or is there no assignment that makes
> it's negation true) then you want at SAT solver. The DPT system
> includes a SAT solver in OCaml. You can read about it here:
>
> http://dpt.sourceforge.net/
>
> In either case you won't be using values of type bool to represent
> your problem, but values of a separate type of symbolic
expressions.
> If you actually want to use use values of type "foo" to reason
> symbolically about expressions of type "foo" then you'll need a
> language that supports some kind of reflection. You could look at
> languages like MetaOCaml, Omega and reFLect, but I expect you would
be
> better served looking at BDD and SAT packages.
>
> All the best
>
> Jim Grundy
>
>
>
>
> --- In ocaml_beginners%40yahoogroups.com">ocaml_beginners
yahoogroups.com, "kechenghao" <kecheng
>
wrote:
> >
> > Hi ,
> >
> > I'm wondering whether OCaml support symbolic simulation.
> > My "symbolic simulation" means to I want to assign a bool
variable a
> > symbol instead of "true" or "false".
> > For instance, I want:
> > let a=A;;
> > a::bool.
> >
> > Thanks
> >
> > --- In ocaml_beginners%40yahoogroups.com">ocaml_beginners
yahoogroups.com, Florent Monnier
> > <fmonnier
> wrote:
> > >
> > > > No, I only expect it return the boolean variable's name.
> > >
> > > If the topic is to set names to variables (maybe for debuging
> > purpose) you can
> > > do this whatever its type is, a boolean or something else (so
we
> > use 'a), you
> > > could do for example with this type:
> > >
> > > type 'a named_var = { var: 'a; name: string }
> > >
> > > let s = { var= true; name= "s" }
> > >
> > > # s.var ;;
> > > - : bool = true
> > >
> > > # s.name ;;
> > > - : string = "s"
> > >
> > >
> > > --
> > >
> >
>
.