-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
31 lines (25 loc) · 849 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import parse_logic as logic
import infers_cases as cases
import create_latex as latex
# Define the variables you need here
p = logic.Variable("P")
q = logic.Variable("Q")
# Write here the assertion for which you want to generate a truth table
# ¬ is ~ (not)
# ∨ is | (or)
# ∧ is & (and)
# ⇒ is >> (implies)
assertion = q & p
# List all the variables you use here
variables = [p, q]
table = cases.Table(
logic.L3, # Select whether you want classical propositional logic (L2) or Lukasiewicz logic (L3)
variables
)
for case in cases.get_headers(assertion):
table.insert_case(case)
#debug check
print([[repr(e) for e in line] for line in table._table])
latex_tab = latex.create_latex_from_table(table)
print(latex_tab)
latex.save(latex_tab) # This will save the result in a .tex file located at ./latex_output/output.tex