Notation Package Precedence?
- To: mathgroup at smc.vnet.net
- Subject: [mg62026] Notation Package Precedence?
- From: "Steven T. Hatton" <hattons at globalsymmetry.com>
- Date: Wed, 9 Nov 2005 03:45:59 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
I've discovered that I can produce a "logical equals" like this:
Biconditional[p_, q_] := (LogicalExpand //@ p) == (LogicalExpand //@ q)
But if I infix it like so:
p_ \[DoubleLeftRightArrow] q_ := Biconditional[p, q]
it doesn't group correctly unless I force it with parentheses. For example:
(a \[And] b) \[Or] c \[DoubleLeftRightArrow] (a \[Or] c) \[And] (b \[Or] c)
produces:
(a && b) || (c == (a || c) && (b || c))
This seems to work correctly. At least it produces the expected results.
((a \[And] b) \[Or]
c) \[DoubleLeftRightArrow] ((a \[Or] c) \[And] (b \[Or] c))
I tried using the Utilitie`Notation` package, but when I passed the option
SyntaxForm to Notation, it seemed to ignore it. Does anybody know how to
get the Notation package to change the precedence of an operator?
I'm not convinced that will solve the genearl case. I still have a problem
with
((a \[And] b) \[Or] c) \[DoubleLeftRightArrow] (a \[Or] c) \[And] (b \[Or]
c)
which groups correctly
(c || (a && b)) == (a || c) && (b || c)
But does not evaluate to True, as it should.
--
The Mathematica Wiki: http://www.mathematica-users.org/
Math for Comp Sci http://www.ifi.unizh.ch/math/bmwcs/master.html
Math for the WWW: http://www.w3.org/Math/
- Follow-Ups:
- Re: Notation Package Precedence?
- From: Jason Harris <jasonh@wolfram.com>
- Re: Notation Package Precedence?