Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trac #15018: add recover_formula and prefix_to_infix functions to log…
…icparser.py 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']]] }}} URL: http://trac.sagemath.org/15018 Reported by: pmscurek Ticket author(s): Paul Scurek Reviewer(s): Frédéric Chapoton, Travis Scrimshaw
- Loading branch information
Showing
1 changed file
with
245 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters