CD5560 FORMELLA SPRÅK, AUTOMATER, OCH BERÄKNINGSTEORI, 5 p 10 AUGUSTI 2007 LÖSNINGAR

Relevanta dokument
abbcba a) A regular expression over

1. (6p) (a) Använd delmängdskonstruktionen för att tillverka en DFA ekvivalent med nedanstående NFA. (b) Är den resulterande DFA:n minimal? A a b.

AUBER 95 9 jan LÖSNINGAR STEG 1:

FORMELLA SPRÅK, AUTOMATER OCH BERÄKNINGSTEORI ÖVNINGSUPPGIFTER PÅ REGULJÄRA SPRÅK

4 Example exam questions

Grundläggande textanalys, VT2012

MÄLARDALENS HÖGSKOLA. CD5560 Formella språk, automater och beräkningsteori. Användarmanual. för simulatorn JFLAP

6 Formella språk. Matematik för språkteknologer (5LN445) UPPSALA UNIVERSITET

Finita automater, reguljära uttryck och prefixträd. Upplägg. Finita automater. Finita automater. Olika finita automater.

Workplan Food. Spring term 2016 Year 7. Name:

Kurskod: TAMS11 Provkod: TENB 12 June 2014, 14:00-18:00. English Version

Support Manual HoistLocatel Electronic Locks

1. Varje bevissteg ska motiveras formellt (informella bevis ger 0 poang)

Föreläsning 2 5/6/08. Reguljära uttryck 1. Reguljära uttryck. Konkatenering och Kleene star. Några operationer på språk

12.6 Heat equation, Wave equation

b) S Ø aa, A Ø aa» bb, B Ø aa» bc, C Ø ac» bc» 2. Låt L vara språket över 8a< som nedanstående NFA accepterar.

Isometries of the plane

Webbregistrering pa kurs och termin

Make a speech. How to make the perfect speech. söndag 6 oktober 13

Styrteknik: Binära tal, talsystem och koder D3:1

Module 1: Functions, Limits, Continuity

1. Compute the following matrix: (2 p) 2. Compute the determinant of the following matrix: (2 p)

Rep MEK föreläsning 2

This exam consists of four problems. The maximum sum of points is 20. The marks 3, 4 and 5 require a minimum

REGULJÄRA SPRÅK (8p + 6p) 1. DFA och reguljära uttryck (6 p) Problem. För följande NFA över alfabetet {0,1}:

Repetition 2. a) Delmängdskonstruktionen ger nedanstående DFA. Till höger med nya tillståndsnamn.

samhälle Susanna Öhman

