Worksheets related to Applied Discrete Structures
Image: ubuntu2004
An Introduction to Logic using Sage
Applied Discrete Structures by Alan Doerr & Kenneth Levasseur is licensed under a Creative Commons Attribution - Noncommercial - No Derivative Works 3.0 United States License.Here are a few tips on how to get started using Sage to work logic. We look at possible answers to #2 in Section 3.3 of Applied Discrete Structures.
Here are the symbols used in Sage.
and | .... | & |
or | .... | | |
not | .... | ~ |
Something that is equivalent to x?
It's a cop-out but you could answer x here. ... and the same for the other two parts.
Here is one that is a bit more .
Something that implies x?
Here you need a proposition that has the property that when it is true, is also true. Looking at the truth table, one proposition that works is "p and q and r." Let's test it.
Something that is implied by x?
There are lots of pos sible answers here, as there was in the previous part. One is to notice that whenever p is true in the truth table, x is also true.
Here is an algorithmic solution to exercise 10 at the end of Section 3.7, on Mathematical Induction. The problem was to prove that all postage amounts greater than or equal to 8 can be made using 3 and 5 cent stamps. Notice that the solution for any value of [removed]n greater than 8 relies on the solution of the previous value, [removed]n-1, in the same way as we can verify by induction that if the case of [removed]n-1 can be solved, then we can use it to solve the case of [removed]n.
Thanks to Richard Voss for the following code that produces a truth table that is more compatible with the text.
Testing the validity of a logical argument.
Consider the argument