cjdrake / pyeda

Python EDA
BSD 2-Clause "Simplified" License
304 stars 54 forks source link

AttributeError: 'XorOp' object has no attribute 'to_cdnf' #138

Open ghost opened 7 years ago

ghost commented 7 years ago

Hi.

Canonical Normal Form in docs is broken now. I'm trying to run the example from the documentation at the link above.

>>> f = Xor(a, Implies(b, c))
>>> f
Xor(a, Implies(b, c))
>>> f.to_cdnf()
Traceback (most recent call last):
  File "/usr/lib/python3.5/code.py", line 91, in runcode
    exec(code, self.locals)
  File "<input>", line 1, in <module>
AttributeError: 'XorOp' object has no attribute 'to_cdnf'

Same thing with another form (ccnf). How can I get ccnf and cdnf forms?

I am using python3, Ubuntu 16.04, the latest version of the library (0.28.0) installed by pip. Other examples of work, such as to_dnf() or to_cnf() works good.

Zik42 commented 7 years ago

On windows 10 I have the same problem.

cjdrake commented 7 years ago

Thanks for the bug report. I just moved, so I'm a little late looking at stuff right now.

oscarys commented 5 years ago

Hello everyone. I was trying to use *.to_ccnf() and this error persists (it seems that this code hasn't been touched for a long while). It is a great library, though !!

EDIT: Just browsed through the source, those canonical normal forms are gone =(

myzinsky commented 1 year ago

+1 here...

myzinsky commented 1 year ago

A quick workaround is to use expansion(all variables...) to get the canonical form.

cjdrake commented 1 year ago

I wild Matthias Jung appeared :).

This comment sent me on a brief trip down memory lane. I got rid of the to_ccnf function Feb 2, 2015 (34fda11e) when I converted the Python implementation of expressions to C.

Can't remember exactly what I was thinking at the time. Probably that a canonical CNF/DNF is necessarily exponential in size, so not that interesting to begin with.

Btw, the code in http://www.boolexpr.org/index.html is probably easier to deal with, though I haven't been working on it lately either.

myzinsky commented 1 year ago

I'm everywhere :-D

This comment sent me on a brief trip down memory lane. I got rid of the to_ccnf function Feb 2, 2015 (https://github.com/cjdrake/pyeda/commit/34fda11efcf8f3c61fabcd6af813ae2a3ac46ca9) when I converted the Python implementation of expressions to C.

You should remove it then also from the Docs :-)

I think it makes sense to still have CCND/CDNF because it is useful for lectures and demonstration purposes, even it grows exponential.

cjdrake commented 1 year ago

This is fair.