# How to do symbolic logic in Mathematica

I'm currently in Symbolic Logic with homework assignments (not asking for people to do my homework for me) with questions such as the following:

(derive the conclusion using the eighteen rules of inference)

1. R ⊃ B
2. R ⊃ (B ⊃ F )
3. B ⊃ (F ⊃ H )
Conclusion: R ⊃ H

Two questions: is there a way to go through the logic, with the rules (if there are built-in symbolic logic rules), to arrive at the specific conclusion (there are always multiple ways to solve it, however)? And more importantly, how do I do symbolic logic in mathematica? I can't find any resources that mention how to do it with the relevance of the kind of symbolic logic I'm doing in my class.

• The superset, ⊃, stands for 'implication' in my class. Commented May 18, 2016 at 5:07
• 1. Implies[R,B] 2. Implies[R,Implies[B,F]] 3. Division is not a logical operation. Commented May 18, 2016 at 5:51
• Oh, that's the conclusion after the forward slash Commented May 18, 2016 at 6:02
• Fixed @RomkeBontekoe Commented May 18, 2016 at 6:03

I am no expert on Boolean logic, but this may be some start for you:

homework = Implies[r, b] && Implies[r, Implies[b, f]] && Implies[b, Implies[f, h]]
BooleanConvert[homework]
LogicalExpand[homework]
BooleanTable[homework, {r, b, f, h}]


You could check the documentation and the examples of these functions.

You can make use of my SetSimplify function from my answer to How can I define operators that implement the algebra of sets?. After loading the code, we get:

SetSimplify[R ⊐ H, R ⊐ B && R ⊐ (B ⊐ F) && B ⊐ (F ⊐ H)]


True

where my code uses ⊐ instead of ⊃.