Informatique Fondamentale IMA S8



Similar documents
Automata and Formal Languages

Introduction to Automata Theory. Reading: Chapter 1

Reading 13 : Finite State Automata and Regular Expressions

Honors Class (Foundations of) Informatics. Tom Verhoeff. Department of Mathematics & Computer Science Software Engineering & Technology

Philadelphia University Faculty of Information Technology Department of Computer Science First Semester, 2007/2008.

Pushdown Automata. place the input head on the leftmost input symbol. while symbol read = b and pile contains discs advance head remove disc from pile

6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, Class 4 Nancy Lynch

The Halting Problem is Undecidable

(IALC, Chapters 8 and 9) Introduction to Turing s life, Turing machines, universal machines, unsolvable problems.

Formal Languages and Automata Theory - Regular Expressions and Finite Automata -

Regular Languages and Finite Automata

Automata Theory. Şubat 2006 Tuğrul Yılmaz Ankara Üniversitesi

Deterministic Finite Automata

Notes on Complexity Theory Last updated: August, Lecture 1

Turing Machines: An Introduction

Automata and Computability. Solutions to Exercises

3515ICT Theory of Computation Turing Machines

Finite Automata. Reading: Chapter 2

Theory of Computation Chapter 2: Turing Machines

Finite Automata and Regular Languages

T Reactive Systems: Introduction and Finite State Automata

Computability Theory

6.080 / Great Ideas in Theoretical Computer Science Spring 2008

Automata on Infinite Words and Trees

Overview of E0222: Automata and Computability

CS5236 Advanced Automata Theory

Omega Automata: Minimization and Learning 1

Regular Languages and Finite State Machines

Finite Automata. Reading: Chapter 2

C H A P T E R Regular Expressions regular expression

A first step towards modeling semistructured data in hybrid multimodal logic

CSE 135: Introduction to Theory of Computation Decidability and Recognizability

Regular Expressions and Automata using Haskell

Computational Models Lecture 8, Spring 2009

6.080/6.089 GITCS Feb 12, Lecture 3

CMPSCI 250: Introduction to Computation. Lecture #19: Regular Expressions and Their Languages David Mix Barrington 11 April 2013

Compiler Construction

Techniques algébriques en calcul quantique

Regular Languages and Finite Automata

Algorithmic Software Verification

Computer Architecture Syllabus of Qualifying Examination

CAs and Turing Machines. The Basis for Universal Computation

Reliability Guarantees in Automata Based Scheduling for Embedded Control Software

On Winning Conditions of High Borel Complexity in Pushdown Games

Complexity Classes P and NP

24 Uses of Turing Machines

CS103B Handout 17 Winter 2007 February 26, 2007 Languages and Regular Expressions

How To Compare A Markov Algorithm To A Turing Machine

CSC4510 AUTOMATA 2.1 Finite Automata: Examples and D efinitions Definitions

Pushdown Automata. International PhD School in Formal Languages and Applications Rovira i Virgili University Tarragona, Spain

logic language, static/dynamic models SAT solvers Verified Software Systems 1 How can we model check of a program or system?

CS 3719 (Theory of Computation and Algorithms) Lecture 4

1 Definition of a Turing machine

Formal Verification of Software

Non-deterministic Semantics and the Undecidability of Boolean BI

Finite Automata and Formal Languages

THEORY of COMPUTATION

MACM 101 Discrete Mathematics I

Testing LTL Formula Translation into Büchi Automata

CS 341: Foundations of Computer Science II elearning Section Syllabus, Spring 2015

Pushdown automata. Informatics 2A: Lecture 9. Alex Simpson. 3 October, School of Informatics University of Edinburgh als@inf.ed.ac.

Universality in the theory of algorithms and computer science

Enforcing Security Policies. Rahul Gera

FINITE STATE AND TURING MACHINES

COMPUTER SCIENCE TRIPOS

ω-automata Automata that accept (or reject) words of infinite length. Languages of infinite words appear:

SRM UNIVERSITY FACULTY OF ENGINEERING & TECHNOLOGY SCHOOL OF COMPUTING DEPARTMENT OF SOFTWARE ENGINEERING COURSE PLAN

Division of Mathematical Sciences

Representing Reversible Cellular Automata with Reversible Block Cellular Automata

Finite State Machine. RTL Hardware Design by P. Chu. Chapter 10 1

Turing Machines, Part I

Eastern Washington University Department of Computer Science. Questionnaire for Prospective Masters in Computer Science Students

An algorithmic classification of open surfaces

Complexity of Algorithms

StateFlow Hands On Tutorial

Introduction to Theory of Computation

Scanner. tokens scanner parser IR. source code. errors

How To Understand The Theory Of Computer Science

4.6 The Primitive Recursive Functions

Semantics and Verification of Software

Programming A PLC. Standard Instructions

