Post Reply 
newRPL - build 1255 released! [updated to 1299]
07-31-2019, 02:15 PM (This post was last modified: 07-31-2019 02:34 PM by Claudio L..)
Post: #549
RE: newRPL - build 1255 released! [updated to 1282]
(07-31-2019 10:45 AM)JoJo1973 Wrote:  Would it make sense to enforce assumptions at EVALuation?

Suppose I have this expression on the stack:

'X+1' whereas X:Z∞

Now I store 0.5 in X and EVAL the expression above. Should it error out with "Wrong Assumptions" or similar, or not?

I think that would count as "nagging" :-). If I want to store 0.5 in X without rewriting my expression the last thing I want is the calc complaining that I have to do more work...
On the other hand, those "hints" are more for the symbolic manipulation of the expression than for evaluation, I see them as 2 completely different things.

What you want is more in line with the "given that" operator |.
We could use the same operator and have 2 different uses:
'X+1 | X:→4' would enforce X=4. This fixed substitution would take place before any of EVAL, RULEAPPLY, or AUTOSIMPLIFY (notice that X:→4 is nothing but a rule being applied prior to any other manipulation) so X would automatically be treated as an even positive integer number and would match all the rules for numbers.
After EVAL, RULEAPPLY or AUTOSIMPLIFY, the rule X:→4 and the operator | will be removed from the expression, since the substitution will have been done.
'X+1 | X:Z∞' would simply add hints to variable X without providing a specific value. Hints work only during symbolic manipulation, if a global variable X exists during evaluation, it will be replaced and there's no reason to enforce the hints.
After EVAL, RULEAPPLY or AUTOSIMPLIFY, the hints will still be there, rules will be gone (already applied).


EDIT: Actually, the operator | should have 3 different uses: enforcing rules, applying hints and providing constraints (equalities, inequalities, etc.), like 'X+Y+1 | X+Y>4'
I think inequalities can be handled with variable substitution:
A>B means A-B>0 (here A and B are arbitrary expressions, not variables), so we can substitute a=A-B (here 'a' is a variable) and therefore apply a rule A:→a+B
Then we can hint a:R>0 so the rules engine knows all the information the inequality provided.
Finally, after all is done (RULEAPPLY, AUTOSIMPLIFY, whatever), apply the inverse substitution: a:→A-B
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: newRPL - build 1001 released! - pier4r - 12-16-2017, 08:03 AM
newRPL - on Hp 39gs - Martin Hepperle - 06-05-2019, 06:51 AM
RE: newRPL - build 1001 released! - pier4r - 12-23-2017, 10:16 AM
RE: newRPL - build 1001 released! - pier4r - 01-01-2018, 09:42 AM
t - Claudio L. - 01-01-2018, 03:06 PM
RE: newRPL - build 1001 released! - pier4r - 01-01-2018, 03:41 PM
RE: newRPL - build 1001 released! - pier4r - 01-02-2018, 04:54 PM
RE: newRPL - build 1001 released! - pier4r - 01-02-2018, 06:58 PM
newRPL - brickviking - 10-05-2018, 06:01 AM
RE: newRPL - build 1255 released! [updated to 1282] - Claudio L. - 07-31-2019 02:15 PM
How to participate? - erazor - 12-13-2019, 07:12 AM



User(s) browsing this thread: 1 Guest(s)