1. "Self-ambiguous":
is it wi(wi(p, q), r)) or wi(p, wi(q, r))?
Metamath Source |
$c -> wff $.wq $f wff q $.wr $f wff r $. |
Rule |
Rule |
========================================================= |
wi |
wff |
wff -> wff |
Sample |
p -> q -> r | Sample Parse RPNs: |
2. Overloaded Operator Associativity Ambiguity:
is it plus3(plus2(i, j), k) or plus2(plus3(i, j, k), r)?
Metamath Source |
$c + nbr $.nj $f nbr j $.nk $f nbr k $.
plus3 $a nbr + i j k $.
|
Rule |
Rule |
========================================================= |
plus2 |
nbr |
+ nbr nbr |
plus3 |
nbr |
+ nbr nbr nbr |
Sample
|
+ + i j k r
| Sample Parse RPNs: |
3. Mixed Prefix, Postfix Ambiguity -- AKA "Overlap"
is it and(p, or(q, r)) or or(and(p, q), r)?
Metamath Source |
$c & | wff $.wq $f wff q $.wr $f wff r $.
|
Rule |
Rule |
========================================================= |
and |
wff |
& wff wff |
or |
wff |
wff wff | |
Sample
|
& p q r |
| Sample Parse RPNs: 1. wp wq wr or and2. wp wq and wr or |
4. Infix Overlap Ambiguity:
is it or(and(p, q), r) or and(p, or(q, r)) or ?
Metamath Source |
$c & | wff $.wq $f wff q $.wr $f wff r $.
|
Rule |
Rule |
========================================================= |
and |
wff |
wff & wff |
or |
wff |
wff | wff |
Sample
|
p & q | r
| Sample Parse RPNs: 1. wp wq wr or and2. wp wq and wr or |
5. Adjacent Term Ambiguity:
is it part1(c1, "# !", "@ *") or part2(c1, "#", "! @", "*")?
(NOTE: This example leads me
to think that Named Typed Constants should be restricted to Formula
length = 2. -- i.e. no more than one Constant per Constant
Expression. Otherwise the GrammaticalParse(E) function becomes
much more complicated?)
Metamath Source |
$c ( := ) # ! @ * part component subpart gadget $.part2 $a part ( c1 := g1 g2 g3
)
$. |
Rule |
Rule |
====================================================== |
part1 |
part |
( component := subpart subpart ) |
part2 |
part |
( component := gadget gadget gadget ) |
subpart1 |
subpart |
# ! |
subpart2 |
subpart |
@ * |
gadget1 |
gadget |
# |
gadget2 |
gadget |
! @ |
gadget3 |
gadget |
* |
Sample
|
( c1 := # ! @ * )
| Sample Parse RPNs: 1. c1h subpart1 subpart2 part12. c1h gadget1 gadget2 gadget3 part2 |
6. Infix Overlap Ambiguity #2:
is it or(and(p, q), r) or and(p, or(q, r)) or ?
Metamath Source |
$c & | wff . $.wq $f wff q $.wr $f wff r $.
|
Rule |
Rule |
========================================================= |
and |
wff |
. wff & wff |
or |
wff |
wff | wff . |
Sample
|
. p & q | r . | Sample Parse RPNs: 1. wp wq wr or and2. wp wq and wr or |
7. Adjacent Term Ambiguity #2:
is it part1(c1, #, !, @, *) or part2(c1, gadget1(!), gadget(*))?
(Note: this is an example
involving use of a Constant as a Named Typed Constant and as a plain
old Constant. A similar usage is seen in set.mm's cdiv, wsb, and wsbc where "/" serves as a dual-use Constant -- once as a Class and once as punctuation.. In the example below, Syntax Axioms gadget1 and gadget2 imply that a gadget can be formed with 2 adjacent subparts, and if that "implied grammar rule" were added to the GrammarRuleTree forest then part1 would be immediately seens as being a composite function and hence, ambiguous.)
Metamath Source |
$c ( := ) # ! @ * part component subpart gadget $.s3h $f subpart
s3
$.s4h $f
subpart
s4
$.g1h $f
gadget
g1
$.part2 $a part ( c1 := g1 g3
)
$.subpart3 $a widget @
$.gadget1
$a
#
s1
$. |
Rule |
Rule |
====================================================== |
part1 |
part |
( component := subpart subpart subpart subpart ) |
part2 |
part |
( component := gadget gadget ) |
subpart1 |
subpart |
# |
subpart2 | subpart | ! |
subpart3 |
subpart |
@ |
subpart4 | subpart | * |
gadget1 |
gadget |
# subpart |
gadget2 |
gadget |
@ subpart |
Sample
|
( c1 := # ! @ * )
| Sample Parse RPNs: 1. c1h subpart1 subpart2 subpart3 subpart4 part12. c1h subpart2 gadget1 subpart4 gadget2 part2 |
8. Dual-use Delimiter/Operator Constant with Expression Embedding Ambiguities (2 samples)
Sample1: is it f(g(a)) or g(f(a))? Sample2: is it f(h(a)) or h(f(a)) or g(g(a))?
The extra ")"s are used as postfix operators, which introduces
an ambiguity with the other function of ")" as a delimiter/endpoint. If
we had "g $a A ( a ) * $." instead of "g $a A ( a ) ) $." then f(g(a)) would not equal g(f(a)).
Metamath Source |
$c ( ) A $.f $a A ( a ) $.
h $a A ( a ) ) ) $.
|
Rule |
Rule |
========================================================= |
f |
A |
( A ) |
g |
A |
( A ) ) |
h | A | ( A ) ) ) |
Sample1
|
( ( a ) ) )
| Sample Parse RPNs: 1. wa f g2. wa g f |
Sample2
|
( ( a ) ) ) )
| Sample Parse RPNs: 1. wa f h2. wa h f |