Regular Expressions with Nested Levels of Back Referencing Form a Hierarchy

Computing exponents modulo a number: Repeated squaring

CHAPTER 7 GENERAL PROOF SYSTEMS

MEng, BSc Applied Computer Science

Today s Agenda. Automata and Logic. Quiz 4 Temporal Logic. Introduction Buchi Automata Linear Time Logic Summary

WRITING PROOFS. Christopher Heil Georgia Institute of Technology

Theory of Computation Class Notes 1

Increasing Interaction and Support in the Formal Languages and Automata Theory Course

The Model Checker SPIN

Course Manual Automata & Complexity 2015

Chapter 7 Uncomputability

Transcription:

Informatique Fondamentale IMA S8 Cours 1 - Intro + schedule + finite state machines Laure Gonnord http://laure.gonnord.org/pro/teaching/ Laure.Gonnord@polytech-lille.fr Université Lille 1 - Polytech Lille 2012

Course introduction and schedule Until now During S5,S6,S7, IMA students have learnt : (programming stuff) C programing and compiling, (conception stuff) algorithm design and encoding, (microelec) circuits and embedded systems hardware, (auto) design flows of industrial processes Solved (computation) problems by ad-hoc solutions. Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 2012 S8-SC 2 / 38

Course introduction and schedule Until now 2/2 But : No general scheme to design algorithms. (manual) evaluation of the cost of our programs. worse no assurance of correctness. even worse it there always a solution? All these problems will be addressed in this course Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 2012 S8-SC 3 / 38

Course introduction and schedule Schedule Finite state machines (regular automata), regular languages. Notion of non determinism. Link with circuits. I/O automata, stack automata and grammars. Link to simple languages. Counter automata, Turing machines and undecidable problems. Link to classical programs. Graphs and classical problems/algorithms on graphs. Compiler Construction. (+ lab) Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 2012 S8-SC 4 / 38

Course introduction and schedule I - Regular languages and automata Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 2012 S8-SC 5 / 38

Finite state machines 1 Finite state machines 2 Regular Languages 3 The notion of non determinism 4 Classical Algorithms 5 Expressivity of regular languages 6 Link to other models Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 2012 S8-SC 6 / 38

Finite state machines What for? We want to model : the behaviour of systems with behavioural modes. the behaviour of (Boolean) circuits. sets of words. A finite representation. Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 2012 S8-SC 7 / 38

Finite state machines Example Opening/Closing door - Source Wikipedia. state 1 Opened E: open door transition close_door open_door transition condition 2 Closed entry action E: close door Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 2012 S8-SC 8 / 38

Finite state machines General definition Finite state machine (FSM) or regular automata States are labeled, and there are finitely many (s Q) Initial state(s) (i I) and accepting (terminating/finishing) states (t F ) Transitions are finitely many. Transitions are labeled with letters (a A). The transition function is δ : Q A Q. b s a 0 s a 1 s 2 Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 2012 S8-SC 9 / 38

Finite state machines Accepted language 1/2 Accepted word A word w on the alphabet A is accepted by the automaton iff there exists a finite path from an initial state to an accepting state which is labeled by w. b s a 0 s a 1 s 2 w = aa is accepted/recognised. Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 2012 S8-SC 10 / 38

Finite state machines Accepted language 2/2 Accepted language The accepted language of a given automaton A is the set of all accepted words and is denoted by L(A). Remark : it can be infinite. b s a 0 s a 1 s 2 L(A) = {ab k a, k N}. Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 2012 S8-SC 11 / 38

Finite state machines Data Structure for implementation Problem : how to encode an automata? b s a 0 s a 1 s 2 The transition function can be (for instance) encoded as a transition table : s 0 s 1 s 2 s 0 a s 1 b a s 2 Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 2012 S8-SC 12 / 38

Regular Languages 1 Finite state machines 2 Regular Languages 3 The notion of non determinism 4 Classical Algorithms 5 Expressivity of regular languages 6 Link to other models Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 2012 S8-SC 13 / 38

Regular Languages Goal Problem : how to describe languages easily in a textual linear way? use regular expressions. Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 2012 S8-SC 14 / 38

Regular Languages Regular expressions Regular expression (recursive def) A regular expression e on the alphabet A is defined by induction. It can be of any of the following kinds : the empty word ε a letter a A a choice between an expression e 1 and another expression e 2 : e 1 + e 2 two successive expressions : e 1 e 2 0,1 or more successive occurrences of e 1 : e 1. Example with A = {a, b, c, d} : e = a (b + c d) Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 2012 S8-SC 15 / 38

Regular Languages Regular expression vs word A regular expression encodes the form of a word. For instance : i m a (3 + 4 + 5) (on the alphabet {i, m, a, 3, 4, 5}) describes all words beginning by the prefix ima and finishing by one of the numbers 3, 4 or 5. A regular expression describes a language Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 2012 S8-SC 16 / 38

