simplifying predicates



On 5/19/10, Barton Willis <willisb at unk.edu> wrote:

> We could convert oddp and related predicates into simplifying
> functions. This change could break code. A compromise is to give oddp
> (and friends) an optional argument that allows for a literal or
> non-literal test; examples:
>
>  (%i1)  declare(o,odd)$
>
> Default is a literal test for an odd integer:
>
>  (%i2)  oddp(o);
>  (%o2)  false
>
> Nondefault test:
>
>  (%i3)  oddp(o, 'nonliteral);
>  (%o3)  true

I'm 100% in favor of nonliteral predicates, but I can't figure out
how to distinguish literal from nonliteral tests.
I'm convinced we need both. I have to say that the optional flag
argument seems clumsy. Same with separately named functions,
e.g. oddp and literal_oddp or something like that.

It occurs to me that there could conceivably be a literalp
predicate which would identify numbers, strings, ... (what else?)
Then assuming that P(x) is always a simplifying predicate,
literalp(x) and P(x) is the literal version of the test.
Maybe there aren't very many kinds of interesting literals;
maybe numberp(x) and P(x) is enough.

For what it's worth I'm not very worried about changing the
behavior of some existing functions (to make them simplifying).

best

Robert Dodier