Ask Your Question
0

Connecting two previously defined propcalc formulas using ->

asked 12 years ago

matrimc gravatar image

updated 10 years ago

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

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
0

answered 12 years ago

matrimc gravatar image

updated 12 years ago

OK. I found the answer.

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

which shows that hypothetical syllogism is a valid derivation.

Preview: (hide)
link

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: 12 years ago

Seen: 352 times

Last updated: Jan 03 '13