Regular Languages Regular language Regular language Given a regular expression e, L(e) denotes the set of words (the language) that are described by the regular expression e. Example with A = {0,..., 9} : e = (1 + 2 +... + 9) (0 + 1 + 2 +... + 9). What is L(e)? Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 2012 S8-SC 17 / 38

Regular Languages Linux world Some commands use (extended) regular expressions (regexp) : ls *.pdf lists all pdfs of the current directory grep ta*.* *.c find all lines in.c files that contains words that begin with t + some a s. sed ''s ta*.*/toto/g'' file replace all occurrences... Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 2012 S8-SC 18 / 38

Regular Languages Relationship between automata and languages - 1/3 First, some experiments. Given the following automata A, are you able to give a regular expression e such that L(e) = L(A)? b s a 0 s a 1 s 2 e =? Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 2012 S8-SC 19 / 38

Regular Languages Relationship between automata and languages - 2/3 And the converse : Given the following regular expression e = b (c + a), are you able to give an automaton A such that L(A) = L(e)? Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 2012 S8-SC 20 / 38

Regular Languages Relationship between automata and languages - 3/3 General result - Kleene Theorem The regular languages are exactly the languages that are described by finite automata. What we ve done before is always possible. Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 2012 S8-SC 21 / 38

The notion of non determinism 1 Finite state machines 2 Regular Languages 3 The notion of non determinism 4 Classical Algorithms 5 Expressivity of regular languages 6 Link to other models Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 2012 S8-SC 22 / 38

The notion of non determinism Goal Sometimes some info lacks to make a choice between two transitions : c q a 0 q c 1 q 2 From state q 1, there is a non deterministic choice while reading c : either go to state q 2 or stay in q 1. Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 2012 S8-SC 23 / 38

The notion of non determinism Definition Non deterministic FSM A deterministic automaton is A =< A, Q, I, F, δ > with δ : A Q Q A non deterministic automata is the same with : δ : A Q P (Q) A non deterministic automata with ε-transitions is the same with δ : (A {ε}) A P (Q) Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 2012 S8-SC 24 / 38

The notion of non determinism Example A non deterministic automata with ε-transitions : c p a q d r ε Then L(A) = a (c d ). Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 2012 S8-SC 25 / 38

Classical Algorithms 1 Finite state machines 2 Regular Languages 3 The notion of non determinism 4 Classical Algorithms 5 Expressivity of regular languages 6 Link to other models Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 2012 S8-SC 26 / 38

Classical Algorithms Find the associated language Goal : Given A an automaton, find the associated language. Exercises! Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 2012 S8-SC 27 / 38

Classical Algorithms Construction of automaton from a regular expression Goal : Given a regular expression, construct a regular automaton that recognises it. Exercises! Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 2012 S8-SC 28 / 38

Classical Algorithms Determinisation Goal : transform a non deterministic automaton into a deterministic one. Exercises! Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 2012 S8-SC 29 / 38

Classical Algorithms Other Algorithms In the literature you will easily find : algorithms to eliminate ε transitions without determinising (ε closure) ; algorithms to minimise automata (the number of states) ; algorithms to use automata to find words in a text ; algorithms to test language inclusion (if they are regular)... Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 2012 S8-SC 30 / 38

Expressivity of regular languages 1 Finite state machines 2 Regular Languages 3 The notion of non determinism 4 Classical Algorithms 5 Expressivity of regular languages 6 Link to other models Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 2012 S8-SC 31 / 38

Expressivity of regular languages Non regular languages Important result There exists some non-regular languages. Examples of non-regular languages : {a n b n, n N}. palindromes on a non-singleton alphabet. {a p, p prime} There exists a quite systematic way to prove that a given language is not regular (Pumping Lemma). Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 2012 S8-SC 32 / 38

Link to other models 1 Finite state machines 2 Regular Languages 3 The notion of non determinism 4 Classical Algorithms 5 Expressivity of regular languages 6 Link to other models Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 2012 S8-SC 33 / 38

Link to other models Moore and Mealy Machines - 1 Moore : I/O machine whose output values are determined solely by the current state : source Wikipedia Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 2012 S8-SC 34 / 38

Link to other models Moore and Mealy Machines - 2 Mealy : output values are determined both by the current state and the value of the input. source Wikipedia Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 2012 S8-SC 35 / 38

Link to other models UML Implementation of FSMs UML variants of FSMs are hierarchical, react to messages and call functions. source Wikipedia Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 2012 S8-SC 36 / 38

Link to other models Hardware Implementation of FSMs It requires : a register to store state variables a block of combinational logic for the state transition (optional) a block of combinatorial logic for the output Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 2012 S8-SC 37 / 38

Conclusion Summary Regular Automata or Finite State Machines are : Acceptors for regular languages. But some languages are not regular. Algorithmically efficient. Useful to describe (simple) behaviours of systems. Closely linked to circuits. Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 2012 S8-SC 38 / 38