正在加载图片...
4.2 Parentheses Parentheses are tedious for us to handle. We can introduce some rule to reduce the num arentheses without ambiguity 1. The outermost parenthesis need not be explicitly mentioned 2. The negation symbol applies to a proposition as little as possible 3. The conjunction and disjunction symbols also apply as little as possibl 4. Where one connective symbols is used repeatedly, grouping is to the right All these explicit rules make our parsing algorithm complicated if you want to accommodate the right proposition other than well-defined ones for convenience. Furthermore, you should prove that explicit rule would not result in ambiguity. 4.3 Polish notation Rules are not convenient. However there is a smart way to get rid of parentheses permanently, it is just the Polish notation. As we have already known, any connective is just a function with one or two parameters. We can represent a proposition as following without any parentheses 1.D-(a)=-a. V(a, B) 3.DA(a,B)=∧aB (a,B)=→aB 5. D+a, B)=taB It is called Polish notation. Actually, it can be expanded to any n-ary function Consider the following example, which is translated from a well-defined proposition Example 4. Determine the well defined proposition of →∧AD∨=BCB. It is easy to recover the well-defined form. Do it as an exercise Yah! We do eliminate parentheses successfully. But what is your feeling about Polish notation when you try to figure out what it represents. In fact, it is an approach very suitable for machine but human. To us, the well-defined way is much better There are several approached to translate Polish representation into regular one, which is left as4.2 Parentheses Parentheses are tedious for us to handle. We can introduce some rule to reduce the number of parentheses without ambiguity. 1. The outermost parenthesis need not be explicitly mentioned. 2. The negation symbol applies to a proposition as little as possible. 3. The conjunction and disjunction symbols also apply as little as possible. 4. Where one connective symbols is used repeatedly, grouping is to the right. All these explicit rules make our parsing algorithm complicated if you want to accommodate the right proposition other than well-defined ones for convenience. Furthermore, you should prove that explicit rule would not result in ambiguity. 4.3 Polish notation Rules are not convenient. However there is a smart way to get rid of parentheses permanently, it is just the Polish notation. As we have already known, any connective is just a function with one or two parameters. We can represent a proposition as following without any parentheses: 1. D¬(α) = ¬α. 2. D∨(α, β) = ∨αβ. 3. D∧(α, β) = ∧αβ. 4. D→(α, β) =→ αβ. 5. D↔(α, β) =↔ αβ. It is called Polish notation. Actually, it can be expanded to any n-ary function. Consider the following example, which is translated from a well-defined proposition. Example 4. Determine the well defined proposition of → ∧AD ∨ ¬B ↔ CB. It is easy to recover the well-defined form. Do it as an exercise. Yah! We do eliminate parentheses successfully. But what is your feeling about Polish notation when you try to figure out what it represents. In fact, it is an approach very suitable for machine but human. To us, the well-defined way is much better. There are several approached to translate Polish representation into regular one, which is left as an exercise. 5
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有