Coder Social home page Coder Social logo

17th-automaton's Introduction

17th-automaton

A Python made program for solving the statement of Topic 17.

Requisites

Python 3.4 and above (tested on Python 3.6.8). It can be downloaded here.

Where to download

It can be downloaded right here (choose between ZIP or TAR.GZ as you prefer).

Initial setup

Extract it and open a terminal window on the directory where it was extracted.

How to use

Execute main.py in terminal and follow the instructions to add and convert automata.

python main.py

Demostration

Execute demo.py in terminal to convert the automata example.

python demo.py

How it works

Statement

Given a finite automaton (A), it is asked to write a finite automaton (A’) that fulfills the following condition:

  • L(A’)={xy, x ∈ L(A), y ∉ L(A)}

Steps for solving the problem

  1. Convert the finite automaton to a complete deterministic one.
    • Algorithm to eliminate empty transitions (lambda).
    • Algorithm for converting a NFA to a DFA.
    • Reduce DFA: no useless states (not accessible and not co-accessible).
    • Complete DFA: for each pair (state, letter) there is transition -> "dead state".
  2. Calculate complement of the complete DFA from the previous step.
    • As the DFA is complete, it will be enough to indicate that the final states are not and vice versa.
  3. Concatenate the DFA calculated in the first step with its complement calculated in the second step.
    • It will be enough to create empty transitions (lambda) between the set of final states of the first automaton and the initial state of the second automaton, being the new set of final states those of the second automaton.
  4. OPTIONAL: eliminate the empty transitions (lambda) of the previous step.
    • This step is performed by the program; however, in the example below it has not been performed to facilitate the understanding of the algorithm.

Example

Input data

  • First automaton First automaton

ER1: a(a(b+ac))(aa+bb(a((c+b+ac)(a(b+ac))bba)(a+(c+b+ac)(a(b+ac))(a+bb)a+$)+a))+bc((a+(b+a((c+b)ca)((c+b)cb+a((c+(b+a)(a+b)c)ca((c+b)ca)a)(c+(b+a)(a+b)c)c(b+a((c+b)ca)(c+b)cb)))(b+cc(b+a((c+b)ca)((c+b)cb+a((c+(b+a)(a+b)c)ca((c+b)ca)a)(c+(b+a)(a+b)c)c(b+a((c+b)ca)(c+b)cb))))cca)((c+b)ca)(a+a((c+(b+a)(a+b)c)ca((c+b)ca)a)($+(c+(b+a)(a+b)c)ca((c+b)ca)a))+(b+a((c+b)ca)((c+b)cb+a((c+(b+a)(a+b)c)ca((c+b)ca)a)(c+(b+a)(a+b)c)c(b+a((c+b)ca)(c+b)cb)))(b+cc(b+a((c+b)ca)((c+b)cb+a((c+(b+a)(a+b)c)ca((c+b)ca)a)(c+(b+a)(a+b)c)c(b+a((c+b)ca)(c+b)cb))))(a((c+b+(a+(c+b)ca((c+b)ca)a)((c+(b+a)(a+b)c)ca((c+b)ca)a)(c+(b+a)(a+b)c))c(b+a((c+b)ca)(c+b)cb)(b+cc(b+a((c+b)ca)((c+b)cb+a((c+(b+a)(a+b)c)ca((c+b)ca)a)(c+(b+a)(a+b)c)c(b+a((c+b)ca)(c+b)cb))))a)(a+(c+b)ca((c+b)ca)a+(a+(c+b)ca((c+b)ca)a)((c+(b+a)(a+b)c)ca((c+b)ca)a)($+(c+(b+a)(a+b)c)ca((c+b)ca)a)+(c+b+(a+(c+b)ca((c+b)ca)a)((c+(b+a)(a+b)c)ca((c+b)ca)a)(c+(b+a)(a+b)c))c(b+a((c+b)ca)(c+b)cb)(b+cc(b+a((c+b)ca)((c+b)cb+a((c+(b+a)(a+b)c)ca((c+b)ca)a)(c+(b+a)(a+b)c)c(b+a((c+b)ca)(c+b)cb))))(cca((c+b)ca)(a+a((c+(b+a)(a+b)c)ca((c+b)ca)a)($+(c+(b+a)(a+b)c)ca((c+b)ca)a))+a)+$)+a))

  • Second automaton Second automaton

Output data

NOTE: the automata presented in this README have lambda transitions to make them easier to understand. This program returns automata without lambda transitions.

  • First automaton First automaton converted

  • Second automaton Second automaton converted

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.