PlanetMath (more info)
 Math for the people, by the people. Sponsor PlanetMath
Encyclopedia | Requests | Forums | Docs | Wiki | Random | RSS  
Login
create new user
name:
pass:
forget your password?
Main Menu
Owner confidence rating: High Entry average rating: No information on entry rating
Polish notation (Definition)

Whereas operators are traditionally placed between operands, with parentheses used to override operator precedence, it is possible to place each operator to the left of its operands, thus eliminating ambiguity and the need for parentheses, and even the need for rules of operator precedence.

This is known as Polish notation (after the Polish mathematician Jan \Lukasiewicz who came up with it), or prefix notation. Polish notation is a system of notating mathematical operations (whether arithmetic, logical, etc.) where the operators precede their operands and the ambiguities of operator precedence and the need for parentheses are altogether eliminated.

For example, $2 + 3 \times 15$ probably means 47, but if the possibility exists that the author meant but neglected to put in parentheses, the expression could actually mean $(2 + 3) \times 15 = 75$ . In Polish notation, we could define the basic arithmetic operators to all be binary, and write $+ \times 2 \quad 3 \quad 15$ with the confidence that it will evaluate to 21 rather than 47.

Lisp is one computer programming language that uses Polish notation. In \Lukasiewicz's vision, parentheses are not necessary at all, certainly not for resolving operator precedence. Lisp, however, uses parentheses to specify arity by enclosing operands affected by a single operator in a ``list,'' and ``the only hierarchy rule [in Lisp is] ... that innermost lists are evaluated before the lists that enclose them.'' (Chirlian, 1986) Thus, in the Lisp expression $(- 21 (+ 3 \quad 5 \ 8))$ , the addition operator is ternary and the subtraction operator is binary.

Certain LaTeX packages, such as pstricks, also use Polish notation when used for plotting plane curves.

For stack-based programming languages like Adobe PostScript, reverse Polish notation (or postfix notation) - in which the operators are written after the operands - is often the norm. Note that it is quite common for authors to confuse Polish and reverse Polish, e.g., page 3 of Chirlian (1986) speaks of ``reverse Polish or prefix notation.''

Bibliography

1
P. Chirlian, Lisp, Cleveland: Weber Systems pp. 3, 29 - 34 (1986)




"Polish notation" is owned by PrimeFan. [ full author list (2) | owner history (2) ]
(view preamble | get metadata)

View style:

See Also: reverse Polish notation

Other names:  prefix notation, \L{}ukasiewicz notation, Lukasiewicz notation

Attachments:
more examples of Polish notation (Example) by Mravinci
Log in to rate this entry.
(view current ratings)

Cross-references: norm, reverse Polish notation, plane curves, subtraction, arity, necessary, language, computer, binary, mean, expression, arithmetic, operations, even, place, operator precedence, operators
There are 7 references to this entry.

This is version 16 of Polish notation, born on 2006-08-11, modified 2006-10-23.
Object id is 8243, canonical name is PolishNotation.
Accessed 5560 times total.

Classification:
AMS MSC68N17 (Computer science :: Software :: Logic programming)
 03B70 (Mathematical logic and foundations :: General logic :: Logic in computer science)

Pending Errata and Addenda
None.
[ View all 14 ]
Discussion
Style: Expand: Order:
forum policy
Is there a theoretical advantage? by Algeboy on 2006-08-14 15:41:09
Is there a real grammatical difference between infix (standard), prefix (Polish) or postfix (reverse Polish)?

I mean this in the sense of Chomsky hierarchy, (push-down automatas etc.). I believe they all can be accepted by a PDA, though the infix seems more tricky. Also when parentheses are replaced with order of operation conventions, the length of an infix expression can be less than the equivalent pre/post-fix notation, though I'm sure that the reverse is also true in some instances.

[ reply | up ]
Polish notation by ratboy on 2006-08-12 22:38:58
The claim that "it is possible to place all operators to the left of all the operands" seems dubious. Could you explain, please, how to build the parse trees for such expressions.
[ reply | up ]
TeX problems by Mravinci on 2006-08-11 18:01:59
I know the name of the Polish mathematician is not showing up correctly. I don't know how to fix it. I am also aware that a lot of text is getting italicized that shouldn't be. My feeling is that once I correct the mathematician's name the italics problem will disappear.
[ reply | up ]

Interact
post | correct | update request | add derivation | add example | add (any)