Type Theory. Coinduction in Type Theory. Andreas Abel. Department of Computer Science and Engineering Chalmers and Gothenburg University
|
|
- Gregory Perry
- 6 years ago
- Views:
Transcription
1 Type Theory Coinduction in Type Theory Andres Ael Deprtment of Computer Science nd Engineering Chlmers nd Gothenurg University Type Theory Course CM0859 (2017-1) Universidd EAFIT, Medellin, Colomi 6-10 Mrch 2017 Andres Ael (GU) Type Theory EAFIT / 34
2 Coinduction Coinduction is technique to, e. g.: Define infinitely running processes. Define infinitely deep derivtions. Prove properties out processes nd infinite derivtions. A coinductive definition must e productive, i. e., lwys produce new piece of the output fter finite time. Agd recently supports coinduction vi coptterns nd sized types. Agd s termintion checker lso checks productivity. This tlk: coinduction for the exmple of forml lnguges. Andres Ael (GU) Type Theory EAFIT / 34
3 Contents 1 Forml Lnguges 2 Coinductive Types nd Coptterns 3 Bisimilrity 4 Sized Coinductive Types 5 Conclusions Andres Ael (GU) Type Theory EAFIT / 34
4 Forml Lnguges Forml Lnguges A lnguge is set of strings over some lphet A. Rel life exmples: Orthogrphiclly nd grmmticlly correct English texts (infinite set). Orthogrphiclly correct English texts (even igger set). List of university employees plus their phone extension. AelAndres1731,CoqundThierry1030,DyjerPeter1035,... Progrmming lnguge exmples: The set of grmmticlly correct JAVA progrms. The set of deciml numers. The set of well-formed string literls. Lnguges cn descrie protocols, e.g. file ccess. A = {o, r, w, c} (open, red, write, close) Red-only ccess: orc, oc, orrrc, orcorrrcoc,... Illegl sequences: c, rr, orr, oco,... Andres Ael (GU) Type Theory EAFIT / 34
5 Forml Lnguges Running Exmple: Even inry numers Even inry numers: 0, 10, 100, 110, 1000, 1010,... Excluded: 00, 010 (non-cnonicl); 1, 11 (odd)... Alphet A = {, } where is zero nd is one. So E = {,,,,,,... }. Andres Ael (GU) Type Theory EAFIT / 34
6 Forml Lnguges Tries An infinite trie is node-leled A-rnching tree. I.e., ech node hs one rnch for ech letter A. A lnguge cn e represented y n infinite trie. To check whether word 1 n is in the lnguge: We strt t the root. At step i, we choose rnch i. At the finl node, the lel tells us whether the word is in the lnguge or not. Andres Ael (GU) Type Theory EAFIT / 34
7 Forml Lnguges Trie of E Andres Ael (GU) Type Theory EAFIT / 34
8 Forml Lnguges Regulr Lnguges A trie is regulr if it hs only finitely mny different sutrees. Ech node of the trie corresponds to one of these lnguges: E Z N ε even inry numers strings ending in strings not ending in the empty string nothing (empty lnguge) Andres Ael (GU) Type Theory EAFIT / 34
9 Forml Lnguges ε E N N Z Z N Z Z Andres Ael (GU) Type Theory EAFIT / 34
10 Forml Lnguges Cutting duplictions t depth 3 ε E N Z Z Andres Ael (GU) Type Theory EAFIT / 34
11 Forml Lnguges Bending rnches... ε E N Z Z Andres Ael (GU) Type Theory EAFIT / 34
12 Forml Lnguges Finite Automt We hve rrived t fmilir oject: finite utomton. Depending on wht we cut, we get different utomt for E. If we cut ll duplicte sutrees, we get the miniml utomton. Andres Ael (GU) Type Theory EAFIT / 34
13 Forml Lnguges Removing duplicte sutrees II... ε E N Z Andres Ael (GU) Type Theory EAFIT / 34
14 Forml Lnguges Bending rnches II... ε E N Z Andres Ael (GU) Type Theory EAFIT / 34
15 Forml Lnguges Extensionl Equlity of Automt All utomt for E unfold to the sme trie. This gives extensionl notion of utomt equlity: 1 Recognizing the sme lnguge. 2 I.e., unfold to the sme trie. Andres Ael (GU) Type Theory EAFIT / 34
16 Forml Lnguges Automt, Formlly An utomton consists of 1 A set of sttes S. 2 A function ν : S Bool singling out the ccepting sttes. 3 A trnsition function δ : S A S. s S νs δ s δ s E ε Z ε Z N Z N N Z Lnguge utomton 1 Stte = lnguge l ccepted when strting from tht stte. 2 νl: Lnguge l is nullle (ccepts the empty word)? 3 δl = {w w l}: Brzozowski derivtive. Andres Ael (GU) Type Theory EAFIT / 34
17 Forml Lnguges Differentil equtions Lnguge E nd friends cn e specified y differentil equtions: ν gives the initil vlue. ν = flse δ x = ν ε = true δ ε x = ν N = true δ N = N δ N = Z ν E = flse δ E = ε δ E = Z ν Z = flse δ Z = N δ Z = Z For these simple forms, solutions exist lwys. Wht is the generl story? Andres Ael (GU) Type Theory EAFIT / 34
18 Coinductive Types nd Coptterns Finl Colgers (Wekly) finl colger. S f F (S) coit f νf force F (νf ) F (coit f ) Coitertion = finlity witness. force coit f = F (coit f ) f Copttern mtching defines coit y corecursion: force (coit f s) = F (coit f ) (f s) Andres Ael (GU) Type Theory EAFIT / 34
19 Coinductive Types nd Coptterns Strems s Finl Colger Output utomton is colger o, t : S A S. Finl colger = utomton unrolling = strem: νs. A S. S o,t A S coit o,t id coit o,t Strem A hed,til A Strem A Termintion y induction on oservtion depth: hed (coit o, t s) = o s til (coit o, t s) = coit o, t (t s) Andres Ael (GU) Type Theory EAFIT / 34
20 Coinductive Types nd Coptterns Automt s Colger Ari & Mnes (1986), Rutten (1998), Trytel (2016). Automton structure over set of sttes S: o : S Bool output : cceptnce t : S (A S) trnsition Automton is colger with F (S) = Bool (A S). o, t : S Bool (A S) Andres Ael (GU) Type Theory EAFIT / 34
21 Coinductive Types nd Coptterns Forml Lnguges s Finl Colger S o,t Bool (A S) l := coit o,t Lng ν,δ id (coit o,t _) Bool (A Lng) ν l = o nullle ν (l s) = o s δ l = (l _) t (Brzozowski) derivtive δ (l s) = l (t s) δ (l s) = l (t s ) Andres Ael (GU) Type Theory EAFIT / 34
22 Coinductive Types nd Coptterns Lnguges Rule-Bsed Coinductive tries Lng defined vi oservtions/projections ν nd δ: Lng is the gretest type consistent with these rules: l : Lng ν l : Bool l : Lng δ l : Lng : A Empty lnguge : Lng. Lnguge of the empty word ε : Lng defined y copttern mtching: ν ε = true : Bool δ ε = : Lng Andres Ael (GU) Type Theory EAFIT / 34
23 Coinductive Types nd Coptterns Corecursion Empty lnguge : Lng defined y corecursion: ν = flse δ = Lnguge union k l is pointwise disjunction: ν (k l) = ν k ν l δ (k l) = δ k δ l Lnguge composition k l à l Brzozowski: ν (k l) = ν k ν l { (δ k l) δ l if ν k δ (k l) = (δ k l) otherwise Not ccepted ecuse is not constructor. Andres Ael (GU) Type Theory EAFIT / 34
24 Bisimilrity Bisimilrity Equlity of infinite tries is defined coinductively. _ =_ is the gretest reltion consistent with l = k ν l ν k =ν l = k : A δ l = δ k =δ Equivlence reltion vi provle =refl, =sym, nd =trns. =trns : (p : l = k) (q : k = m) l = m =ν ( =trns p q) = trns ( =ν p) ( =ν q) : ν l ν k =δ ( =trns p q) = =trns ( =δ p ) ( =δ q ) : δ l = δ m Congruence for lnguge constructions. k = k l = l (k k ) = (l l ) = Andres Ael (GU) Type Theory EAFIT / 34
25 Bisimilrity Not coitertive / gurded y constructors! Andres Ael (GU) Type Theory EAFIT / 34 Proving isimilrity Composition distriutes over union. dist : k l m. k (l m) = (k l) (k m) Proof. Oservtion δ _, cse k nullle, l not nullle. δ (k (l m)) = δ k (l m) δ (l m) y definition = (δ k l δ k m) (δ l δ m ) y coind. hyp. (wish) = (δ k l δ l ) (δ k m δ m ) y union lws = δ ((k l) (k m)) y definition Forml proof ttempt. =δ dist = =trns ( = dist... )...
26 Sized Coinductive Types Construction of gretest fixed-points Itertion to gretest fixed-point. F ( ) F 2 ( ) F ω ( ) = F n ( ) Nming ν i F = F i ( ). ν 0 F = ν n+1 F = F (ν n F ) ν ω F = n<ω νn F Defltionry itertion. ν i F = j<i F (νj F ) n<ω Andres Ael (GU) Type Theory EAFIT / 34
27 Sized Coinductive Types Sized coinductive types Add to syntx of type theory Size i ν i F Size< i type of ordinls ordinl vriles sized coinductive type type of ordinls elow i Bounded quntifiction j<i. A = (j : Size< i) A. Well-founded recursion on ordinls, roughly: f : i. ( j<i. ν j F ) ν i F fix f : i. ν i F Andres Ael (GU) Type Theory EAFIT / 34
28 Sized Coinductive Types Sized coinductive type of lnguges Lng i = Bool ( j<i. A Lng j) l : Lng i ν l : Bool l : Lng i j < i : A δ l {j} : Lng j : i. Lng i y coptterns nd induction on i: ν ( {i}) = flse : Bool δ ( {i}) {j} = {j} : Lng j Note j < i. On right hnd side, : j<i. Lng j (coinductive hypothesis). Andres Ael (GU) Type Theory EAFIT / 34
29 Sized Coinductive Types Type-sed gurdedness checking Union preserves size/gurdeness: k : Lng i k l : Lng i l : Lng i ν (k l) = ν k ν l δ (k l) {j} = δ k {j} δ l {j} Composition is ccepted nd lso gurdedness-preserving: k : Lng i k l : Lng i l : Lng i ν (k l) = ν k ν l { (δ k {j} l) δ l {j} if ν k δ (k l) {j} = (δ k {j} l) otherwise Andres Ael (GU) Type Theory EAFIT / 34
30 Sized Coinductive Types Gurdedness-preserving isimilrity proofs Sized isimilrity = is gretest fmily of reltions consistent with l = i k ν l ν k =ν l = i k j < i : A δ l = j δ k =δ Equivlence nd congruence rules re gurdedness preserving. =trns : (p : l = i k) (q : k = i m) l = i m =ν ( =trns p q) = trns ( =ν p) ( =ν q) : ν l ν k =δ ( =trns p q) j = =trns ( =δ p j ) ( =δ q j ) : δ l = j δ m Coinductive proof of dist ccepted. =δ dist j = =trns j ( = (dist j) ( =refl j))... Andres Ael (GU) Type Theory EAFIT / 34
31 Conclusions Conclusions Trcking gurdedness in types llows nturl modulr corecursive definition nturl isimilrity proof using eqution chins Implemented in Agd (ongoing) Ael et l (POPL 13): Coptterns [2] Ael/Pientk (ICFP 13): Well-founded recursion with coptterns [1] Andres Ael (GU) Type Theory EAFIT / 34
32 Conclusions References I Andres Ael nd Brigitte Pientk. Wellfounded recursion with coptterns: A unified pproch to termintion nd productivity. In ICFP 13, pges ACM, Andres Ael, Brigitte Pientk, Dvid Thiodeu, nd Anton Setzer. Coptterns: Progrmming infinite structures y oservtions. In POPL 13, pges ACM, Roin Cockett nd Tom Fukushim. Aout Chrity. Technicl report, Deprtment of Computer Science, The University of Clgry, Yellow Series Report No. 92/480/18. Andres Ael (GU) Type Theory EAFIT / 34
33 Conclusions References II Ttsuy Hgino. A Ctegoricl Progrmming Lnguge. PhD thesis, University of Edinurgh, John Hughes, Lrs Preto, nd Amr Sry. Proving the correctness of rective systems using sized types. In POPL 96, pges ACM, Dexter Kozen nd Alexndr Silv. Prcticl coinduction. MSCS, FirstView:1 21, Andres Ael (GU) Type Theory EAFIT / 34
34 Conclusions References III Jorge Luis Scchini. Type-sed productivity of strem definitions in the clculus of constructions. In LICS 13, pges IEEE CS Press, Dmitriy Trytel. Forml lnguges, formlly nd coinductively. In FSCD 16, volume 52 of LIPIcs, pges 31:1 31:17. Schloss Dgstuhl - Leiniz-Zentrum fuer Informtik, Andres Ael (GU) Type Theory EAFIT / 34
AUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton
25. Finite Automt AUTOMATA AND LANGUAGES A system of computtion tht only hs finite numer of possile sttes cn e modeled using finite utomton A finite utomton is often illustrted s stte digrm d d d. d q
More informationChapter 2 Finite Automata
Chpter 2 Finite Automt 28 2.1 Introduction Finite utomt: first model of the notion of effective procedure. (They lso hve mny other pplictions). The concept of finite utomton cn e derived y exmining wht
More informationLet's start with an example:
Finite Automt Let's strt with n exmple: Here you see leled circles tht re sttes, nd leled rrows tht re trnsitions. One of the sttes is mrked "strt". One of the sttes hs doule circle; this is terminl stte
More informationRegular expressions, Finite Automata, transition graphs are all the same!!
CSI 3104 /Winter 2011: Introduction to Forml Lnguges Chpter 7: Kleene s Theorem Chpter 7: Kleene s Theorem Regulr expressions, Finite Automt, trnsition grphs re ll the sme!! Dr. Neji Zgui CSI3104-W11 1
More informationMinimal DFA. minimal DFA for L starting from any other
Miniml DFA Among the mny DFAs ccepting the sme regulr lnguge L, there is exctly one (up to renming of sttes) which hs the smllest possile numer of sttes. Moreover, it is possile to otin tht miniml DFA
More informationChapter Five: Nondeterministic Finite Automata. Formal Language, chapter 5, slide 1
Chpter Five: Nondeterministic Finite Automt Forml Lnguge, chpter 5, slide 1 1 A DFA hs exctly one trnsition from every stte on every symol in the lphet. By relxing this requirement we get relted ut more
More informationCMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014
CMPSCI 250: Introduction to Computtion Lecture #31: Wht DFA s Cn nd Cn t Do Dvid Mix Brrington 9 April 2014 Wht DFA s Cn nd Cn t Do Deterministic Finite Automt Forml Definition of DFA s Exmples of DFA
More informationTheory of Computation Regular Languages. (NTU EE) Regular Languages Fall / 38
Theory of Computtion Regulr Lnguges (NTU EE) Regulr Lnguges Fll 2017 1 / 38 Schemtic of Finite Automt control 0 0 1 0 1 1 1 0 Figure: Schemtic of Finite Automt A finite utomton hs finite set of control
More informationFinite-State Automata: Recap
Finite-Stte Automt: Recp Deepk D Souz Deprtment of Computer Science nd Automtion Indin Institute of Science, Bnglore. 09 August 2016 Outline 1 Introduction 2 Forml Definitions nd Nottion 3 Closure under
More informationNon-Deterministic Finite Automata. Fall 2018 Costas Busch - RPI 1
Non-Deterministic Finite Automt Fll 2018 Costs Busch - RPI 1 Nondeterministic Finite Automton (NFA) Alphbet ={} q q2 1 q 0 q 3 Fll 2018 Costs Busch - RPI 2 Nondeterministic Finite Automton (NFA) Alphbet
More informationTheory of Computation Regular Languages
Theory of Computtion Regulr Lnguges Bow-Yw Wng Acdemi Sinic Spring 2012 Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring 2012 1 / 38 Schemtic of Finite Automt control 0 0 1 0 1 1 1 0 Figure: Schemtic of
More informationFormal Languages and Automata
Moile Computing nd Softwre Engineering p. 1/5 Forml Lnguges nd Automt Chpter 2 Finite Automt Chun-Ming Liu cmliu@csie.ntut.edu.tw Deprtment of Computer Science nd Informtion Engineering Ntionl Tipei University
More informationLecture 08: Feb. 08, 2019
4CS4-6:Theory of Computtion(Closure on Reg. Lngs., regex to NDFA, DFA to regex) Prof. K.R. Chowdhry Lecture 08: Fe. 08, 2019 : Professor of CS Disclimer: These notes hve not een sujected to the usul scrutiny
More informationCS 301. Lecture 04 Regular Expressions. Stephen Checkoway. January 29, 2018
CS 301 Lecture 04 Regulr Expressions Stephen Checkowy Jnury 29, 2018 1 / 35 Review from lst time NFA N = (Q, Σ, δ, q 0, F ) where δ Q Σ P (Q) mps stte nd n lphet symol (or ) to set of sttes We run n NFA
More informationCS 310 (sec 20) - Winter Final Exam (solutions) SOLUTIONS
CS 310 (sec 20) - Winter 2003 - Finl Exm (solutions) SOLUTIONS 1. (Logic) Use truth tles to prove the following logicl equivlences: () p q (p p) (q q) () p q (p q) (p q) () p q p q p p q q (q q) (p p)
More informationDesigning finite automata II
Designing finite utomt II Prolem: Design DFA A such tht L(A) consists of ll strings of nd which re of length 3n, for n = 0, 1, 2, (1) Determine wht to rememer out the input string Assign stte to ech of
More informationSpeech Recognition Lecture 2: Finite Automata and Finite-State Transducers. Mehryar Mohri Courant Institute and Google Research
Speech Recognition Lecture 2: Finite Automt nd Finite-Stte Trnsducers Mehryr Mohri Cournt Institute nd Google Reserch mohri@cims.nyu.com Preliminries Finite lphet Σ, empty string. Set of ll strings over
More informationCHAPTER 1 Regular Languages. Contents
Finite Automt (FA or DFA) CHAPTE 1 egulr Lnguges Contents definitions, exmples, designing, regulr opertions Non-deterministic Finite Automt (NFA) definitions, euivlence of NFAs nd DFAs, closure under regulr
More informationFinite Automata. Informatics 2A: Lecture 3. Mary Cryan. 21 September School of Informatics University of Edinburgh
Finite Automt Informtics 2A: Lecture 3 Mry Cryn School of Informtics University of Edinburgh mcryn@inf.ed.c.uk 21 September 2018 1 / 30 Lnguges nd Automt Wht is lnguge? Finite utomt: recp Some forml definitions
More informationCoalgebra, Lecture 15: Equations for Deterministic Automata
Colger, Lecture 15: Equtions for Deterministic Automt Julin Slmnc (nd Jurrin Rot) Decemer 19, 2016 In this lecture, we will study the concept of equtions for deterministic utomt. The notes re self contined
More informationNon Deterministic Automata. Linz: Nondeterministic Finite Accepters, page 51
Non Deterministic Automt Linz: Nondeterministic Finite Accepters, pge 51 1 Nondeterministic Finite Accepter (NFA) Alphbet ={} q 1 q2 q 0 q 3 2 Nondeterministic Finite Accepter (NFA) Alphbet ={} Two choices
More informationCMSC 330: Organization of Programming Languages
CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 CMSC 330 1 Types of Finite Automt Deterministic Finite Automt (DFA) Exctly one sequence of steps for ech string All exmples so fr Nondeterministic
More informationCS 373, Spring Solutions to Mock midterm 1 (Based on first midterm in CS 273, Fall 2008.)
CS 373, Spring 29. Solutions to Mock midterm (sed on first midterm in CS 273, Fll 28.) Prolem : Short nswer (8 points) The nswers to these prolems should e short nd not complicted. () If n NF M ccepts
More informationFinite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018
Finite Automt Theory nd Forml Lnguges TMV027/DIT321 LP4 2018 Lecture 10 An Bove April 23rd 2018 Recp: Regulr Lnguges We cn convert between FA nd RE; Hence both FA nd RE ccept/generte regulr lnguges; More
More informationTypes of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. Comparing DFAs and NFAs (cont.) Finite Automata 2
CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 Types of Finite Automt Deterministic Finite Automt () Exctly one sequence of steps for ech string All exmples so fr Nondeterministic Finite Automt
More informationSpeech Recognition Lecture 2: Finite Automata and Finite-State Transducers
Speech Recognition Lecture 2: Finite Automt nd Finite-Stte Trnsducers Eugene Weinstein Google, NYU Cournt Institute eugenew@cs.nyu.edu Slide Credit: Mehryr Mohri Preliminries Finite lphet, empty string.
More informationTypes of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. NFA for (a b)*abb.
CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 Types of Finite Automt Deterministic Finite Automt () Exctly one sequence of steps for ech string All exmples so fr Nondeterministic Finite Automt
More informationFinite Automata. Informatics 2A: Lecture 3. John Longley. 22 September School of Informatics University of Edinburgh
Lnguges nd Automt Finite Automt Informtics 2A: Lecture 3 John Longley School of Informtics University of Edinburgh jrl@inf.ed.c.uk 22 September 2017 1 / 30 Lnguges nd Automt 1 Lnguges nd Automt Wht is
More informationAutomata Theory 101. Introduction. Outline. Introduction Finite Automata Regular Expressions ω-automata. Ralf Huuck.
Outline Automt Theory 101 Rlf Huuck Introduction Finite Automt Regulr Expressions ω-automt Session 1 2006 Rlf Huuck 1 Session 1 2006 Rlf Huuck 2 Acknowledgement Some slides re sed on Wolfgng Thoms excellent
More informationOn Determinisation of History-Deterministic Automata.
On Deterministion of History-Deterministic Automt. Denis Kupererg Mich l Skrzypczk University of Wrsw YR-ICALP 2014 Copenhgen Introduction Deterministic utomt re centrl tool in utomt theory: Polynomil
More informationAnatomy of a Deterministic Finite Automaton. Deterministic Finite Automata. A machine so simple that you can understand it in less than one minute
Victor Admchik Dnny Sletor Gret Theoreticl Ides In Computer Science CS 5-25 Spring 2 Lecture 2 Mr 3, 2 Crnegie Mellon University Deterministic Finite Automt Finite Automt A mchine so simple tht you cn
More informationGrammar. Languages. Content 5/10/16. Automata and Languages. Regular Languages. Regular Languages
5//6 Grmmr Automt nd Lnguges Regulr Grmmr Context-free Grmmr Context-sensitive Grmmr Prof. Mohmed Hmd Softwre Engineering L. The University of Aizu Jpn Regulr Lnguges Context Free Lnguges Context Sensitive
More informationCS103B Handout 18 Winter 2007 February 28, 2007 Finite Automata
CS103B ndout 18 Winter 2007 Ferury 28, 2007 Finite Automt Initil text y Mggie Johnson. Introduction Severl childrens gmes fit the following description: Pieces re set up on plying ord; dice re thrown or
More informationCS 267: Automated Verification. Lecture 8: Automata Theoretic Model Checking. Instructor: Tevfik Bultan
CS 267: Automted Verifiction Lecture 8: Automt Theoretic Model Checking Instructor: Tevfik Bultn LTL Properties Büchi utomt [Vrdi nd Wolper LICS 86] Büchi utomt: Finite stte utomt tht ccept infinite strings
More informationHarvard University Computer Science 121 Midterm October 23, 2012
Hrvrd University Computer Science 121 Midterm Octoer 23, 2012 This is closed-ook exmintion. You my use ny result from lecture, Sipser, prolem sets, or section, s long s you quote it clerly. The lphet is
More informationState Minimization for DFAs
Stte Minimiztion for DFAs Red K & S 2.7 Do Homework 10. Consider: Stte Minimiztion 4 5 Is this miniml mchine? Step (1): Get rid of unrechle sttes. Stte Minimiztion 6, Stte is unrechle. Step (2): Get rid
More informationMyhill-Nerode Theorem
Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Myhill-Nerode Theorem Deepk D Souz Deprtment of Computer Science nd Automtion Indin Institute
More informationConverting Regular Expressions to Discrete Finite Automata: A Tutorial
Converting Regulr Expressions to Discrete Finite Automt: A Tutoril Dvid Christinsen 2013-01-03 This is tutoril on how to convert regulr expressions to nondeterministic finite utomt (NFA) nd how to convert
More informationFundamentals of Computer Science
Fundmentls of Computer Science Chpter 3: NFA nd DFA equivlence Regulr expressions Henrik Björklund Umeå University Jnury 23, 2014 NFA nd DFA equivlence As we shll see, it turns out tht NFA nd DFA re equivlent,
More informationCSCI 340: Computational Models. Kleene s Theorem. Department of Computer Science
CSCI 340: Computtionl Models Kleene s Theorem Chpter 7 Deprtment of Computer Science Unifiction In 1954, Kleene presented (nd proved) theorem which (in our version) sttes tht if lnguge cn e defined y ny
More informationRegular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Kleene-*
Regulr Expressions (RE) Regulr Expressions (RE) Empty set F A RE denotes the empty set Opertion Nottion Lnguge UNIX Empty string A RE denotes the set {} Alterntion R +r L(r ) L(r ) r r Symol Alterntion
More informationWorked out examples Finite Automata
Worked out exmples Finite Automt Exmple Design Finite Stte Automton which reds inry string nd ccepts only those tht end with. Since we re in the topic of Non Deterministic Finite Automt (NFA), we will
More informationSoftware Engineering using Formal Methods
Softwre Engineering using Forml Methods Propositionl nd (Liner) Temporl Logic Wolfgng Ahrendt 13th Septemer 2016 SEFM: Liner Temporl Logic /GU 160913 1 / 60 Recpitultion: FormlistionFormlistion: Syntx,
More information5. (±±) Λ = fw j w is string of even lengthg [ 00 = f11,00g 7. (11 [ 00)± Λ = fw j w egins with either 11 or 00g 8. (0 [ ffl)1 Λ = 01 Λ [ 1 Λ 9.
Regulr Expressions, Pumping Lemm, Right Liner Grmmrs Ling 106 Mrch 25, 2002 1 Regulr Expressions A regulr expression descries or genertes lnguge: it is kind of shorthnd for listing the memers of lnguge.
More informationHybrid Control and Switched Systems. Lecture #2 How to describe a hybrid system? Formal models for hybrid system
Hyrid Control nd Switched Systems Lecture #2 How to descrie hyrid system? Forml models for hyrid system João P. Hespnh University of Cliforni t Snt Brr Summry. Forml models for hyrid systems: Finite utomt
More informationExercises Chapter 1. Exercise 1.1. Let Σ be an alphabet. Prove wv = w + v for all strings w and v.
1 Exercises Chpter 1 Exercise 1.1. Let Σ e n lphet. Prove wv = w + v for ll strings w nd v. Prove # (wv) = # (w)+# (v) for every symol Σ nd every string w,v Σ. Exercise 1.2. Let w 1,w 2,...,w k e k strings,
More informationNon-Deterministic Finite Automata
Non-Deterministic Finite Automt http://users.comlb.ox.c.uk/luke. ong/teching/moc/nf2up.pdf 1 Nondeterministic Finite Automton (NFA) Alphbet ={} q1 q2 2 Alphbet ={} Two choices q1 q2 3 Alphbet ={} Two choices
More informationCS:4330 Theory of Computation Spring Regular Languages. Equivalences between Finite automata and REs. Haniel Barbosa
CS:4330 Theory of Computtion Spring 208 Regulr Lnguges Equivlences between Finite utomt nd REs Hniel Brbos Redings for this lecture Chpter of [Sipser 996], 3rd edition. Section.3. Finite utomt nd regulr
More informationAssignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages
Deprtment of Computer Science, Austrlin Ntionl University COMP2600 Forml Methods for Softwre Engineering Semester 2, 206 Assignment Automt, Lnguges, nd Computility Smple Solutions Finite Stte Automt nd
More informationa,b a 1 a 2 a 3 a,b 1 a,b a,b 2 3 a,b a,b a 2 a,b CS Determinisitic Finite Automata 1
CS4 45- Determinisitic Finite Automt -: Genertors vs. Checkers Regulr expressions re one wy to specify forml lnguge String Genertor Genertes strings in the lnguge Deterministic Finite Automt (DFA) re nother
More informationCISC 4090 Theory of Computation
9/6/28 Stereotypicl computer CISC 49 Theory of Computtion Finite stte mchines & Regulr lnguges Professor Dniel Leeds dleeds@fordhm.edu JMH 332 Centrl processing unit (CPU) performs ll the instructions
More informationMore on automata. Michael George. March 24 April 7, 2014
More on utomt Michel George Mrch 24 April 7, 2014 1 Automt constructions Now tht we hve forml model of mchine, it is useful to mke some generl constructions. 1.1 DFA Union / Product construction Suppose
More informationCS 275 Automata and Formal Language Theory
CS 275 utomt nd Forml Lnguge Theory Course Notes Prt II: The Recognition Prolem (II) Chpter II.5.: Properties of Context Free Grmmrs (14) nton Setzer (Bsed on ook drft y J. V. Tucker nd K. Stephenson)
More informationFABER Formal Languages, Automata and Models of Computation
DVA337 FABER Forml Lnguges, Automt nd Models of Computtion Lecture 5 chool of Innovtion, Design nd Engineering Mälrdlen University 2015 1 Recp of lecture 4 y definition suset construction DFA NFA stte
More informationCSCI 340: Computational Models. Transition Graphs. Department of Computer Science
CSCI 340: Computtionl Models Trnsition Grphs Chpter 6 Deprtment of Computer Science Relxing Restrints on Inputs We cn uild n FA tht ccepts only the word! 5 sttes ecuse n FA cn only process one letter t
More informationConvert the NFA into DFA
Convert the NF into F For ech NF we cn find F ccepting the sme lnguge. The numer of sttes of the F could e exponentil in the numer of sttes of the NF, ut in prctice this worst cse occurs rrely. lgorithm:
More information1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.
York University CSE 2 Unit 3. DFA Clsses Converting etween DFA, NFA, Regulr Expressions, nd Extended Regulr Expressions Instructor: Jeff Edmonds Don t chet y looking t these nswers premturely.. For ech
More informationNormal Forms for Context-free Grammars
Norml Forms for Context-free Grmmrs 1 Linz 6th, Section 6.2 wo Importnt Norml Forms, pges 171--178 2 Chomsky Norml Form All productions hve form: A BC nd A vrile vrile terminl 3 Exmples: S AS S AS S S
More informationJava II Finite Automata I
Jv II Finite Automt I Bernd Kiefer Bernd.Kiefer@dfki.de Deutsches Forschungszentrum für künstliche Intelligenz Finite Automt I p.1/13 Processing Regulr Expressions We lredy lerned out Jv s regulr expression
More informationLecture 9: LTL and Büchi Automata
Lecture 9: LTL nd Büchi Automt 1 LTL Property Ptterns Quite often the requirements of system follow some simple ptterns. Sometimes we wnt to specify tht property should only hold in certin context, clled
More informationContext-Free Grammars and Languages
Context-Free Grmmrs nd Lnguges (Bsed on Hopcroft, Motwni nd Ullmn (2007) & Cohen (1997)) Introduction Consider n exmple sentence: A smll ct ets the fish English grmmr hs rules for constructing sentences;
More informationLecture 09: Myhill-Nerode Theorem
CS 373: Theory of Computtion Mdhusudn Prthsrthy Lecture 09: Myhill-Nerode Theorem 16 Ferury 2010 In this lecture, we will see tht every lnguge hs unique miniml DFA We will see this fct from two perspectives
More informationCS415 Compilers. Lexical Analysis and. These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University
CS415 Compilers Lexicl Anlysis nd These slides re sed on slides copyrighted y Keith Cooper, Ken Kennedy & Lind Torczon t Rice University First Progrmming Project Instruction Scheduling Project hs een posted
More informationNon-deterministic Finite Automata
Non-deterministic Finite Automt Eliminting non-determinism Rdoud University Nijmegen Non-deterministic Finite Automt H. Geuvers nd T. vn Lrhoven Institute for Computing nd Informtion Sciences Intelligent
More informationFormal Methods in Software Engineering
Forml Methods in Softwre Engineering Lecture 09 orgniztionl issues Prof. Dr. Joel Greenyer Decemer 9, 2014 Written Exm The written exm will tke plce on Mrch 4 th, 2015 The exm will tke 60 minutes nd strt
More informationLexical Analysis Finite Automate
Lexicl Anlysis Finite Automte CMPSC 470 Lecture 04 Topics: Deterministic Finite Automt (DFA) Nondeterministic Finite Automt (NFA) Regulr Expression NFA DFA A. Finite Automt (FA) FA re grph, like trnsition
More information11.1 Finite Automata. CS125 Lecture 11 Fall Motivation: TMs without a tape: maybe we can at least fully understand such a simple model?
CS125 Lecture 11 Fll 2016 11.1 Finite Automt Motivtion: TMs without tpe: mybe we cn t lest fully understnd such simple model? Algorithms (e.g. string mtching) Computing with very limited memory Forml verifiction
More informationMore general families of infinite graphs
More generl fmilies of infinite grphs Antoine Meyer Forml Methods Updte 2006 IIT Guwhti Prefix-recognizle grphs Theorem Let G e grph, the following sttements re equivlent: G is defined y reltions of the
More informationNon Deterministic Automata. Formal Languages and Automata - Yonsei CS 1
Non Deterministic Automt Forml Lnguges nd Automt - Yonsei CS 1 Nondeterministic Finite Accepter (NFA) We llow set of possible moves insted of A unique move. Alphbet = {} Two choices q 1 q2 Forml Lnguges
More informationCSE : Exam 3-ANSWERS, Spring 2011 Time: 50 minutes
CSE 260-002: Exm 3-ANSWERS, Spring 20 ime: 50 minutes Nme: his exm hs 4 pges nd 0 prolems totling 00 points. his exm is closed ook nd closed notes.. Wrshll s lgorithm for trnsitive closure computtion is
More informationCHAPTER 1 Regular Languages. Contents. definitions, examples, designing, regular operations. Non-deterministic Finite Automata (NFA)
Finite Automt (FA or DFA) CHAPTER Regulr Lnguges Contents definitions, exmples, designing, regulr opertions Non-deterministic Finite Automt (NFA) definitions, equivlence of NFAs DFAs, closure under regulr
More informationNFA DFA Example 3 CMSC 330: Organization of Programming Languages. Equivalence of DFAs and NFAs. Equivalence of DFAs and NFAs (cont.
NFA DFA Exmple 3 CMSC 330: Orgniztion of Progrmming Lnguges NFA {B,D,E {A,E {C,D {E Finite Automt, con't. R = { {A,E, {B,D,E, {C,D, {E 2 Equivlence of DFAs nd NFAs Any string from {A to either {D or {CD
More informationHomework 3 Solutions
CS 341: Foundtions of Computer Science II Prof. Mrvin Nkym Homework 3 Solutions 1. Give NFAs with the specified numer of sttes recognizing ech of the following lnguges. In ll cses, the lphet is Σ = {,1}.
More informationNFAs and Regular Expressions. NFA-ε, continued. Recall. Last class: Today: Fun:
CMPU 240 Lnguge Theory nd Computtion Spring 2019 NFAs nd Regulr Expressions Lst clss: Introduced nondeterministic finite utomt with -trnsitions Tody: Prove n NFA- is no more powerful thn n NFA Introduce
More informationClosure Properties of Regular Languages
Closure Properties of Regulr Lnguges Regulr lnguges re closed under mny set opertions. Let L 1 nd L 2 e regulr lnguges. (1) L 1 L 2 (the union) is regulr. (2) L 1 L 2 (the conctention) is regulr. (3) L
More information3 Regular expressions
3 Regulr expressions Given n lphet Σ lnguge is set of words L Σ. So fr we were le to descrie lnguges either y using set theory (i.e. enumertion or comprehension) or y n utomton. In this section we shll
More informationIntermediate Math Circles Wednesday, November 14, 2018 Finite Automata II. Nickolas Rollick a b b. a b 4
Intermedite Mth Circles Wednesdy, Novemer 14, 2018 Finite Automt II Nickols Rollick nrollick@uwterloo.c Regulr Lnguges Lst time, we were introduced to the ide of DFA (deterministic finite utomton), one
More informationFoundations of XML Types: Tree Automata
1 / 43 Foundtions of XML Types: Tree Automt Pierre Genevès CNRS (slides mostly sed on slides y W. Mrtens nd T. Schwentick) University of Grenole Alpes, 2017 2018 2 / 43 Why Tree Automt? Foundtions of XML
More informationCompiler Design. Fall Lexical Analysis. Sample Exercises and Solutions. Prof. Pedro C. Diniz
University of Southern Cliforni Computer Science Deprtment Compiler Design Fll Lexicl Anlysis Smple Exercises nd Solutions Prof. Pedro C. Diniz USC / Informtion Sciences Institute 4676 Admirlty Wy, Suite
More information1 Nondeterministic Finite Automata
1 Nondeterministic Finite Automt Suppose in life, whenever you hd choice, you could try oth possiilities nd live your life. At the end, you would go ck nd choose the one tht worked out the est. Then you
More informationCS375: Logic and Theory of Computing
CS375: Logic nd Theory of Computing Fuhu (Frnk) Cheng Deprtment of Computer Science University of Kentucky 1 Tle of Contents: Week 1: Preliminries (set lger, reltions, functions) (red Chpters 1-4) Weeks
More informationTutorial Automata and formal Languages
Tutoril Automt nd forml Lnguges Notes for to the tutoril in the summer term 2017 Sestin Küpper, Christine Mik 8. August 2017 1 Introduction: Nottions nd sic Definitions At the eginning of the tutoril we
More informationGood-for-Games Automata versus Deterministic Automata.
Good-for-Gmes Automt versus Deterministic Automt. Denis Kuperberg 1,2 Mich l Skrzypczk 1 1 University of Wrsw 2 IRIT/ONERA (Toulouse) Séminire MoVe 12/02/2015 LIF, Luminy Introduction Deterministic utomt
More informationDeterministic Finite-State Automata
Deterministic Finite-Stte Automt Deepk D Souz Deprtment of Computer Science nd Automtion Indin Institute of Science, Bnglore. 12 August 2013 Outline 1 Introduction 2 Exmple DFA 1 DFA for Odd number of
More informationLanguages & Automata
Lnguges & Automt Dr. Lim Nughton Lnguges A lnguge is sed on n lphet which is finite set of smols such s {, } or {, } or {,..., z}. If Σ is n lphet, string over Σ is finite sequence of letters from Σ, (strings
More informationNondeterminism and Nodeterministic Automata
Nondeterminism nd Nodeterministic Automt 61 Nondeterminism nd Nondeterministic Automt The computtionl mchine models tht we lerned in the clss re deterministic in the sense tht the next move is uniquely
More informationTalen en Automaten Test 1, Mon 7 th Dec, h45 17h30
Tlen en Automten Test 1, Mon 7 th Dec, 2015 15h45 17h30 This test consists of four exercises over 5 pges. Explin your pproch, nd write your nswer to ech exercise on seprte pge. You cn score mximum of 100
More informationCS 275 Automata and Formal Language Theory
CS 275 Automt nd Forml Lnguge Theory Course Notes Prt II: The Recognition Problem (II) Chpter II.6.: Push Down Automt Remrk: This mteril is no longer tught nd not directly exm relevnt Anton Setzer (Bsed
More informationAgenda. Agenda. Regular Expressions. Examples of Regular Expressions. Regular Expressions (crash course) Computational Linguistics 1
Agend CMSC/LING 723, LBSC 744 Kristy Hollingshed Seitz Institute for Advnced Computer Studies University of Mrylnd HW0 questions? Due Thursdy before clss! When in doubt, keep it simple... Lecture 2: 6
More informationCS 275 Automata and Formal Language Theory
CS 275 Automt nd Forml Lnguge Theory Course Notes Prt II: The Recognition Problem (II) Chpter II.5.: Properties of Context Free Grmmrs (14) Anton Setzer (Bsed on book drft by J. V. Tucker nd K. Stephenson)
More informationDeterministic Finite Automata
Finite Automt Deterministic Finite Automt H. Geuvers nd J. Rot Institute for Computing nd Informtion Sciences Version: fll 2016 J. Rot Version: fll 2016 Tlen en Automten 1 / 21 Outline Finite Automt Finite
More informationCS375: Logic and Theory of Computing
CS375: Logic nd Theory of Computing Fuhu (Frnk) Cheng Deprtment of Computer Science University of Kentucky 1 Tble of Contents: Week 1: Preliminries (set lgebr, reltions, functions) (red Chpters 1-4) Weeks
More informationCS 311 Homework 3 due 16:30, Thursday, 14 th October 2010
CS 311 Homework 3 due 16:30, Thursdy, 14 th Octoer 2010 Homework must e sumitted on pper, in clss. Question 1. [15 pts.; 5 pts. ech] Drw stte digrms for NFAs recognizing the following lnguges:. L = {w
More informationSection: Other Models of Turing Machines. Definition: Two automata are equivalent if they accept the same language.
Section: Other Models of Turing Mchines Definition: Two utomt re equivlent if they ccept the sme lnguge. Turing Mchines with Sty Option Modify δ, Theorem Clss of stndrd TM s is equivlent to clss of TM
More information12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2014
CS125 Lecture 12 Fll 2014 12.1 Nondeterminism The ide of nondeterministic computtions is to llow our lgorithms to mke guesses, nd only require tht they ccept when the guesses re correct. For exmple, simple
More informationGreedy regular expression matching
Alin Frisch INRIA Luc Crdelli MSRC 2004-05-15 ICALP The mtching prolem The prolem Project the structure of regulr expression on flt sequence. R = ( ) w = 1 2 1 2 3 v = [1 : [ 1 ; 2 ]; 2 : 1 ; 2 : 2 ; 1
More informationFormal Language and Automata Theory (CS21004)
Forml Lnguge nd Automt Forml Lnguge nd Automt Theory (CS21004) Khrgpur Khrgpur Khrgpur Forml Lnguge nd Automt Tle of Contents Forml Lnguge nd Automt Khrgpur 1 2 3 Khrgpur Forml Lnguge nd Automt Forml Lnguge
More informationNondeterminism. Nondeterministic Finite Automata. Example: Moves on a Chessboard. Nondeterminism (2) Example: Chessboard (2) Formal NFA
Nondeterminism Nondeterministic Finite Automt Nondeterminism Subset Construction A nondeterministic finite utomton hs the bility to be in severl sttes t once. Trnsitions from stte on n input symbol cn
More informationɛ-closure, Kleene s Theorem,
DEGefW5wiGH2XgYMEzUKjEmtCDUsRQ4d 1 A nice pper relevnt to this course is titled The Glory of the Pst 2 NICTA Resercher, Adjunct t the Austrlin Ntionl University nd Griffith University ɛ-closure, Kleene
More informationNon-deterministic Finite Automata
Non-deterministic Finite Automt From Regulr Expressions to NFA- Eliminting non-determinism Rdoud University Nijmegen Non-deterministic Finite Automt H. Geuvers nd J. Rot Institute for Computing nd Informtion
More information