Menu

Does REDUCE support term rewriting with conditional rule application?

2019-04-26
2019-04-27
  • Nikos P. Pitsianis

    Hello!
    Does REDUCE support term rewriting with conditional rule application?

    For example Mathematica allows to name sets of rules with conditions

    rule-name = pattern :> replacement-value \; condition
    

    and then apply it

    expression //. rule-name
    

    Is there an equivalent way to have such functionality with REDUCE?
    A casual browsing of the online documentation did not locate the word rewrite.

    The for all such that let seem to define conditional rules but I did not figure out how to apply them strategically.

    My "rules" are mathematical identities that I need to apply both from right to left and left to right, with some simplifications in-between. In order to avoid infinite loops, I group the rules and apply the groups under strategies that achive the desired synthesis and symplification.

    Any pointers to examples will be very helpful. Abologies for the newcomer questions.

     
  • arpi

    arpi - 2019-04-26

    I think the "where" construct may be applicable,
    var2 := ( var1 where {rules} );

     
  • Rainer Schöpf

    Rainer Schöpf - 2019-04-27

    Exactly, this is explained in section 11.3 of the manual, "Rule Lists".

    In addition, you might want to look at the contributed PM package, which implements a patern matcher that is similar in style to those found in Mathematica.

    Rainer

     

Log in to post a comment.