M269 Lec11
M269 Lec11
M269
Algorithms, Data Structures
and Computability
BY:
DR. AHMED GAWISH
[email protected]
Agenda
1] Prepositional Logic and Predicate Logic.
2] Turing Machine
3] Computability and Limits of Computation
Logic in Computer Science
• Logic has a profound impact on computer-science. Some
examples:
• Propositional logic – the foundation of computers and circuitry
• Databases – query languages
• Programming languages (e.g. prolog) • Propositional Logic
• Design Validation and verification • First Order Logic
• AI (e.g. inference systems) • Higher Order Logic
• ... • Temporal Logic
3
Propositional logic: Syntax
A proposition – a sentence that can be either true or false.
• Connectives
In propositional logic generally we use five connectives which are −
o OR (∨)
o AND (∧)
o Negation/ NOT (¬)
o Implication / if-then (→)
o If and only if (⇔).
4
OR (∨) − The OR operation of two AND (∧) − The AND operation of two
propositions A and B (written as A∨B) is propositions A and B (written as A∧B) is
true if at least any of the propositional true if both the propositional variable A
variable A or B is true. and B is true.
0 0
1 1 1
0 1 1 1 1 1 1 0 1 1 0 1 1 0 0 0
The Turing Machine
0 0
1 1 1 1
0 1 1 1 1 1 1 0 1 1 0 1 1 0 0 0
A TM is defined as:
TM = <S, T, s0, d, H> where,
S is a set of TM states
T is a set of tape symbols
s0 is the start state
HS is a set of halting states
d : S x T S x T x {L,R}
is the transition function
Simple TM Examples
Turing Machine U+1:
#111100000000…….
#1111100000000……….
Simple TM Examples
TM: U+1
d(s0, 1) |-- (s0, 1, R)
d(s0, 0) |-- (h, 1, STOP)
#s0111100000…..
#1s011100000…..
#11s01100000…..
#111s0100000…..
#1111s000000…..
#11111h0000….. STOP
Exercice
state symbol Δ(state, Solution
symbol)
S0 b (halt, a, stop) • s0 “ aaaabb”
S0 a (S1 , a, right ) • s1 “ aaaabb ”
S1 b (halt, b, stop) • s0 “ aaaabb ”
S1 a (S0 , a, right ) • s1 “ aaaabb ”
Input = “aaaabb” • s1 “ aaaabb ”
What is the output for this input? • halt “ aaaaab ”
22
Turing’s Thesis
• Limits on Arithmetic
• Limits on Components
• Limits on Communications
25
Limits on Arithmetic
There are limitations imposed by the hardware on the representations
of both integer numbers and real numbers. The maximum number of
significant digits that can be represented is limited to a certain value.
Significant digits
Those digits that begin with the first nonzero digit on the left and end
with the last nonzero digit on the right
Limits on Components
Although most errors are caused by software, hardware
components do fail
Limits on Communications
Error-detecting codes
Techniques to determine if an error has occurred during the
transmission of data and then alert the system
Error-correcting codes
Error-detecting codes that detect an error has occurred and try to 27
28
Thank You