Multiplication question

14 views
Skip to first unread message

Sanjai Narain

unread,
Feb 12, 2018, 11:12:41 AM2/12/18
to pySMT
Hello, I would appreciate knowing how to avoid the error for the last call below. Thanks. -- Sanjai 

from pysmt.shortcuts import Symbol, Times
from pysmt.typing import REAL

def f(x,y):
    return Symbol(("f_%s_%s" % (x,y)), REAL)

# This prints fine
print Times(f(1, 2), f(3, 4))

# But this gives an error ending in AttributeError: 'float' object has no attribute 'args'
print Times(1.0, f(1, 2))


Andrea Micheli

unread,
Feb 12, 2018, 6:03:14 PM2/12/18
to Sanjai Narain, pySMT
Dear Sanjai,

you need to transform the python 1.0 into a real constant representing 1.0. In pysmt this is done as follows:

print Times(Real(1.0), f(1, 2))

Cheers,

Andrea

--
You received this message because you are subscribed to the Google Groups "pySMT" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pysmt+unsubscribe@googlegroups.com.
To post to this group, send email to py...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pysmt/f0fec79f-0cf7-47bf-9f13-334f1fdd2ce1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Le informazioni contenute nella presente comunicazione sono di natura privata e come tali sono da considerarsi riservate ed indirizzate esclusivamente ai destinatari indicati e per le finalità strettamente legate al relativo contenuto. Se avete ricevuto questo messaggio per errore, vi preghiamo di eliminarlo e di inviare una comunicazione all’indirizzo e-mail del mittente.
--
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. If you received this in error, please contact the sender and delete the material.

Sanjai Narain

unread,
Feb 12, 2018, 9:22:08 PM2/12/18
to pySMT
Thanks, Andrea. That worked. BTW, Z3Py is forgiving of this.  -- Sanjai


On Monday, February 12, 2018 at 6:03:14 PM UTC-5, Andrea Micheli wrote:
Dear Sanjai,

you need to transform the python 1.0 into a real constant representing 1.0. In pysmt this is done as follows:

print Times(Real(1.0), f(1, 2))

Cheers,

Andrea
On Mon, Feb 12, 2018 at 5:12 PM, Sanjai Narain <sanjai...@gmail.com> wrote:
Hello, I would appreciate knowing how to avoid the error for the last call below. Thanks. -- Sanjai 

from pysmt.shortcuts import Symbol, Times
from pysmt.typing import REAL

def f(x,y):
    return Symbol(("f_%s_%s" % (x,y)), REAL)

# This prints fine
print Times(f(1, 2), f(3, 4))

# But this gives an error ending in AttributeError: 'float' object has no attribute 'args'
print Times(1.0, f(1, 2))


--
You received this message because you are subscribed to the Google Groups "pySMT" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pysmt+un...@googlegroups.com.

To post to this group, send email to py...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pysmt/f0fec79f-0cf7-47bf-9f13-334f1fdd2ce1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages