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



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);

A problem is that I had to write `msupcontext' which
does evaluate its arguments, becuase supcontext does not.
(newcontext, killcontext, etc. do evaluate their arguments).
There might be an easier way around the evaluation problem.

John

>  and who knows where else.
>
>  RJF
>
>
>  On 8/30/2013 10:50 AM, Stavros Macrakis wrote:
> > It is clearly wrong to have $sign call clearsign -- sign/asksign 
results are supposed to be persistent across a single user interaction 
(%i/%o -- see suprv1/meval*). This makes sense because the user has no 
way of knowing what internal/local scope they might be in.
> >
> > If a more local scope is wanted for a sign/asksign result, it should 
be handled using the context mechanism. I suppose you could try to do it 
also using unwind-protect etc., but that is tricky to get right. For 
example, I see that compar/asksign-p-or-n has a bug where if it is 
previously assumed that not equal(x,0), then (asksign-p-or-n x) will 
remove that preexisting assumption.
> >
> > I suppose there may be cases where the caller really knows that the 
result should not be persistent, and could call sign-plus-cleanup, but 
that seems like a really bad idea in general.
> >
> > -s
> >
> >
> >
> > On Fri, Aug 30, 2013 at 12:52 PM, Robert Dodier 
<robert.dodier at gmail.com> wrote:
> >
> > On 2013-08-30, Raymond Toy <toy.raymond at gmail.com> wrote:
> >
> > > 3137b946bed77dc4311e4266ed338cd2d46d299f is the first bad commit
> > > commit 3137b946bed77dc4311e4266ed338cd2d46d299f
> > > Author: robert_dodier <robert_dodier at users.sourceforge.net>
> > > Date: Thu Mar 21 16:03:43 2013 -0700
> > >
> > > Call CLEARSIGN from $SIGN to clean up facts introduced by sign 
functions.
> > >
> > > All versions before this commit are fine; you only have to answer one
> > > question and the integral is evaluated correctly. All versions 
after this
> > > version are bad; you have to answer several questions and the integral
> > > is not evaluated.
> >
> > Hrm. That change was made to counteract some other strange behavior --
> > 'sign' left some facts floating around after it was called. Without
> > looking at the integration code, my guess is that it is assuming the
> > sign fact persists for the duration of the integration. Should there be
> > separate sign-plus-cleanup and sign-with-no-cleanup functions? It hurts
> > my head a little bit but maybe so ....
> >
> > Thanks for looking into it --
> >
> > Robert Dodier
> >
> > _______________________________________________
> > Maxima mailing list
> > Maxima at math.utexas.edu
> > http://www.math.utexas.edu/mailman/listinfo/maxima
> >
> >
> >
> >
> > _______________________________________________
> > Maxima mailing list
> > Maxima at math.utexas.edu
> > http://www.math.utexas.edu/mailman/listinfo/maxima
>
>
>
>  _______________________________________________
>  Maxima mailing list
>  Maxima at math.utexas.edu
>  http://www.math.utexas.edu/mailman/listinfo/maxima