13th lsf a logi al and semanti f ramew o rks with appli
play

13th LSF A Logial and Semanti F ramew o rks, with - PowerPoint PPT Presentation

13th LSF A Logial and Semanti F ramew o rks, with Appliations UF C, F o rtaleza, CE Ma rus Ramos Some Appliations Septemb er 26th, 2018 1 / 29 Some Appliations of the F o rmalization of the Pumping Lemma


  1. 13th LSF A Logi al and Semanti F ramew o rks, with Appli ations UF C, F o rtaleza, CE Ma r us Ramos Some Appli ations Septemb er 26th, 2018 1 / 29

  2. Some Appli ations of the F o rmalization of the Pumping Lemma fo r Context-F ree Languages Ma r us Vin� ius Midena Ramos (UNIV ASF, P etrolina, PE) Jos� Ca rlos Ba ela r Almeida (HASLab - INESC TEC, Universidade do Minho, Braga, P o rtugal) Nelma Mo reira (Depa rtamento de Ci�n ia de Computado res, F a uldade de Ci�n ias, P o rto, P o rtugal) Ruy J. G. B. de Queiroz (UFPE, Re ife, PE) Septemb er 26th, 2018 Ma r us Ramos Some Appli ations Septemb er 26th, 2018 2 / 29

  3. S op e F o rmalize of a substantial pa rt of ontext-free language theo ry in the Co q p ro of assistant. ◮ F o rmalization is the p ro ess of writing p ro ofs su h that they have a p re ise meaning over a simple and w ell-de�ned al ulus whose rules an b e automati ally he k ed b y a ma hine; ◮ Context-free language theo ry is fundamental in the rep resentation and study of a rti� ial languages, sp e ially p rogramming languages, and in the onstru tion of their p ro esso rs ( ompilers and interp reters); ◮ The fo rmalization of ontext-free language theo ry is a k ey to the erti� ation of ompilers and p rograms, as w ell as to the development of new languages and to ols fo r erti�ed p rogramming. Ma r us Ramos Some Appli ations Septemb er 26th, 2018 3 / 29

  4. Context-F ree Language Theo ry Overview ◮ P a rt of F o rmal Language Theo ry (Chomsky Hiera r hy): ◮ Regula r Languages; ◮ Context-F ree Languages ; ◮ Context-Sensitive Languages; ◮ Re ursively Enumerable Languages. ◮ Develop ed from mid 1950s to late 1970s; ◮ Sin e then, mostly text p ro ofs and almost no fo rmalization; ◮ Relevant to the rep resentation, study and implementation of a rti� ial languages; Ma r us Ramos Some Appli ations Septemb er 26th, 2018 4 / 29

  5. Context-F ree Language Theo ry Steps Main results sin e 2013: 1 Closure p rop erties ( 9th LSF A 2014 ): ◮ Union; ◮ Con atenation; ◮ Kleene sta r. 2 Gramma r simpli� ation ( 10th LSF A 2015 ): ◮ Elimination of empt y rules; ◮ Elimination of unit; ◮ Elimination of useless symb ols; ◮ Elimination of ina essible symb ols. 3 Chomsky No rmal F o rm; 4 Pumping Lemma ( JFR, 2016 ) 5 Languages that a re not ontext-free ( 13th LSF A, 2018 ) Ma r us Ramos Some Appli ations Septemb er 26th, 2018 5 / 29

  6. Basi De�nitions Context-F ree Gramma r G = ( V, Σ , P, S ) , where: ◮ V of G is the vo abula ry ; ◮ Σ is the set of terminal symb ols; ◮ N = V \ Σ is the set of non-terminal symb ols; ◮ P and β ∈ V ∗ rules α → β with α ∈ N is the set of , ; ◮ S ∈ N is the sta rt symb ol. Re ord fg ( non_terminal terminal : Type ): Type := { start_symbol : non_terminal ; non_terminal → ) → rules : list ( non_terminal + terminal Prop ; rules_finite : ∃ n : nat , ∃ ntl : nlist , ∃ tl : tlist , rules_finite_def start_symbol rules n ntl tl }. Ma r us Ramos Some Appli ations Septemb er 26th, 2018 6 / 29

  7. Basi De�nitions Context-F ree Gramma r Making sure that fg rep resents a ontext-free gramma r: ◮ General t yp es might have an in�nite numb er of elements; ◮ W e must he k that the rules of the gramma r a re built from �nite sets of terminal and non-terminal symb ols; ◮ W e must also he k that the set of rules is �nite; ◮ The p redi ate rules_finite_def is used to mak e sure that these onditions a re satis�ed fo r every gramma r in the fo rmalization, either user-de�ned o r onstru ted; ◮ A list of non-terminal symb ols ( ntl ), a list of terminal symb ols ( tl ) and an upp er b ound on the length of the right-hand side of the rules ( n ) must b e supplied. Ma r us Ramos Some Appli ations Septemb er 26th, 2018 7 / 29

  8. Basi De�nitions Example G = ( { S ′ , A, B, a, b } , { a, b } , { S ′ → aS ′ , S ′ → b } , S ′ ) generates the language a ∗ b . Indu tive nt1 : Type := | S ' | A | B . Indu tive t1 : Type := | a | b . nt1 → ) → Indu tive rs1 : list ( nt1 + t1 Prop := r1 : rs1 S ' [ inr a ; inl S '℄ | r2 : rs1 S ' [ inr b ℄. Definition g1 : fg nt1 t1 := {| start_symbol := S '; rules := rs1 ; rules_finite := rs1_finite |}. Ma r us Ramos Some Appli ations Septemb er 26th, 2018 8 / 29

  9. Basi De�nitions Derivation Substitution p ro ess: rules: s 1 ⇒ ∗ s 2 s 1 derives s 2 b y appli ation of zero o r mo re . Indu tive derives ( non_terminal terminal : Type ) ( g : fg non_terminal terminal ) sf → sf → : Prop := | derives_refl : ∀ s : sf , derives g s s | derives_step : ∀ ( s1 s2 s3 : sf ) ∀ ( left : non_terminal ) ∀ ( right : sf ), ) → derives g s1 ( s2 ++ inl left :: s3 right → rules g left derives g s1 ( s2 ++ right ++ s3 ) Ma r us Ramos Some Appli ations Septemb er 26th, 2018 9 / 29

  10. Basi De�nitions Derivation ◮ Predi ate generates : a derivation that b egins with the sta rt symb ol of the gramma r; ◮ Predi ate produ es : a derivation that b egins with the sta rt symb ol of the gramma r and ends with a senten e. derives � �� � S ⇒ α 1 ⇒ α 2 ⇒ ... ⇒ α n − 1 ⇒ α n ⇒ ω � �� � generates � �� � produ es Ma r us Ramos Some Appli ations Septemb er 26th, 2018 10 / 29

  11. Basi De�nitions Example S ⇒ aS ⇒ aaS ⇒ aab Lemma produ es_g1_aab : produ es g1 [ a ; a ; b ℄. Proof . unfold produ es . unfold generates . simpl . apply derives_step with ( s2 :=[ inr a ; inr a ℄)( left := S ')( right :=[ inr b ℄). apply derives_step with ( s2 :=[ inr a ℄)( left := S ')( right :=[ inr a ; inl S '℄). apply derives_start with ( left := S ')( right :=[ inr a ; inl S '℄). apply r11 . apply r11 . apply r12 . Qed . Ma r us Ramos Some Appli ations Septemb er 26th, 2018 11 / 29

  12. Basi De�nitions Gramma r Equivalen e g 1 ≡ g 2 if they generate the same language, that is, ∀ s, ( S 1 ⇒ ∗ g 1 s ) ↔ ( S 2 ⇒ ∗ g 2 s ) Definition g_equiv ( non_terminal1 non_terminal2 terminal : Type ) ( g1 : fg non_terminal1 terminal ) ( g2 : fg non_terminal2 terminal ): Prop := ∀ s : list terminal , s ↔ produ es g1 produ es g2 s . Ma r us Ramos Some Appli ations Septemb er 26th, 2018 12 / 29

  13. Basi De�nitions Context-F ree Language ◮ A language is a set of strings over a given alphab et; ◮ A ontext-free language is a language that is generated b y some r: L ( G ) = { w | S ⇒ ∗ g w } ontext-free gramma . terminal → Definition lang ( terminal : Type ):= list Prop . Definition lang_of_g ( g : fg ): lang := terminal ⇒ fun w : list produ es g w . Definition lang_eq ( l k : lang ) := ∀ w ↔ w , l k w . Definition fl ( terminal : Type ) ( l : lang terminal ): Prop := ∃ non_terminal : Type , ∃ g : fg non_terminal terminal , lang_eq l ( lang_of_g g ). Ma r us Ramos Some Appli ations Septemb er 26th, 2018 13 / 29

  14. Appli ations Obje tives ◮ Derive fo rmal p ro ofs that some w ell-kno wn, lassi languages, a re not ontext-free. F o r this, w e use the fo rmalization of the Pumping Lemma p reviously obtained b y the autho rs in the Co q p ro of assistant. F o r ea h of these languages, w e dis uss the fo rmalization of their non ontext-freeness and mak e hop efully useful onsiderations ab out the p ro of onstru tion p ro ess and the omplexit y of the o rresp onding fo rmal and text p ro ofs; ◮ Develop a fo rmal p ro of of the fa t that the lass of the ontext-free languages is not losed under the interse tion op eration. F o r that, w e follo w the lassi al p ro of that uses a ounter-example, whi h in our ase is one of the languages p roved not to b e ontext-free in the p revious obje tive. Ma r us Ramos Some Appli ations Septemb er 26th, 2018 14 / 29

Recommend


More recommend