Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("\n")
- p = input("Give the value of p: ")
- q = input("Give the value of q: ")
- r = input("Give the value of r: ")
- s = input("Give the value of s: ")
- prompt_inference = int(input("""
- Rule of Inference:
- (1) Modus Ponens (6) Hypothetical Syllogism
- (2) Modus Tollens (7) Disjunctive Syllogism
- (3) Addition (8) Constructive Dilemma
- (4) Simplification (9) Destructive Dilemma
- (5) Conjunction
- Choose your desired rule of inference: """))
- # MODUS PONENS
- if prompt_inference == 1:
- print(
- f"""
- You chose Modus Ponens
- Result:
- If {p}, then {q}.
- {p.title()}.
- ----------------------------
- Therefore, {q}.
- """)
- # MODUS TOLLENS
- elif prompt_inference == 2:
- print(
- f"""
- You chose Modus Tollens
- Result:
- If {p}, then {q}.
- not {q}.
- ----------------------------
- Therefore, not {p}.
- """)
- # ADDITION
- elif prompt_inference == 3:
- print(
- f"""
- You chose Addition
- Result:
- {p.title()}.
- ----------------------------
- Therefore, either {p} or {q}.
- """)
- # SIMPLIFICATION
- elif prompt_inference == 4:
- print(
- f"""
- You chose Simplification
- Result:
- {p.title()} and {q}.
- ----------------------------
- Therefore, {p}.
- """)
- # CONJUNCTION
- elif prompt_inference == 5:
- print(
- f"""
- You chose Conjunction
- Result:
- {p.title()}.
- {q.title()}.
- ----------------------------
- Therefore, {p} and {q}.
- """)
- # HYPOTHETICAL SYLLOGISM
- elif prompt_inference == 6:
- print(
- f"""
- You chose Hypothetical Syllogism
- Result:
- If {p}, then {q}.
- If {q}, then {r}.
- ----------------------------
- Therefore, if {p}, then {r}.
- """)
- # DISJUNCTIVE SYLLOGISM
- elif prompt_inference == 7:
- print(
- f"""
- You chose Disjunctive Syllogism
- Result:
- {p.title()} or {q}.
- Not {p}.
- ----------------------------
- Therefore, {q}.
- """)
- # CONSTRUCTIVE DILEMMA
- elif prompt_inference == 8:
- print(
- f"""
- You chose Constructive Dilemma
- Result:
- If {p}, then {q} and if {r}, then {s}.
- Either {p} or {r}.
- ----------------------------
- Therefore, either {q} or {s}.
- """)
- # DESTRUCTIVE DILEMMA
- elif prompt_inference == 9:
- print(
- f"""
- You chose Destructive Dilemma
- Result:
- If {p}, then {q} and if {r}, then {s}.
- Either not {q} or {s}.
- ----------------------------
- Therefore, either not {p} or {r}.
- """)
- else:
- print("Incorrect input. Only input numbers from (1-9).")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement