TODO watch https://www.youtube.com/watch?v=26zcLaUreok https://www.youtube.com/watch?v=ASgv7SmUCzo https://www.youtube.com/watch?v=iN0auyB0Hv0&list=PLylTVsqZiRXOFmaByWXrpSWQIWLE4X_4g&index=3 https://www.youtube.com/playlist?list=PLylTVsqZiRXOFmaByWXrpSWQIWLE4X_4g

Undecidable Problems

Proof: Halting Problem is Undecidable

Write an algorithm such that given:

  • the description of an algorithm (which requires one input)
  • an input

Then will return if stops with input and if it does not.

Assume exists, we can then write an algorithm such that takes an input an algorithm and computes . If the result is then answers and stops, otherwise it loops forever.

Since is arbitrary, it could be itself. We obtain a contradiction stops if and only if does not stop. So cannot exist.

Visual example of Halting Problem undecidability

Let’s assume is a program that takes a Go state and outputs the optimal move: The program sometimes gets stuck and will never return an output.

Let’s say is a program that takes and a Go state as inputs and outputs true iff will halt on that Go state (false otherwise).

procedure H(P, I):
	if P(I) halts:
		return True
	else:
		return False
end procedure

Let’s make some modifications to to produce :

procedure H'(P):
	if P(P) halts:
		loop forever
	else:
		halt
end procedure

will take a program as input:

  • if halts then will run forever
  • if runs forever then will halt

Now we try to feed into itself:

We reach a contradiction:

  • If halts then it runs forever
  • If runs forever then it halts

By assuming that a program that solves the halting problem exists we have found a contradiction. Therefore, it’s not possible for such a program to exist.

Decidable Problem

A problem is said to be decidable if it is possible to design a program to answer the problem within a finite time.

Link to original

We say the halting problem is undecidable. It demonstrates a theoretical limit to computability.

Partial Functions and Computability

Algorithm (Computability)

An algorithm has three characteristics:

  • Has a finite description of a computation in terms of elementary instructions
  • Is a deterministic procedure: next step is uniquely defined
  • Always produces a result no matter the input (i.e. halts)
Link to original

To allow us to represent unending computations (that do not always return a result), and to ignore certain unnecessary details, we consider programs to be partial functions.

Examples of these sorts of expressions include:

  • true + 3: not well defined (type error) addition is a total function on natural numbers
  • 10/0: not defined division is a partial function on natural numbers
  • expression fact(-1) does not have a value for: fact(x) = if x = 0 then 1 else x * fact(x - 1) fact defines a partial function on integers

Cartesian product of sets

The Cartesian product of sets and is the set $$ A \times B = \{ (x, y) | x \in A \text{ and } y \in B \} $$

consists of ordered pairs where and .

For example, let and . Hence, .

Generic Format

The Cartesian product of sets is the set $$ A_1 \times A_2 \times ... \times A_k = \{ (x_1, x_2, ..., x_k) | x_i \in A \text{ for } i = 1, 2, ..., k \} $$

consists of those where

Link to original

Set member

Membership of a set is denoted with , e.g. .

Link to original

Function notation

indicates that the function takes an input from the set (domain) and produces an output in the set (image / codomain).

Link to original

Partial function

A partial function is a subset of such that if and then . i.e. for each element of , there is at most one result in .

Link to original

Total function

A total function is a function where for every element , there exists an output

Link to original

Computer programs define partial functions.

The class of functions on the natural numbers that can (in an ideal world where time and space are unlimited) be computed by a program is called partial recursive functions or computable functions.

Computable function

A function on words from is computable if there is a deterministic Turing Machine s.t.: (or there is a lambda-term)

  • accepts all input words
  • when started in configuration , the machine eventually terminates in configuration .

The machine transforms the contents of the tape from to and returns the tape head to the start of the word.

Link to original

Turing-complete

A programming language is Turing-complete if any computable function can be written in this language.

Link to original

Abstract Models of Computation

We need a computational model to abstract away from material details of a programming language and processor we may be using.

Most well known are:

  • Turing Machines
  • The Lambda-Calculus

Church’s Thesis says that the same class of functions on the integers can be computed in any sequential model of computation. This proves that the Lambda-calculus and Turing machines compute exactly the same class of functions.

0 items under this folder.