Git Product home page Git Product logo

ft_turing's Introduction

FT_TURING, Jan 2016

Deterministic Turing machine in Ocaml. (group project)

Grade (125/100) (125/125)*

Team: fbuoro / ngoguey.


Goals:
  • Create a deterministic, single headed and single tape Turing machine(TM).
  • Read a TM description from a json file.
  • Code in OCaml or Haskell, any version, library or tools authorized.
  • Write 5 turing machines in json form (see below)
  • Write an universal turing machine(TM5) able to run TM1
  • Compute time complexity of a given TM
Our work:


Mandatory Turing Machines in ./machines:

  • TM0: machines/unary_sub.json given in subject.pdf as an example
  • TM1: machines/unary_add.s
  • TM2: machines/palindrome.json
  • TM3: machines/0n1n.s
  • TM4: machines/zero_power_2n.json
  • TM5: machines/utm.s universal turing machine

Turing Machines in ./machines optimized for complexity calculation:

  • machines/abs.s O(1)
  • machines/unary_add_unsec.s O(n)
  • machines/0n1n_unsec.s O(nlogn)
  • machines/unary_sub_unsec.s O(n^2)
  • machines/is_palindrome2_unsec.s O(n^2)
  • machines/split_input_unsec.s O(n^2)
  • machines/binary_increment_unsec.s O(2^n)

More Turing Machines in ./machines:

  • machines/has_0011.s
  • machines/minsky_utm.s 1967 Minsky's universal turing machine
  • machines/split_input.s separate input with blanks in O(3n^2)
  • machines/is_palindrome2.s version 2
  • machines/binary_divisable_by3.s
  • machines/zero_second_to_last.s



Use

# Install through brew: opam ocamlfind ocaml core.113.00.00 yojson gnuplot gnuplot-ocaml
make install_libs

# Project compilation
make

# Compile machines/*.s files to machines/*.json:
python compiler/main.py machines/*.s

# Run a json-turing-machine on a given input
./ft_turing machines/is_palindrome2.json "ABA"

# Translate a json-turing-machine and its input to a Universal-Turing-Machine input
./ft_turing -c machines/unary_sub.json "1111-1="

# Run the above input on the universal turing machine
 ./ft_turing machines/utm.json $(./ft_turing -c machines/unary_sub.json "1111-1=")

# Compute an html file through gnuplot reflecting the complexity of a given json-turing-machine
./ft_turing -O machines/0n1n_unsec.json



Small presentation:
18h of theory of computation (math oriented, accessible):
Linear regression:
Misc:




*
- A grade of 85 was required to validate the project.
- A maximum grade of 125 was reachable.
- Second sessions are organised for failed projects.

unary add:

example_add

is input a palindrome:

example_palindrome

is input of form 0^2n:

example_0p2n

machines/utm.s encoding (universal turing machine):

encoding

0n1n_complexity:

complexity1

unary_sub_complexity:

complexity2


ft_turing's People

Contributors

ngoguey42 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.