You will write a program that decides whether an argument is valid by checking every row of its truth table.
The idea. An argument is valid when no row makes every premise true and the conclusion false. Premises and the conclusion are Python functions of the letters, such as lambda p, q: (not p) or q.
Your tasks.
bad_rows(premises, conclusion, n). Return the list of rows in which all premises are true and the conclusion is false.valid(premises, conclusion, n). Return True when there is no bad row.tollens, the list of premises of modus tollens: and . Each premise is a function of p, q.Run your code once to unlock the worked solution.
Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…