Scope, assumptions, asksign, context. Was Re: Bug in Maxima 5.30.0



On 2013-08-31, John Lapeyre <lapeyre.math122a at gmail.com> wrote:

> On 08/30/2013 08:17 PM, Richard Fateman wrote:
>
>>  assume(x>0) block([x],assume(x<0), is (x>0)) returns true.
>
> This might be a work around in some cases.
>
>   assume(x>0);
>   assume(y<0);
>
>   testassume() := block([x,mycontext,res,oldxfacts ],
>    oldxfacts : facts(x),
>    mycontext : gensym(),
>    msupcontext(mycontext),
>    forget(oldxfacts),
>    assume(x<0),
>    res : is(x<0) and is(y<0),
>    killcontext(mycontext),
>    res);

One could separate the scope of symbols from the scope of assumptions --
with suitable programming one could mix-n-match stuff like:

  with [x, y] lexically (...);

which evaluates (...) in an environment where x and y are distinct from
any other similarly-named symbols, and

  assuming [<facts>] (...);

which creates a context, asserts <facts>, evaluates (...), and destroys
the context. (Programming stuff like that is not too difficult; probably
easier than getting anybody to agree and the syntax.) Then the example
could be written:

  assume (x > 0, y < 0);
  with [x, y] lexically
    (assuming [x < 0] (print (is (x > 0), is (y > 0))));
 
which should print "false, unknown". Of course one can imagine other
combinations.

best

Robert Dodier