Re: Forgetting facts from the global context

Barton Willis via Maxima-discuss <[email protected]> Sat, 23 May 2026 20:28:20 +0000
Newsgroups gmane.comp.mathematics.maxima.general
Message-ID <SN6PR07MB79525FE508AA6E9F709E0692B60C2@SN6PR07MB7952.namprd07.prod.outlook.com>
The user documentation doesn't, I think, clarify this question about facts in the global context.  But I have assumed for a long time that there should be no user-level way to add or remove facts from the global context.

As I recall, long ago I asked about when it is necessary to use activate.  I think this example shows one case where it is needed:

(%i1) cntx1 : newcontext()$

(%i2) assume(c1 > 0)$

(%i3) cntx2 : newcontext()$

(%i4) assume(c1 > 0);
(%o4) [c1>0]

(%i5) forget(c1 > 0)$

(%i6) killcontext(cntx2);
(%o6) done

Yikes! Looks like cntx1 is empty!

(%i7) facts(cntx1);
(%o7) []

(%i8) is(c1 > 0);
(%o8) unknown

No wait! It only needs to be activated:

(%i9) activate(cntx1);
(%o9) done

(%i10)      facts(cntx1);
(%o10)      [c1>0]

(%i11)      is(c1 > 0);
(%o11)      true
________________________________
From: David Scherfgen via Maxima-discuss <[email protected]>
Sent: Saturday, May 23, 2026 11:43 AM
To: <[email protected]> <[email protected]>
Subject: [Maxima-discuss] Forgetting facts from the global context

Caution: Non-NU Email

Dear all,

After adding the assumptions zeroa > 0 and zerob < 0 to the global context recently (the same way the assumptions about built-in constants are added on startup), Barton and I discovered that these facts can be forgotten via forget.

Interestingly, after calling forget(zeroa > 0), that fact still exists in the global context, but the $zeroa symbol has lost its DATA property, and as a result, Maxima doesn't know any more that zeros > 0.

While that's probably a bug on its own, the actual question is this: Should it be forbidden to forget facts that live in the global context? (At least when the current context is not the global one?)

My personal opinion is that it should be forbidden, just like we forbid to assign values to %pi etc.

Best regards
David Scherfgen

_______________________________________________
Maxima-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/maxima-discuss