Ask Your Question
0

Connecting two previously defined propcalc formulas using ->

asked 2012-12-08 13:59:44 +0100

matrimc gravatar image

updated 2015-01-13 22:47:40 +0100

FrédéricC gravatar image
import sage.logic.propcalc as propcalc
f = propcalc.formula("(a->b)&(b->c)")
g = propcalc.formula("a->c")
h = f -> g
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_3.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("aW1wb3J0IHNhZ2UubG9naWMucHJvcGNhbGMgYXMgcHJvcGNhbGMKZiA9IHByb3BjYWxjLmZvcm11bGEoIihhLT5iKSYoYi0+YykiKQpnID0gcHJvcGNhbGMuZm9ybXVsYSgiYS0+YyIpCmggPSBmIC0+IGc="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>

  File "/tmp/tmp4YAIeP/___code___.py", line 5
    h = f -> g
           ^
SyntaxError: invalid syntax

This looks like Python interpreter is interpreting the line before it goes to the propcalc. How do I make the formula f -> g? Is there some function like h = f.implies(g) or some such?

Thanks

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2012-12-08 17:10:53 +0100

matrimc gravatar image

updated 2013-01-03 17:15:19 +0100

OK. I found the answer.

h = f.ifthen(g)
h.truthtable()

which shows that hypothetical syllogism is a valid derivation.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2012-12-08 13:59:44 +0100

Seen: 319 times

Last updated: Jan 03 '13