#15018: add recover_formula and prefix_to_infix functions to logicparser.py
-------------------------------------+-------------------------------------
Reporter: pmscurek | Owner: Paul Scurek
Type: PLEASE CHANGE | Status: new
Priority: major | Milestone: sage-5.12
Component: misc | Keywords: logic,
Merged in: | logicparser, prefix, infix
Reviewers: | Authors: Paul Scurek
Work issues: | Report Upstream: N/A
Dependencies: #14951, #14952, | Branch:
#15013 | Stopgaps:
-------------------------------------+-------------------------------------
In the patch for this ticket, the functions recover_formula and
prefix_to_infix are added to logicparser.py in the logic module. The
function recover_formula allows for the recovery of a boolean formula from
its parse tree. The function prefix_to_infix converts a parse tree from
prefix form to infix form. Here are some examples.
{{{
#!python
sage: import sage.logic.logicparser as logicparser
sage: t = ['->', ['~', 'a'], ['|', 'c', ['~', 'd']]]
sage: logicparser.recover_formula(t)
'~a->(c|~d)'
}}}
{{{
#!python
sage: import sage.logic.logicparser as logicparser
sage: t = ['->', ['~', 'a'], ['|', 'c', ['~', 'd']]]
sage: logicparser.prefix_to_infix(t)
[['~', 'a'], '->', ['c', '|', ['~', 'd']]]
}}}
--
Ticket URL: <http://trac.sagemath.org/ticket/15018>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.