Skip to content

Commit

Permalink
Removed uml diagrams. Added README file.
Browse files Browse the repository at this point in the history
  • Loading branch information
diantoniu committed Dec 9, 2018
1 parent 9304804 commit 9a0966b
Show file tree
Hide file tree
Showing 6 changed files with 377 additions and 410 deletions.
449 changes: 258 additions & 191 deletions .idea/workspace.xml

Large diffs are not rendered by default.

104 changes: 0 additions & 104 deletions 0200f27e-4536-4395-9e2d-f49927bd983f.uml

This file was deleted.

119 changes: 119 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@

The project contains two algorithms:
* ___Turing machine algorithm___;
* ___Markov algorithm___.

#Turing machine (TM)

A Turing machine is a mathematical model of computation that
defines an abstract machine, _**which manipulates symbols on
a strip of tape according to a table of rules**_. Despite the
model's simplicity, given any computer algorithm, a
Turing machine capable of simulating that algorithm's
logic can be constructed.

##Example 1

Write a Turing machine that calculates the sum of two
numbers written in the unary number system.
The type of source data for any algorithm must be strictly
defined.

Therefore, it is impossible to write a
TM that calculates the sum of two numbers until the
number system is specified. The unary number system is
the so-called unitary (or bar) system: what is the
number - so many ones.

The initial configuration of the Turing machine will be
_q1_(111... 1 + 1...1)‚ where the number of ones in the
first addend is ___x___, and the number of ones in the
second addend is ___y___. The final configuration is required
to be _q0_ (1...1), where the number of ones equals ___x___ + ___y___.
To do this, let's develop a plan for the operation of
the TM:

1. Erase the first unit;

2. Move the head to the right until the ___+___ sign, which should be replaced by 1;

3. Move the head to the left until the ___λ___ (empty character) sign;

4. Shift the head one character to the right and stop.

The implementation of each item of this plan requires
its own state, so after writing down commands that implement the item of the plan,
the state of the Turing machine should be changed.

```
1.1) q1 1 → q2 λ
2.1) q2 1 → q2 R 1
2.2) q2 + → q3 1
3.1) q3 1 → q3 L 1
4.1) q3 λ → q0 R λ
```

Let's write the protocol of work of this TM‚ calculating 2 + 3.

```
q1 11+111 (by 1.1) ⇒
q2 1+111 (by 2.1) ⇒
1 q2 +111 (by 2.2 ) ⇒
1 q3 1111 (by 3.1 ) ⇒
q3 11111 (by 3.1 ) ⇒
q3 λ11111 (by 4.1 ) ⇒
q0 11111
```

##Markov algorithm

In theoretical computer science, a Markov algorithm is a
string rewriting system that uses grammar-like rules to
operate on strings of symbols. Markov algorithms have been
shown to be Turing-complete, which means that they are
suitable as a general model of computation and can r
epresent any mathematical expression from its simple notation.

A Markov Algorithm over an alphabet ___A___ is a finite
ordered sequence of productions ___x→y___, where ___x___,
___y ∈ A*___. Some productions may be “Halt” productions. e.g.

```
abc → b
ba → x (halt)
```
Execution proceeds as follows:

1. Let the input string be w

2. The productions are scanned in sequence, looking for
a production x → y where x is a substring of w;

3. The left-most x in w is replaced by y;

4. If the production is a halt production, we halt;

5. If no matching production is found, the process halts;

6. If a replacement was made, we repeat from step 2.

##Example 2

The algoritm:
````
aba → b
ba → b
b → a
````

Execution:
```
aabaaa
abaa
ba
b
a
```



Binary file removed diagram.png
Binary file not shown.
11 changes: 0 additions & 11 deletions docker-compose.yml

This file was deleted.

104 changes: 0 additions & 104 deletions turing.uml

This file was deleted.

0 comments on commit 9a0966b

Please sign in to comment.