commit allerede lavet opgaver
BIN
Diskret Mat/Propositional and predicate logic/Opgave 1.1-3.png
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
Diskret Mat/Propositional and predicate logic/Opgave 1.1-37.png
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
Diskret Mat/Propositional and predicate logic/Opgave 1.1-53.png
Normal file
|
After Width: | Height: | Size: 55 KiB |
BIN
Diskret Mat/Propositional and predicate logic/Opgave 1.4-1.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
Diskret Mat/Propositional and predicate logic/Opgave 1.4-31.png
Normal file
|
After Width: | Height: | Size: 45 KiB |
BIN
Diskret Mat/Propositional and predicate logic/Opgave 1.4-35.png
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
Diskret Mat/Propositional and predicate logic/Opgave 1.4-37.png
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
Diskret Mat/Propositional and predicate logic/Opgave 1.4-41.png
Normal file
|
After Width: | Height: | Size: 58 KiB |
BIN
Diskret Mat/Propositional and predicate logic/Opgave 1.4-55.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
Diskret Mat/Propositional and predicate logic/Opgave-1.1-1.png
Normal file
|
After Width: | Height: | Size: 43 KiB |
BIN
Diskret Mat/Propositional and predicate logic/Opgave-1.1-11.png
Normal file
|
After Width: | Height: | Size: 53 KiB |
BIN
Diskret Mat/Propositional and predicate logic/Opgaverne.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
@@ -0,0 +1,195 @@
|
||||
= Propositional and predictive logic
|
||||
|
||||
= Proofs
|
||||
Argument that something is true, foolproof, objective, argument.
|
||||
== Direct proof
|
||||
Want to prove $p->q$
|
||||
Assume p, then through several steps of reasoning, conclude q.
|
||||
|
||||
*Eks:*
|
||||
|
||||
If $n$ is odd, then $n²$ is odd
|
||||
|
||||
Def: An integer n is #underline[even] if $exists k in ZZ, s.t., n=2k$
|
||||
|
||||
n is odd if $exists in ZZ #text("such that") n=2k+1$
|
||||
|
||||
Assume n is odd. then $exists k in ZZ #text("such that") n=2k+1$
|
||||
|
||||
So
|
||||
|
||||
$
|
||||
n²=(2k+1)²=4k²+4k+1\ \
|
||||
=2(2k²+2k)+1
|
||||
$
|
||||
Since $k in ZZ$, then $2k²+2k in ZZ$, so $n²$ is odd.
|
||||
|
||||
|
||||
== Proof by contraposition
|
||||
Prove $p->q$ by proving $not p-> not q$
|
||||
|
||||
For an integer n, if n² is odd, then n is odd.
|
||||
|
||||
Suppose n² is odd, then $exists k in ZZ #text("such that") n²=2k+1$
|
||||
|
||||
So $n=plus.minus sqrt(2k+1)$
|
||||
|
||||
We prove that if n is even, then n² is even.
|
||||
|
||||
Suppose n is even, then $exists in ZZ #text("such that") n=2k$
|
||||
|
||||
So $n²=(2k²)=4k²=2(2k²)$
|
||||
|
||||
Since $2k²$ is an integer, n² is even.
|
||||
|
||||
== Proof by contradiction
|
||||
Want to prove _p_ by assuming it's not true (assume $not p$) and then reach a contradiction.
|
||||
|
||||
By contradiction we are going to conclude something we know is false.
|
||||
|
||||
Showing: $not p->p$
|
||||
|
||||
*Eks:*
|
||||
$sqrt(2)$ is irrational
|
||||
|
||||
A real number r is #underline[rational] if $exists a,b in ZZ$ #underline[with] $b eq.not 0 space #text("such that") space r=a/b$
|
||||
|
||||
Assume $sqrt(2)$ is rational. Then $exists a, b in ZZ, b eq.not 0 space #text("such that") space sqrt(2)=a/b$. You can assume that a and b have no common factors.
|
||||
|
||||
Then:
|
||||
$
|
||||
2=(a²)/(b²) \
|
||||
2b²=a²
|
||||
$
|
||||
So a² is even, therefore a is even, then:
|
||||
$ exists k in ZZ, a=2k $
|
||||
$
|
||||
2b²=(2k²)=4k²=> \
|
||||
b²=2k²
|
||||
$
|
||||
So b² is even and therefore b is even.
|
||||
|
||||
Now that we've shown that a and b have a common factor (they have a common factor, 2, because both are even).
|
||||
|
||||
So now we have shown that $sqrt(2)$ can't be a rational number because there then is a contradiction.
|
||||
|
||||
= Sets
|
||||
Def: A #underline[set] is an unordered collection of objects called #underline[elements]/#underline[members] of the set. We a set contains its elements.
|
||||
|
||||
$a in A$ - a is an element of A
|
||||
|
||||
$ a in.not A$ - a is NOT an element of A
|
||||
|
||||
It's also called the naive set theory, which leads to some paradoxes (Russell's Paradox, exercise 50 in 2.1 in book).
|
||||
|
||||
A way to describe a set, is to list all its elements. Eks: $A= {1,2,3,4}, B = {a,b,c,d}, C={"Apple",7,"Mike","Tivoli"}$
|
||||
|
||||
You can also do: ${x|"x has property P"}$
|
||||
|
||||
Ex:
|
||||
$ O&={x|x" is an odd integer"} \
|
||||
&={x in ZZ|x "is odd"}
|
||||
$
|
||||
|
||||
A set can have sets as elements. A set does not contain it's subelements if it contains sets. ${NN, ZZ, QQ, RR}$ does e.q. not contain the number 2. It contains sets that contain the number 2, but it itself does not.
|
||||
|
||||
== Important sets
|
||||
$NN={0,1,2,3,4,...}$ - Set of natural numbers (some argue 0 is not in the natural numbers, some argue it is).
|
||||
|
||||
$ZZ={...,-2,-1,0,1,2,...}$ - Set of Integers. Can say $ZZ⁺$ or $ZZ_(>=0)$ for integers greater than 0.
|
||||
|
||||
$QQ = {a/b|a,b in ZZ, b eq.not 0}$ - Set of rational numbers
|
||||
|
||||
$RR$ - Real numbers (all numbers)
|
||||
|
||||
$CC$ - Complex numbers
|
||||
|
||||
== When two sets are equal
|
||||
Def: Two sets A and B are equal if and only if they contain exactly the same elements.
|
||||
|
||||
$A=B$ if and only if $forall x{x in A <-> x in B}$
|
||||
|
||||
Order and amount of appearances doesn't matter in sets, so $ {1,3,5}={5,3,1}={1,3,3,5,5,5} $
|
||||
|
||||
If you have a set of variables, and some of them are equal, their value still only appears once.
|
||||
|
||||
== Empty set
|
||||
This is the set with no elements. Notation $emptyset$
|
||||
|
||||
== Singleton set
|
||||
Set with one element
|
||||
|
||||
== Subset
|
||||
Def: A is a #underline[subset] of B, and B is a #underline[superset] of A, if and only if, every element of A is an element of B. Denoted $A subset.eq B$ or $B supset.eq A$.
|
||||
|
||||
You should say "A is a subset of B"
|
||||
|
||||
To show $A subset.eq B$: show that $"if" x in A ", then" x in B$. Show that every element in A is in B
|
||||
|
||||
To show $A subset.eq.not B$: find $"some" x in A "such that" x in B$. Find an element in A that is not in B.
|
||||
|
||||
*Theorem:* For any set S, $emptyset subset.eq S$ and $S subset.eq S$
|
||||
|
||||
$forall x(x in nothing -> x in S)$ is true ($x in nothing$ will always be false, so that means the implication is always true).
|
||||
|
||||
== Size of set (cardinality)
|
||||
Def: Let S be the set. If there are exactly n distinct elements in S where $n in NN$, then we say that S is a finite set, with cardinality (size) n. $|S|=n$.
|
||||
|
||||
$
|
||||
A&={x in ZZ⁺|"x is odd and" x <=10} \
|
||||
|A|&=5\
|
||||
|nothing|&=0
|
||||
$
|
||||
A set is infinite if it's not finite ($NN, RR, ZZ, QQ$ are for example all infinite).
|
||||
|
||||
== Powerset
|
||||
Def: Let S be a set, the #underline[powerset] of S, denoted $cal(P)(S)$, is the set of all subsets of S
|
||||
|
||||
$cal(P)({0,1,2,3})={nothing,{0},{1},{2},{3},{0,1},{0,2}{1,2},{0,1,2,3}}$
|
||||
|
||||
$|S|=n , |cal(P)(S)|=2^n$
|
||||
$cal(P)(nothing)={nothing}$
|
||||
|
||||
== Cartesian products
|
||||
|
||||
Def: The (ordered) n-tuple $(a_1,a_2,...,a_n)$ is the ordered collection that has $a_i$ as its i'th element.
|
||||
|
||||
$(a_1,a_2,...,a_n)=(b_1,b_2,...,b_n) "if and only if" a_i=b_i forall i=1,2,...,n$ (n-tuples are equal if and only if their elements are the same and in the same order)
|
||||
|
||||
2-tuples are called ordered pairs
|
||||
|
||||
$(a,b) != (b,a)$ (unless $a=b$)
|
||||
|
||||
*Def:* Let A and B be sets. The cartesian product of A and B, denoted $A times B$, is the set of all ordered pairs (a,b) where $a in A$ and $b in B$
|
||||
|
||||
$A times B={(a,b)|a in A and b in B}$
|
||||
|
||||
Ex: $A={1,2}, B={a,b,c}$
|
||||
|
||||
$ A times B={(1,a), (1,b), (1,c), (2,a), (2,b), (2,c)} $
|
||||
|
||||
$A times B != B times A$ (unless $A=B$ or $A=nothing or B=nothing$)
|
||||
|
||||
=== Cartesian product of many sets
|
||||
Def: The Cartesian product of $A_1,A_2,...,A_n$, denoted by $A_1 times A_2 times ... times A_n$ is the set of n-tuples ($a_i,a_2,...,a_n$) such that $a_i in A_i "for all" i=1,2,...,n$
|
||||
|
||||
|
||||
*NOTE:* $A times (B times C) !=(A times B)times C !=A times B times C$
|
||||
|
||||
First one would be $((a,b),c)$, second one would be $(a,(b,c))$, third would be $(a,b,c)$.
|
||||
|
||||
$A²=A times A,space A³=A times A times A$, etc.
|
||||
|
||||
== Relations
|
||||
A subset R of $A times B$ is called a relation from A to B.
|
||||
|
||||
A relation from A to itself is called a relation on A.
|
||||
|
||||
*Example*
|
||||
|
||||
$A={0,1,2,3}$
|
||||
|
||||
$
|
||||
R&={(a,b)|a,b in A and a <=b} \
|
||||
&={(0,0),(0,1),(0,2),(0,3),(1,1),(1,2),(1,3),(2,2),(2,3),(3,3)}
|
||||
$
|
||||
118
Diskret Mat/Propositional and predicate logic/main.typ
Normal file
@@ -0,0 +1,118 @@
|
||||
= Opgaver
|
||||
#image("Opgaverne.png")
|
||||
== Opgave 1.1-1
|
||||
#image("Opgave-1.1-1.png")
|
||||
a) Proposition. And it is true
|
||||
|
||||
b) Proposition. And it is false.
|
||||
|
||||
c) Proposition. True
|
||||
|
||||
d) Proposition. False
|
||||
|
||||
e) Not a proposition because it has a variable.
|
||||
|
||||
f) Not a proposition because it is a command.
|
||||
|
||||
== Opgave 1.1-3
|
||||
#image("Opgave 1.1-3.png")
|
||||
a) Linda is not younger (older or same age) than Sanjay
|
||||
|
||||
b) Mei does not make more money than Isabella (makes less or same)
|
||||
|
||||
c) Moshe is not taller than Monica (shorter or same age)
|
||||
|
||||
d) Abby is not richer than Ricardo
|
||||
|
||||
|
||||
== Opgave 1.1-11
|
||||
#image("Opgave-1.1-11.png")
|
||||
a) Sharks have not been spotted near the shore.
|
||||
|
||||
b) Swimming at the New Jersey shore is allowed and sharks have been spotted near the shore.
|
||||
|
||||
c) Either swimming is not allowed at the New Jersey shore or sharks have been spotted near the shore.
|
||||
|
||||
d) Swimming is allowed at the shore which implies sharks have not been spotted.
|
||||
|
||||
e) Sharks have not been spotted at the shore which implies it is allowed to swim there.
|
||||
|
||||
f) Swimming is not allowed at the shore which implies sharks have not been spotted.
|
||||
|
||||
g) Swimming is allowed at the shore if and only if sharks have not been spotted.
|
||||
|
||||
h) Swimming is allowed or sharks have not been spotted and swimming is not allowed.
|
||||
|
||||
== Opgave 1.1-37
|
||||
|
||||
#image("Opgave 1.1-37.png")
|
||||
#table(columns: 10)[p][q][$not p$][$not q$][$p->not q$][$not p <->q$][$(p->q)or(not p->q)$][$(p->q)and(not p-> q)$][$(p<->q)or(not p<->q)$][$(not p <-> not q)<->(p<->q)$][T][T][F][F][F][F][T][T][T][T][F][T][T][F][T][T][T][T][T][T][T][F][F][T][T][T][T][F][T][T][F][F][T][T][T][F][T][F][T][T]
|
||||
|
||||
|
||||
== Opgave 1.1-53
|
||||
#image("Opgave 1.1-53.png")
|
||||
a) Only the 99th statement would be true. For example the 3rd statement cant be true because if only 3 of the statements are false, that would mean the other 97 statements are true, but they cant be because they say other amounts of statements are false. But for the 99th, it would be true that all the other statements are false except for that one. The 100th statement cant be true because if all statements in the list are false, then the 100th would be true, which it cant be if all are false.
|
||||
|
||||
b) Only the statements of $n<=50$ would could be true, because for the 51th statement "At least 51 of the statements are false" it is incorrect that _at least_ 51 of the statements are false (statements 1-50 are also true, so there's only 49 remaining false statements which is contradicting the statement).
|
||||
|
||||
c) It would mean that statements 1-49 would be true as for the 49th statement, at least 49 of the statements _are true_ (real answer is 50 but 50 is at least 49).
|
||||
|
||||
== Opgave 1.4-1
|
||||
#image("Opgave 1.4-1.png")
|
||||
a) $P(0)=T$
|
||||
|
||||
b) $P(4)=T$
|
||||
|
||||
c) $P(6)=F$
|
||||
|
||||
== Opgave 1.4-31
|
||||
#image("Opgave 1.4-31.png")
|
||||
a) $forall y Q(0,0,0) and forall y Q(0,1,0)$
|
||||
|
||||
b) $exists x Q(0,1,1) or exists x Q(1,1,1) or exists x Q(2,1,1)$
|
||||
|
||||
c) $exists z not Q(0,0,0) or exists z not Q(0,0,1)$
|
||||
|
||||
d) $exists x not Q(0,0,1) or exists x not Q(1,0,1) or exists x not Q(2,0,1)$
|
||||
|
||||
== Opgave 1.4-35
|
||||
#image("Opgave 1.4-35.png")
|
||||
a) $exists x(x<=1)$
|
||||
|
||||
b) $exists x(x>2)$
|
||||
|
||||
c) $forall x(x<4)$
|
||||
|
||||
d) $forall x(x>=0)$
|
||||
|
||||
e) $exists x((x>=-1) and (x<=2))$
|
||||
|
||||
f) $forall x((x>=4) and (x<=7))$
|
||||
|
||||
== Opgave 1.4-37
|
||||
|
||||
#image("Opgave 1.4-37.png")
|
||||
a) No counterexample, it would only be happen for numbers between 0 and 1 (0.1,0.2,...0.9)
|
||||
|
||||
b) $exists x(x=0)$
|
||||
|
||||
c) $exists x(x>1or x<1)$
|
||||
|
||||
== Opgave 1.4-41
|
||||
#image("Opgave 1.4-41.png")
|
||||
a) If there exists a printer that is out of service and is also busy, that leads to some work being lost.
|
||||
|
||||
b) If all printers are busy, then a job is in the queue
|
||||
|
||||
c) If there exists a print job that gets queued but also lost, then a printer is out of service
|
||||
|
||||
d) If all printers are busy and all print jobs are queued, a print job has been lost
|
||||
|
||||
|
||||
== Opgave 1.4-55
|
||||
#image("Opgave 1.4-55.png")
|
||||
a) Truth
|
||||
|
||||
b) False
|
||||
|
||||
c) True
|
||||