Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

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/


  • Prev by Date: Re: Testing whether code is run in batch mode
  • Next by Date: Re: Following Help Links with the Keyboard
  • Previous by thread: Re: simplifying ^ fails, on exact numerical constants in Mathematica 5.0
  • Next by thread: Re: Notation Package Precedence?