10

In Mathematica version 7, there was a big advance in logic support ("Boolean computations" is the official name). This was not further developed in version 8.0. So now we have a fairly robust support for propositional calculus, but not too much for predicate calculus.

To this end, it would help a lot if we had an internal function capable of transforming a formula (logic formula, I mean) into the Prenex normal form or, even better, into a Skolem normal form.

Is anybody aware of a 3rd party package which addresses this problem?

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
magma
  • 5,290
  • 24
  • 46
  • 3
    tutorial/RealPolynomialSystems claims "Reduce, Resolve, and FindInstance always put real polynomial systems in the prenex normal form, with quantifier-free parts in the disjunctive normal form"... – Daniel Lichtblau Jan 20 '12 at 20:47
  • @DanielLichtblau this is a great suggestion Daniel, You may consider putting this as an answer – magma Jan 21 '12 at 18:53

1 Answers1

11

tutorial/RealPolynomialSystems claims "Reduce, Resolve, and FindInstance always put real polynomial systems in the prenex normal form, with quantifier-free parts in the disjunctive normal form..."

For obtaining Skolem form from prenex, possibly could proceed as described at

http://demonstrations.wolfram.com/Skolemization/

or

http://mathworld.wolfram.com/SkolemFunction.html

Edit:

Also there is a non-System` context function of interest (I learned this via grep). I'll illustrate with the example provided in a comment.

ee = ForAll[x, P[x] \[Implies] Q[x]] \[Implies] (ForAll[x, P[x]] \[Implies] ForAll[x, Q[x]]);

We'll need to put into a normal for; conjunctive or disjunctive will suffice. I'll use LogicalExpand to get a dnf.

ff = LogicalExpand[ee]
Exists[x,  !Implies[P[x], Q[x]]] || Exists[x,  !P[x]] || ForAll[x, Q[x]]
Reduce`ToPrenexForm[ff]
Exists[{C[1], C[2]}, ForAll[{C[3]}, (P[C[1]] &&  !Q[C[1]]) ||  !P[C[2]] || Q[C[3]]]]

I've no idea whether this is the sort of result wanted. But it does seem to have all quantifiers at the front.

David
  • 14,911
  • 6
  • 51
  • 81
Daniel Lichtblau
  • 58,970
  • 2
  • 101
  • 199
  • As I said above this is an excellent suggestion, but it does not really solve my problem. It seems that this transformation to prenex normal form, which takes place internally (probably with Resolve), is executed only on polynomial systems, not general first-order language formulas. For ex: ForAll[x, P[x] [Implies] Q[x]] [Implies] (ForAll[x, P[x]] [Implies] ForAll[x, Q[x]]) // Resolve does not do anything, because the expr is not in the form expected by MMA. Is there some undocumented function which can deal with this more general situation? – magma Jan 24 '12 at 01:43
  • @magma See edited post. – Daniel Lichtblau Jan 24 '12 at 16:46
  • Great Daniel! This is exactly the result I was looking for. I do not understand why WRI keeps this function undocumented. It is very useful in ATP. But this will be the topic for another question – magma Jan 24 '12 at 17:09
  • @magma It turns out we don't document this because prenex repositioning and skolemization are illegal activities in most southern states. (Did I really write that?) – Daniel Lichtblau Jan 27 '12 at 23:26
  • Daniel, I do not really understand what does it mean "I learned this via grep"?. AFAIK grep is a Unix command so....? – magma Jan 31 '12 at 01:06
  • 1
    @Magma Yes, I agree maybe that remark was a bit too cryptic. What I meant was that, having access to the source files (and working on a Linux desktop), I used grep on them to learn that a ToPrenexForm function existed. I do not know if this would work with the .mx files that come with the Mathematica distribution (I do not know the extent to which things might be encrypted therein; possibly not at all). – Daniel Lichtblau Jan 31 '12 at 17:18
  • Daniel: I imagined something like that (about grep). The ToPrenexForm works very well in my MMA. If it's possible, could you please grep further (or ask around) if -from the prenexed or skolemized form- the full resolution algorithm is implemented Resolution maybe using the DPLL algorithm ? – magma Jan 31 '12 at 18:02
  • @Magma Do you mean something like Resolve[ee, Booleans] (with ee as defined in my response above)? – Daniel Lichtblau Jan 31 '12 at 18:19
  • Daniel, thank you for your help. I will be offline for several days. Afterwards I will clarify my question. – magma Feb 01 '12 at 00:49