Skip to content

move conditions to predicates in all rules, to mitigate the oooomm problem #59

@Bumblebee00

Description

@Bumblebee00

the oooomm problem is one of the problems stopping from integrating some expressions with the rule based method, read the linked issue to know the problem. It's particularly evident in the rules for symbolic integration, that usually have a lot of conditions on the variables, joined in a and. for example:

("1_1_1_2_32",
:(∫(((~!a) + (~!b)*(~x))^(~m)*((~!c) + (~!d)*(~x))^(~n),(~x)) ) => :(
    !contains_var((~a), (~b), (~c), (~d), (~x)) &&
    !eq((~b)*(~c) - (~a)*(~d), 0) &&
    lt(-1, (~m), 0) &&
    le(-1, (~n), 0) &&
    le(ext_den((~n)), ext_den((~m))) &&
    int_linear((~a), (~b), (~c), (~d), (~m), (~n), (~x)) ?
ext_den((~m))⨸(~b)* int_and_subst((~x)^(ext_den((~m))*((~m) + 1) - 1)*((~c) - (~a)*(~d)⨸(~b) + (~d)*(~x)^ext_den((~m))⨸(~b))^(~n),  (~x), (~x), ((~a) + (~b)*(~x))^(1⨸ext_den((~m))), "1_1_1_2_32") : nothing))

these conditions are all in the rhs, and after a match for the rule is found, the rhs is evaluated and the conditions too.
as said in the issue one way to mitigate the oooomm problem is to bring all conditions that depend on only one variable, to a predicate in the rule. predicates in rules are special conditions that get evaluated as soon as the match is made, during the matching process. This would also increase the speed of the matching process because a bad match is discarded immediatly.

So for example the above rule, can be rewritten like:

("1_1_1_2_32",

:(∫(((~!a) + (~!b)*(~x))^(~m::(m->lt(-1,m,0)))*((~!c) + (~!d)*(~x))^(~n::(n->le(-1, n, 0))),(~x)) ) => :(
    !contains_var((~a), (~b), (~c), (~d), (~x)) &&
    !eq((~b)*(~c) - (~a)*(~d), 0) &&
    le(ext_den((~n)), ext_den((~m))) &&
    int_linear((~a), (~b), (~c), (~d), (~m), (~n), (~x)) ?
ext_den((~m))⨸(~b)* int_and_subst((~x)^(ext_den((~m))*((~m) + 1) - 1)*((~c) - (~a)*(~d)⨸(~b) + (~d)*(~x)^ext_den((~m))⨸(~b))^(~n),  (~x), (~x), ((~a) + (~b)*(~x))^(1⨸ext_den((~m))), "1_1_1_2_32") : nothing))

where the conditions on ~m and ~n have been moved as predicates. add5a99

ideally we should do this for every rule. this can first be done manually, but then its possible and also not too difficult to implement it atuomatically in the translator script

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions