Summary: Problems on propositional logic, including truth-tables, boolean algebra, and inference rules.
Please write logic formulas using the syntax
previously defined,
using
/home/comp280/bin/waterworld.
[Practice problem—solution provided.]
Your friend Tracy argues: “It is bad to be depressed. Watching the news makes me feel depressed. Thus, it's good to avoid watching the news.”
Regardless of whether the premises and conclusion are true, show that the argument is not, by showing it doesn't hold for all domains. Replace “depressed” and “watching news” with expressions which leave the premises true, but the conclusion false (or at least, what most reasonable people would consider false).
Lots of possible counterexamples. “It is bad to be depressed. Doing homework makes me depressed; so it's good to not do my homework.” Or, “It is bad for people to be in physical pain. Childbirth causes pain. Therefore childbirth needs be avoided by all people.” If the original conclusion is really correct, Tracy needs to elucidate some of his unspoken assumptions.
The flaw seems to be along the lines of, “avoiding bad in the short run may not always be good in the long run” (or equivalently, sometimes you have to choose the lesser of two evils). No, you weren't asked to name a specific flaw, and reasonable people can differ on precisely what the flaw is. (And, formal logic is not particularly helpful here.) Nonetheless, uncovering hidden assumptions in arguments often helps understand the real issues involved.
[Practice problem—solution provided.]
An acquaintance says the following to you: “Chris claims knowledge is more important than grades. But she spent yesterday doing an extra-credit assignment which she already knew how to do. Therefore, she's a hypocrite and deserves no respect.”
Regardless of whether the premises and conclusion are true, show that the argument is not, by showing it doesn't hold for all domains. Replace “knowledge” and “grades” with expressions which give you true premises, but a false conclusion (or at least, what most reasonable people would consider false).
“Terry claims that encouraging human-rights is more important than playing Tetris. But Terry played Tetris yesterday rather than volunteering with Amnesty International.” Most people wouldn't condemn Terry as a hypocrite just because of this; even the most dedicated of people are entitled to some free time. If your friend wants to prove Terry hypocritical, they'll have to provide further evidence or arguments.
Or similarly, “Politician X claims to support science funding, but voted against a proposal to shift all Medicare funds to NASA.”
[Practice problem—solution provided.]
While the following argument may sound plausible initially, give a particular situation where the conclusion doesn't hold (even though the premises do). Then, in a sentence or two, sketch why your counterexample may still represent rational behavior — that is, point out a real-world subtlety that the initial argument ignored.
Choose just one of the following informal arguments. While the argument sounds plausible initially, give a particular situation where the conclusion doesn't hold (even though the premises do). Then, sketch why your counterexample may still represent rational behavior (1 sentence) — that is, point out a real-world subtlety that the initial argument ignored.
[Practice problem—solution provided.]
Let
Translate the following English sentences into propositional logic. Your answers should be WFFs.
[Practice problem—solution provided.]
It just so happens that all the web pages in Logiconia
which contain the word
“Poppins” also contain the word “Mary”.
Write a formula (a query) expressing this.
Use the proposition
Write a formula expressing all this.
(Your formula will involve five propositions:
Given the above statements, if a web page in Logiconia does not contain “weasel”, does it contain “mongoose”?
Let's go meta for a moment: Is this web page Logiconian? (Yes, this one you're looking at now, the one with the homework problems.) Explain why or why not.
Different search engines on the web have their own syntax for specifying searches.
[Practice problem—solution provided.]
![]() |
Consider the particular board shown in the above figure.
For each, there are also many such formulas composed
with connectives such as
In that
same board, is location
Give a domain axiom of WaterWorld which was omitted in the ellipses in the WaterWorld domain axioms.
Even allowing for ellision, the list of WaterWorld domain axioms is incomplete, in a sense. The game reports how many pirates exist in total, but that global information is not reflected in the propositions or axioms.
First, assume we only use the default WaterWorld board size and number of pirates, i.e., five. Give samples of the additional axioms that we need.
Next, generalize your answer to model the program's ability to play the game with a different number of pirates.
Give one WFF which meets all three conditions:
When writing truth tables, please list rows in the order used in all examples: FF, FT, TF, TT. For three-input tables, use the above four lines preceded by F, then the above four lines preceded by T.
In a truth table for two inputs, provide a column for each of the sixteen possible distinct functions. Give a small formula for each of these functions.
[Practice problem—solution provided.]
Write the truth table for “xnor”, the negation of exclusive-or, What is a more common name for this Boolean function?
| xnor | ||
|---|---|---|
This is the “equals” for Booleans. It is also represented by the connective if-and-only-if.
If you said something like “the both-or-neither function”, that's not quite good enough, as it's a roundabout way of expressing the simple idea of equivalence. Granted, it takes some practice to internalize Booleans as values, and that equality is as valid for them as for any other value.
Use truth tables to answer each of the following. Showing whether the connectives obey such properties via truth tables is one way of establishing which equivalences or inference rules we should use.
For each of the following, find a satisfying truth assignment, (values of the propositions which make the formula true), if any exists.
For each of the following, find a falsifying truth assignment, (values of the propositions which make the formula false), if any exists.
Using truth tables, show that
[Practice problem—solution provided.]
When writing a complicated conditional that involves multiple pieces of data, it is easy to incorrectly oversimplify. One strategy for avoid mistakes is to write such code in a two-step process. First, write a conditional with a case for every possible combination, as in a truth table. Second, simplify the conditional.
Using this approach, we might obtain the following code after the first step. Simplify this code.
list merge_sorted_lists(list list1, list list2)
{
if (is_empty(list1) && is_empty(list2))
return empty_list;
else if (is_empty(list1) && !is_empty(list2))
return list2;
else if (!is_empty(list1) && is_empty(list2))
return list1;
else if (!is_empty(list1) && !is_empty(list2)) {
if (first_element(list1) < first_element(list2))
return make_list(first_element(list1),
merge_sorted_lists(rest_elements(list1),list2));
else if (first_element(list1) >= first_element(list2))
return make_list(first_element(list2),
merge_sorted_lists(list1,rest_elements(list2)));
}
}
list merge_sorted_lists(list list1, list list2)
{
if (is_empty(list1))
return list2;
else if (is_empty(list2))
return list1;
else {
if (first_element(list1) < first_element(list2))
return make_list(first_element(list1),
merge_sorted_lists(rest_elements(list1),list2));
else
return make_list(first_element(list2),
merge_sorted_lists(list1,rest_elements(list2)));
}
}
Alternatively, we could test the emptiness of the lists in the other order.
Consider the following conditional code, which returns a boolean value.
int i;
bool a,b;
…
if (a && (i > 0))
return b;
else if (a && i <= 0)
return false;
else if (a || b)
return a;
else
return (i > 0);
Simplify it by filling in the following blank with a single
Boolean expression.
Do not use a conditional
(such as if or ?:).
int i;
bool a,b;
…
return ________________;
Use either Java/C++ or Scheme syntax. In the former case, please fully parenthesize to make your formula unambiguous, rather than relying on Java's or C++'s many levels of operator precedence.
[Practice problem—solution provided.]
Using
algebraic identities,
and the definition
First we show that we can write negation in terms of NOR, or
more specifically,
| 1 | ||
| 2 |
Idempotency of |
|
| 3 | DeMorgan's law | |
| 4 | Definition of NOR |
We use this lemma to show our ultimate goal:
| 1 | ||
| 2 | Double Complementation | |
| 3 | DeMorgan's law | |
| 4 |
Lemma,
with |
|
| 5 |
Lemma, with |
|
| 6 |
Definition of |
Note that we judiciously used new meta-variables
Using
algebraic identities,
show that
This is an algebraic hand-evaluation:
a series of formulas joined by
In two exercises, you've shown the same equivalence by truth tables and by algebraic identities.
Consider trying to show equivalent two formulas with a hundred propositions each, instead of just three. What is an advantage of using truth tables? What is an advantage of using identities?
In that truth table exercise, you also showed two formulas non-equivalent. It is also possible to do so with Boolean algebra rather than truth tables — how?
Describe a hybrid approach, combining truth tables and Boolean algebra, to prove the equivalence and non-equivalence of formulas.
To ponder on your own without turning it in: Which approach appeals more to you?
Using
algebraic identities,
rewrite the formula