Svenska()(Bruksanvisning(för(handdukstork()(1400(x(250(mm(

Pre-Test 1: M0030M - Linear Algebra.

Problem som kan uppkomma vid registrering av ansökan

Webbreg öppen: 26/ /

Kurskod: TAMS28 MATEMATISK STATISTIK Provkod: TEN1 05 June 2017, 14:00-18:00. English Version

Provlektion Just Stuff B Textbook Just Stuff B Workbook

Beijer Electronics AB 2000, MA00336A,

Tentamen i Matematik 2: M0030M.

Vässa kraven och förbättra samarbetet med hjälp av Behaviour Driven Development Anna Fallqvist Eriksson

PRESS FÄLLKONSTRUKTION FOLDING INSTRUCTIONS

Algoritmer och Komplexitet ht 08. Övning 6. NP-problem

BOENDEFORMENS BETYDELSE FÖR ASYLSÖKANDES INTEGRATION Lina Sandström

INSTALLATION INSTRUCTIONS

Module 6: Integrals and applications

Discovering!!!!! Swedish ÅÄÖ. EPISODE 6 Norrlänningar and numbers Misi.se

Hjälpmedel: Inga, inte ens miniräknare Göteborgs Universitet Datum: 2018 kl Telefonvakt: Jonatan Kallus Telefon: ankn 5325

Preschool Kindergarten

Kurskod: TAMS11 Provkod: TENB 28 August 2014, 08:00-12:00. English Version

Chapter 1 : Who do you think you are?

Solutions to exam in SF1811 Optimization, June 3, 2014

In Bloom CAL # 8, sista varv och ihopsättning / last rows and assemble

Starla juldekoration / christmas decoration

NP-fullständighetsbevis

Boiler with heatpump / Värmepumpsberedare

Övning 5 - Tillämpad datalogi 2013

Resultat av den utökade första planeringsövningen inför RRC september 2005

LUNDS TEKNISKA HÖGSKOLA Institutionen för Elektro- och Informationsteknik


PRESS FÄLLKONSTRUKTION FOLDING INSTRUCTIONS

Tentamen MMG610 Diskret Matematik, GU

1. Unpack content of zip-file to temporary folder and double click Setup

Protokoll Föreningsutskottet

Consumer attitudes regarding durability and labelling

The Algerian Law of Association. Hotel Rivoli Casablanca October 22-23, 2009

F ξ (x) = f(y, x)dydx = 1. We say that a random variable ξ has a distribution F (x), if. F (x) =

2.1 Installation of driver using Internet Installation of driver from disk... 3

Schenker Privpak AB Telefon VAT Nr. SE Schenker ABs ansvarsbestämmelser, identiska med Box 905 Faxnr Säte: Borås

Tentamen i kurserna Beräkningsmodeller (TDA181/INN110) och Grundläggande Datalogi (TDA180)

PROV I MATEMATIK Automatateori och formella språk DV1 4p

Idag: Reguljära språk Beskrivs av Reguljära uttryck DFA Grammatik

Tentamen i Matematik 2: M0030M.

Avoid Over Planning Your Next Trip: Why Less Planning is the Best Plan

How to format the different elements of a page in the CMS :

InstalationGuide. English. MODEL:150NHighGain/30NMiniUSBAdapter

Kurskod: TAMS11 Provkod: TENB 07 April 2015, 14:00-18:00. English Version

Adding active and blended learning to an introductory mechanics course

CONNECT- Ett engagerande nätverk! Paula Lembke Tf VD Connect Östra Sverige

Helping out in the kitchen or how to measure engagement

Service och bemötande. Torbjörn Johansson, GAF Pär Magnusson, Öjestrand GC

Institutionen för systemteknik

Föreläsning 7: Syntaxanalys

Alfabeten, strängar och språk. String

Writing with context. Att skriva med sammanhang

Focus on English 7. PROVLEKTION: the Present Continuous

LEVERANTÖRSLED; INKÖP OCH UPPHANDLING

Rev No. Magnetic gripper 3

MÅL ATT UPPNÅ (FRÅN SKOLVERKET)

Kvalitetsarbete I Landstinget i Kalmar län. 24 oktober 2007 Eva Arvidsson


Recitation 4. 2-D arrays. Exceptions

Samverkan på departementsnivå om Agenda 2030 och minskade hälsoklyftor

FORTA M315. Installation. 218 mm.

This is England. 1. Describe your first impression of Shaun! What kind of person is he? Why is he lonely and bullied?

Information technology Open Document Format for Office Applications (OpenDocument) v1.0 (ISO/IEC 26300:2006, IDT) SWEDISH STANDARDS INSTITUTE

GEOMETRISKA VEKTORER Vektorer i rummet.

Klyvklingor / Ripping Blades.

Annonsformat desktop. Startsida / områdesstartsidor. Artikel/nyhets-sidor. 1. Toppbanner, format 1050x180 pxl. Format 1060x180 px + 250x240 pxl.

Viktig information för transmittrar med option /A1 Gold-Plated Diaphragm

Mycket formellt, mottagaren har en speciell titel som ska användas i stället för namnet

Mina målsättningar för 2015

Uppsala Universitet Matematiska Institutionen Bo Styf. Sammanfattning av föreläsningarna 5-7.

Om oss DET PERFEKTA KOMPLEMENTET THE PERFECT COMPLETION 04 EN BINZ ÄR PRECIS SÅ BRA SOM DU FÖRVÄNTAR DIG A BINZ IS JUST AS GOOD AS YOU THINK 05

ASSEMBLY INSTRUCTIONS SCALE - SYSTEM

Transkript:

CD556 FORMELLA SPRÅK, AUTOMATER, OCH BERÄKNINGSTEORI, 5 p AUGUSTI 27 LÖSNINGAR REGULJÄRA SPRÅK (8p + 6p). DFA och reguljär uttryck (8 p) ) Konstruer en miniml DFA som ccepterr strängr över lfetet Σ = {,} sådn tt ing prefix (förutom strängen själv) är en multipel v 3 om de tolks som inär tl. Lmd, den tom strängen, räkns inte som multipel v 3. ) Låt e vr följnde reguljär uttryck e=(+(+ * ) * ) *. Vis tt L(e)={w (+) * in(w) = multipel v 6}. c) Skriv en enkel grmmtik för följnde reguljär uttryck: (+) * () + ( * * ) *. d) Konstruer en miniml DFA som ccepterr strängr som innehåller delsträng men inte. (Tips: gör två seprt utomter, och eräkn snittet). () We hve to check ll different prefixes. At the moment we find one cse where it s multiple of 3, nd it s not proper (i.e there re more symols to red) we stop nd reject the string. Such n utomton is (I consider tht is not multiple of 3). 3 2 4 Sttes, nd 2 represent multiple of 3, multiple of 3 plus nd multiple of 3 plus 2 respectively. Now we hve to check tht this utomton is miniml. We pply the itertive lgorithm, seprting ccepting nd rejecting sttes. Iter I II 2 3 4 II I I I II II I I I II Now, we seprte stte from the others. Iter I II III 2 3 4

CD556 FORMELLA SPRÅK, AUTOMATER, OCH BERÄKNINGSTEORI, 5 p AUGUSTI 27 LÖSNINGAR III II II II III III I II II III We hve to seprte now stte from 2,3. Iter 2 I II III IV 2 3 4 IV III II III IV IV I III II IV Finlly, we hve to split 2 nd 3, resulting with the utomton we lredy hve. So it s miniml. () If we wnt to prove tht, one wy is to crete the miniml utomt for oth, the lnguge nd the regulr expression, nd then compre them. If we see tht oth of them re the sme, we re done. First, I crete the utomton for the lnguge {w (+) * in(w)= 6 }. The ide is tht ech stte represents one of the possile sttes of numer: multiple of 6, multiple of 6 plus, multiple of 6 plus 2... nd so one. o 3 2 4 5 Now, it s time to mke sure tht the utomton is miniml. If we tke look to the sttes, it seems tht 5 nd 2 do the sme, nd tht 4 nd should e together. We pply the itertive lgorithm s in the previous exercise. Iter I II 2 3 4 5 I I II I I II I I I I I I We see tht stte 3 is different, so we split up the set I. 2

CD556 FORMELLA SPRÅK, AUTOMATER, OCH BERÄKNINGSTEORI, 5 p AUGUSTI 27 LÖSNINGAR Iter I II III 2 4 5 3 I I I I III III II I II I I I Agin, we hve to split set I into two sets, one for -4 nd the other for 2-5. Iter I II III IV 4 2 5 3 II II I II IV IV III III II II I I We re done. This is miniml! Now, it s time to clculte the utomton tht represents the regulr expression. This utomton is: 4 3 2 There s no need to minimize it, since we cn see tht it s exctly the sme one tht we minimized just ove. (c) We cn generte the grmmr from the regulr expression, lthough it s it tricky nd it cn e error prone. Thus, we first mke the utomton, nd we get the grmmr from it. I use NFA since it s esier to represent this regulr expression. The NFA is:, 2 3 4 5 3

CD556 FORMELLA SPRÅK, AUTOMATER, OCH BERÄKNINGSTEORI, 5 p AUGUSTI 27 LÖSNINGAR The following step determinize it. [] START --> S [,2] [] [,2] --> A [,2] [,3] [,3] --> B [,2,4] [] [,2,4] ACC [,2,4] [,3,5] [,3,5] ACC [,2,4] [,5] [,5] ACC [,4,2] [,5] Now, if we wnt to get very simple grmmr, we cn minimize it. If not, we cn use this utomton to get grmmr. If we minimize it, we ll see tht we never get out of the cceptnce sttes once we rech one, so we sustitute ll of them y one (clled C). Thus, the grmmr is (following the trnsitions from the determiniztion tle): S S A A A B B C S C C C λ (d) This cn e done stright from the mind. But nice nd methodic wy of doing it is creting first one utomton tht recognizes the strings tht hve the sustring (which is very esy). After tht, nother one tht recognizes the strings tht don t hve the sustring (which is very esy too). And finlly, you mke the intersection (nd minimize it). The utomton tht recognizes the strings tht hve the sustring is:, A B C D The other utomton is:, E F G H 4

CD556 FORMELLA SPRÅK, AUTOMATER, OCH BERÄKNINGSTEORI, 5 p AUGUSTI 27 LÖSNINGAR Now, we hve to compute the intersection. We strt joining the strting sttes, AE, nd we compute ll different trnsitions. AE () BE AF BE (2) CE AF AF (3) BE AG CE (4) DE AF AG (5) BE AH DE (6) --> DE DF ACC AH (7) BH AH DF (8) --> DE DG ACC BH (9) CH AH DG () --> DE DH ACC CH () DH AH DH (2) DH DH Now, we cn minimize it. Rejecting sttes={,2,3,4,5,7,9,,2}, ccepting sttes={6,8,} After minimizing (using the sme lgorithm s lwys), we cn join sttes {7,9,,2}, which is sink stte. 2. Reguljärt eller inte? Bevis! (6 p) ) L={u#v u,v (+) * u är en delsträng v v} ) L={xy x,y (+) + x = y +} Om du finner tt språket är reguljärt, presenter en FA eller ett reguljärt uttryck för det. Annrs evis ditt påstående med hjälp v pumpstsen eller särskiljndestsen. ) ICKE-REGULJÄRT We choose N. Then, we tke string, tht cn e s simple s N # N. Now, we choose decomposition. All possile decompositions re x= k, y= j, z= N-k-j # N, xy <N. Now, if we pump the string otining w =xy i z= N - j(i-) # N. Choosing i= is cler tht w doesn t fll into the lnguge, since j>. ) REGULJÄRT The lnguge is regulr, since it s the lnguge of the strings tht hve odd length. A regulr expression is (+) 2i+, i 5

CD556 FORMELLA SPRÅK, AUTOMATER, OCH BERÄKNINGSTEORI, 5 p AUGUSTI 27 LÖSNINGAR SAMMANHANGSFRIA SPRÅK (6p + 8p) 3. NPDA (6 p) Konstruer NPDA som ccepterr { n n2... nk k i ni=i }. (Noter tt strängr estår v ett som följs v pket med. Antlet motsvrr pketnumret i åtminstone ett pket i strängen. Således ccepters eftersom det tredje -pketet innehåller tre.) The ide is to use indeterminism. On one hnd, when we red n, we push n A to the stck so we know how mny pckets we hve red, which should e the numer of s we wnt to red. On the other hnd, we just move nd strt to check the s with the current stck. So, it s like hving two copies of the stck ll the time, nd ll this is possile due to indeterminism. The utomton is: Z ZA A AA A A A λ Z Z Z Z Z ZA A AA Zλ Z Z Z 4. Smmnhngsfri språk (8 p) ) Vilket språk genererr grmmtiken? S-> A A A A-> BB BB B-> B B B B λ ) Skriv en enkel grmmtik som eskriver ett språk vrs strängr innehåller fler än. 6

CD556 FORMELLA SPRÅK, AUTOMATER, OCH BERÄKNINGSTEORI, 5 p AUGUSTI 27 LÖSNINGAR () If you tke look to the different rules, you cn produce ny comintion of strings. Thus, you re generting either (,) * or (,) +. Since the first rules doesn t llow to mke the empty string, we re tlking out (,) +. () Such grmmr is: S BSSB SBSB B B B RESTRIKTIONSFRIA SPRÅK (6p + 3p + 3p) 5. Turingmskin (6 p) Hur fungerr följnde turingmskin? Vilket språk ccepterr den? Provkör! Initilt hr mskinen tpepekren på först tecknet i inputsträngen. Strängen cc är input. Den ccepters och då hr tpen utseendet xxyyzz## och tpepekren pekr på ndr #:et på högersidn. Den hr mtcht uttrycket nncn där n. 7

CD556 FORMELLA SPRÅK, AUTOMATER, OCH BERÄKNINGSTEORI, 5 p AUGUSTI 27 LÖSNINGAR 6. (3p) Show tht x mx( x, y) = y if x y otherwise is primitive recursive. mx( x, y) = x ( gt( x, y) + eq( x, y)) + y Check: mx(2,3) = 2 + 3 = 3 mx(3,2) = 3 + 2 = 3 mx(2,2) = 2 + 2 = 2 Therefore mx( x, y) is primitive recursive. gt( y, x) 7. Avgörrt? Motiver! (3p). L = { <M > L(M) hr exkt n element}.. L = { <M> L(M) är inte cceptert}. c. L = { <M> L(M) hr mindre än 7 tillstånd och stnnr på input }.. OAVGÖRBART! Följer v Rices sts, eftersom denn egenskp är icketrivil.. AVGÖRBART! Eftersom språket L(M) lltid är cceptert, är mängden i frågn en tom mängd. Eftersom det är ett tomt språk, är det vgörrt. c. AVGÖRBART! Det finns ändligt mång progrm med mindre än 7 tillstånd. Delmängd v dess, såsom de som stnnr på en viss input utgör också en finit mängd. Vrje finit mängd är Turing eräkningsr. Referenser. Slling: Formell språk, utomter och eräkningr 2 2. Linz, An Introduction to Forml Lnguges nd Automt, Jones & Brtlett 2 3. Sipser, Introduction to the Theory of Computtion, PWS 997 4. Sudkmp, Lnguges nd Mchines, Addison Wesley 998 5. Kiner-Smith, Theory of Computing, A Gentle Introduction, Prentice Hll 2 8