Type the truth-definition of implication in Python (it is false only when P true, Q false)
Type the truth-definition of implication in Python (it is false only when P true, Q false)
Answer
def implies(p, q): return (not p) or q
P → Q ≡ ¬P ∨ Q. The function returns False in exactly one case — `p=True, q=False` — and True otherwise, including both rows where the antecedent is False (vacuous truth). This `implies` helper is reused in the truth-table exercise next lesson.