This looks OK, except that the inside rational
expression is not factored (it is actually equal to 1). So
let's try scanmap/factoring it again:
scanmap(factor, scexpr) => No change!
On the other hand, if we enter the expression from
we find that it does factor nicely
scanmap(factor,entered) => 0
The reason is that the internal form of scexpr is marked
Factored and Irreducible:
((MTIMES SIMP) $%I
((MTIMES SIMP FACTORED)
((MPLUS SIMP IRREDUCIBLE) 1 ((MEXPT SIMP
RATSIMP) |$x| 4)) -2)
((MPLUS SIMP IRREDUCIBLE) 1
((MTIMES SIMP) 2 ((MEXPT SIMP RATSIMP) |$x| 4))
((MEXPT SIMP RATSIMP) |$x| 8)))))
I see two issue here.
First of all, I'd have expected the scanmap/factor to go
directly to the fully factored form, namely 0.
Secondly, if it doesn't, it should at least not mismark the
result as factored/irreducible.
The incomplete factoring is arguably part of the
semantics of Scanmap, inherent in top-down
scanning, . And indeed Scanmap/bottomup does get
the simplest form (after patching subst0 as reported in
the previous bug note).
On the other hand, I don't see any excuse for
mismarking. If something isn't factored or irreducible, it
shouldn't be marked as factored or irreducible.
Note that Factor actually has a special case for
Scanmap (the scanmapp flag). I suspect that this is to
force incomplete factoring, and that mismarking comes
as an undesired side-effect.
Log in to post a comment.