1

Pyeda permits to write boolean expression in prefix form and in infix form:

p = Or(And("A","B"), And("C","D")) # prefix
i = expr("A & B | C & D") # infix

Although it's possible to retrieve automatically from i the relative prefix form, I don't know (no findings in docs) if it's possible to retrieve the string infix representation of p .

Some helps?

Mad Physicist
  • 107,652
  • 25
  • 181
  • 264
enneppi
  • 1,029
  • 2
  • 15
  • 33

1 Answers1

2

PyEDA author here.

The latest release doesn't have this feature. If you go back to version 0.26.0, you can try the to_latex and to_unicode methods.

For example:

>>> p = Or(And("A","B"), And("C","D"))
>>> p.to_unicode()
'A · B + C · D'

IIRC, the reason for this omission was the switch from Python to C for the boolean expression engine. A couple undocumented features just got left out b/c it was either difficult, or broken.

PRs welcome, of course :)

Chris Drake
  • 353
  • 1
  • 7
  • this is a pity. anyway chris, another question. there is a way to neutralize a formula? eg. from And(Or(a,b), And(None,c)) to And(Or(a,b)) – enneppi Dec 23 '16 at 21:04
  • 1
    Not sure what you mean by "neutralize" here. Maybe something like a tree manipulation where you delete nodes directly? No, I don't think I have implemented that kind of transform. Your example will return a Zero object, b/c the None will be interpreted as "Falsey" and force the inner and outer And to zero. You can try using identities to eliminate nodes differently than dominators. – Chris Drake Dec 23 '16 at 21:27
  • Hi @Christ Drake how can i install the 0.26.0 version? – enneppi Jan 10 '17 at 08:58