forked from adamschoenemann/dmuac
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Chapter7_6.lhs
183 lines (158 loc) · 5.31 KB
/
Chapter7_6.lhs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
7.6 Review Exercises
====================
Exercise 13
-----------
Suppose the universe contains 10 elements. How many times
will $F$ occur when $∀x. ∃y. ∀z. F(x,y,z)$ is expanded into
quantifier-free form? How large in general are expanded expressions.
$F$ occur $10 × 10 × 10 = 10^3 = 1000$ times.
In general, expanded expressions become $n^k$ of length,
where $n = \text{n elems in universe}$ and $k = \text{number of nested expressions}$
Exercise 14
-----------
Prove $(∃x. f(x)) ∨ (∃x. g(x)) ⊢ ∃x. (f(x) ∨ g(x))$
*Proof*.
$$
\dfrac{
\dfrac{
\dfrac{}{(∃x. f(x)) ∨ (∃x. g(x))}
\quad
\dfrac{
\dfrac{
\boxed{\dfrac{}{∃x. f(x)}}
\quad
\dfrac{\boxed{f(p)}}{f(p)} {\scriptstyle \\{ ID \\}}
} {f(p)} {\scriptstyle \\{ ∃ E \\}}
} {f(p) ∨ g(p)} {\scriptstyle \\{ ∨ I_L \\}}
\quad
\dfrac{
\dfrac{
\boxed{\dfrac{}{∃x. g(x)}}
\quad
\dfrac{\boxed{g(p)}}{g(p)} {\scriptstyle \\{ ID \\}}
} {g(p)} {\scriptstyle \\{ ∃ E \\}}
} {f(p) ∨ g(p)} {\scriptstyle \\{ ∨ I_R \\}}
} {f(p) ∨ g(p)} {\scriptstyle \\{ ∨ E \\}}
} {∃x. (f(x) ∨ g(x))} {\scriptstyle \\{ ∃ I \\}}
$$
Exercise 15
-----------
Prove $(∀x. f(x)) ∨ (∀x. g(x)) ⊢ ∀x. (f(x) ∨ g(x))$
*Proof*.
$$
\dfrac{
\dfrac{
\dfrac{}{(∀x. f(x)) ∨ (∀x. g(x))}
\quad
\dfrac{
\dfrac{
\boxed{∀x. f(x)}
}{f(x)} {\scriptstyle \\{ ∀ E \\}}
}{f(x) ∨ g(x)} {\scriptstyle \\{ ∨ I_L \\}}
\quad
\dfrac{
\dfrac{
\boxed{∀x. g(x)}
}{g(x)} {\scriptstyle \\{ ∀ E \\}}
}{f(x) ∨ g(x)} {\scriptstyle \\{ ∨ I_R \\}}
}{f(x) ∨ g(x)} {\scriptstyle \\{ ∨ E \\}}
}{∀x. (f(x) ∨ g(x))} {\scriptstyle \\{ ∀ I \\}}
$$
Exercise 16
-----------
Prove the converse of Theorem 63.
$P → ∀x. f(x) ⊢ ∀x. (P → f(x))$
$$
\dfrac{
\dfrac{
\dfrac{
\dfrac{
\boxed{P}
\quad
P → ∀x. f(x)
}{∀x. f(x)} {\scriptstyle \\{ → E \\}}
}{f(q)} {\scriptstyle \\{ ∀ E \\}}
} {P → f(q)} {\scriptstyle \\{ → I \\}}
}{∀x. (P → f(x))} {\scriptstyle \\{ ∀ I \\}}
$$
Exercise 17
-----------
Find counterexamples that show that Laws 7.12 and 7.13, which
are implications, would not be valid as equations.
If $U = \\{1,2\\}$ and $f(x) ≡ x = 1$ and $g(x) ≡ x = 2$,
then the left side of 7.12 would expand as follows:
$$
\begin{align}
& (1 = 1 ∧ 1 = 2) ∨ (1 = 2 ∧ 2 = 2) \\\
= & (True ∧ False) ∨ (False ∧ True) \\\
= & False ∨ False \\\
= & False
\end{align}
$$
yet the right hand side would be
$$
\begin{align}
& ((1 = 1) ∨ (1 = 2)) ∧ ((2 = 1) ∨ (2 = 2)) \\\
= & (True ∨ False) ∧ (False ∨ True) \\\
= & True ∧ True \\\
= & True
\end{align}
$$
So the two are *not* equal.
For 7.13, the left side would expand to
$$
\begin{align}
& ((1 = 1) ∧ (1 = 2)) ∨ ((2 = 1) ∧ (2 = 1)) \\\
= & (True ∧ False) ∨ (False ∧ True) \\\
= & False ∨ False \\\
= & False
\end{align}
$$
while the right side would be
$$
\begin{align}
& ((1 = 1) ∨ (2 = 1)) ∧ ((1 = 2) ∨ (2 = 2)) \\\
= & (True ∨ False) ∧ (False ∨ True) \\\
= & True ∧ True \\\
= & True
\end{align}
$$
So the two are *not* equal.
Exercise 18
-----------
Prove the following implication:
$$
(∀x. f(x) → h(x) ∧ ∀x. g(x) → h(x)) \\\
→ ∀x. (f(x) ∨ g(x) → h(x))
$$
$$
\begin{align}
& (∀x. f(x) → h(x) ∧ ∀x. g(x) → h(x)) & \\\
& = ∀x. (f(x) → h(x) ∧ g(x) → h(x)) & \\{7.11\\} \\\
& = ∀x. (¬f(x) ∨ h(x)) ∧ (¬g(x) ∨ h(x)) & \\{\text{implication twice} \\} \\\
& = ∀x. (h(x) ∨ ¬f(x)) ∧ (h(x) ∨ ¬g(x)) & \\{ ∧ \text{ commutes} \\} \\\
& = ∀x. (h(x) ∨ (¬f(x) ∧ ¬g(x))) & \\{ ∨ \text{ over } ∧ \\} \\\
& = ∀x. (h(x) ∨ ¬(f(x) ∨ g(x))) & \\{ \text{DeMorgans 2.} \\} \\\
& = ∀x. (¬(f(x) ∨ g(x)) ∨ h(x)) & \\{ ∨ \text{ commutes} \\} \\\
& = ∀x. (f(x) ∨ g(x) → h(x)) & \\{ \text{implication} \\}
\end{align}
$$
Exercise 19
-----------
Define a predicate (with the natural numbers $0,1,2,...$ as its universe)
that expresses the notion that all of the elements that occur in either
of the sequences supplied as operands to the append operator `++` also
occur as elements of the sequence it delivers. That is, the predicate states
that under certain constraints on the number of elements in the sequence
`xs`, any element that occurs in either the sequence `xs` or the sequence
`ys` also occurs in the sequence `xs ++ ys`. Hint: Take
"$x$ *occurs in* $xs$" to mean
`∃y. ∃ys. (xs = (y : ys) ∧ (x = y) ∨ (x occurs in ys))`.
That is, the proposition "$x$ occurs in $xs$" always has the same value as the
proposition `∃y. ∃ys. (xs = (y : ys) ∧ (x = y) ∨ (x occurs in ys))`.
Denote the predicate "$x$ occurs in $xs$" by the formula "$x ∈ xs$" (overloading
the ∈ symbol used to denote set membership)
If $xs$ and $ys$ are finite lists.
$$
F(n) ≡ (length xs = n) → ∀z. (((z ∈ xs) ∨ (z ∈ ys)) → (z ∈ (xs ⧺ ys))
$$