formal languages
play

Formal Languages Philippe de Groote 2018-2019 Philippe de Groote - PowerPoint PPT Presentation

Formal Languages Philippe de Groote 2018-2019 Philippe de Groote Formal Languages 2018-2019 1 / 12 Outline Phrase Structure Grammars 1 Introduction Alphabets, words, and languages Definition of a phrase structure grammar Chomsky


  1. Formal Languages Philippe de Groote 2018-2019 Philippe de Groote Formal Languages 2018-2019 1 / 12

  2. Outline Phrase Structure Grammars 1 Introduction Alphabets, words, and languages Definition of a phrase structure grammar Chomsky hierarchy Decision problems Exercices Philippe de Groote Formal Languages 2018-2019 2 / 12

  3. Phrase Structure Grammars Introduction Introduction If the quorum is not met, the president may convene a new meeting. Philippe de Groote Formal Languages 2018-2019 3 / 12

  4. Phrase Structure Grammars Introduction Introduction If the quorum is not met, the president may convene a new meeting. S SBAR NP VP DT NN MD VP IN S the president may If VB NP NP VP convene DT JJ NN DT NN VBZ RB VP a new meeting the quorum is not VBN met Philippe de Groote Formal Languages 2018-2019 3 / 12

  5. Phrase Structure Grammars Introduction Introduction S → NP VP S → SBAR NP VP SBAR → IN S VP → VBN VP → VB NP VP → MD VP VP → VBZ RB VP NP → DT NN NP → DT JJ NN VB → convene VBN → met VBZ → is MD → may NN → quorum | president | meeting JJ → new DT → the | a IN → if RB → not Philippe de Groote Formal Languages 2018-2019 4 / 12

  6. Phrase Structure Grammars Alphabets, words, and languages Alphabets, words, and languages An alphabet is a finite, non-empty set of symbols. Philippe de Groote Formal Languages 2018-2019 5 / 12

  7. Phrase Structure Grammars Alphabets, words, and languages Alphabets, words, and languages An alphabet is a finite, non-empty set of symbols. A word is a finite sequence of symbols chosen from some given alphabet. Philippe de Groote Formal Languages 2018-2019 5 / 12

  8. Phrase Structure Grammars Alphabets, words, and languages Alphabets, words, and languages An alphabet is a finite, non-empty set of symbols. A word is a finite sequence of symbols chosen from some given alphabet. The empty word , denoted ǫ , is the empty sequence of symbols. Philippe de Groote Formal Languages 2018-2019 5 / 12

  9. Phrase Structure Grammars Alphabets, words, and languages Alphabets, words, and languages An alphabet is a finite, non-empty set of symbols. A word is a finite sequence of symbols chosen from some given alphabet. The empty word , denoted ǫ , is the empty sequence of symbols. Let Σ be an alphabet. Σ ∗ denotes the set of all words over Σ . Philippe de Groote Formal Languages 2018-2019 5 / 12

  10. Phrase Structure Grammars Alphabets, words, and languages Alphabets, words, and languages An alphabet is a finite, non-empty set of symbols. A word is a finite sequence of symbols chosen from some given alphabet. The empty word , denoted ǫ , is the empty sequence of symbols. Let Σ be an alphabet. Σ ∗ denotes the set of all words over Σ . Let α ∈ Σ ∗ be such that α = a 1 . . . a n , with a i ∈ Σ for 1 ≤ i ≤ n . The length of α , in notation | α | , is the number of occurrences of symbols in α , i.e., | α | = n . Philippe de Groote Formal Languages 2018-2019 5 / 12

  11. Phrase Structure Grammars Alphabets, words, and languages Alphabets, words, and languages An alphabet is a finite, non-empty set of symbols. A word is a finite sequence of symbols chosen from some given alphabet. The empty word , denoted ǫ , is the empty sequence of symbols. Let Σ be an alphabet. Σ ∗ denotes the set of all words over Σ . Let α ∈ Σ ∗ be such that α = a 1 . . . a n , with a i ∈ Σ for 1 ≤ i ≤ n . The length of α , in notation | α | , is the number of occurrences of symbols in α , i.e., | α | = n . In particular, | ǫ | = 0 . Philippe de Groote Formal Languages 2018-2019 5 / 12

  12. Phrase Structure Grammars Alphabets, words, and languages Alphabets, words, and languages Let α, β ∈ Σ ∗ be such that α = a 1 . . . a n , with a i ∈ Σ for 1 ≤ i ≤ n , and β = b 1 . . . b m , with b i ∈ Σ for 1 ≤ i ≤ m . α · β is defined to be the concatenation of α and β , i.e., α · β = a 1 . . . a n b 1 . . . b m . Philippe de Groote Formal Languages 2018-2019 6 / 12

  13. Phrase Structure Grammars Alphabets, words, and languages Alphabets, words, and languages Let α, β ∈ Σ ∗ be such that α = a 1 . . . a n , with a i ∈ Σ for 1 ≤ i ≤ n , and β = b 1 . . . b m , with b i ∈ Σ for 1 ≤ i ≤ m . α · β is defined to be the concatenation of α and β , i.e., α · β = a 1 . . . a n b 1 . . . b m . In particular, ǫ · α = α = α · ǫ . Philippe de Groote Formal Languages 2018-2019 6 / 12

  14. Phrase Structure Grammars Alphabets, words, and languages Alphabets, words, and languages Let α, β ∈ Σ ∗ be such that α = a 1 . . . a n , with a i ∈ Σ for 1 ≤ i ≤ n , and β = b 1 . . . b m , with b i ∈ Σ for 1 ≤ i ≤ m . α · β is defined to be the concatenation of α and β , i.e., α · β = a 1 . . . a n b 1 . . . b m . In particular, ǫ · α = α = α · ǫ . � Σ ∗ , · , ǫ � is a monoid. Philippe de Groote Formal Languages 2018-2019 6 / 12

  15. Phrase Structure Grammars Alphabets, words, and languages Alphabets, words, and languages Let α, β ∈ Σ ∗ be such that α = a 1 . . . a n , with a i ∈ Σ for 1 ≤ i ≤ n , and β = b 1 . . . b m , with b i ∈ Σ for 1 ≤ i ≤ m . α · β is defined to be the concatenation of α and β , i.e., α · β = a 1 . . . a n b 1 . . . b m . In particular, ǫ · α = α = α · ǫ . � Σ ∗ , · , ǫ � is a monoid. A language over Σ is a subset of Σ ∗ . Philippe de Groote Formal Languages 2018-2019 6 / 12

  16. Phrase Structure Grammars Alphabets, words, and languages Alphabets, words, and languages Operation on languages: Philippe de Groote Formal Languages 2018-2019 7 / 12

  17. Phrase Structure Grammars Alphabets, words, and languages Alphabets, words, and languages Operation on languages: Usual set-theoretic operations: union, intersection, complement (w.r.t. Σ ∗ ), ... Philippe de Groote Formal Languages 2018-2019 7 / 12

  18. Phrase Structure Grammars Alphabets, words, and languages Alphabets, words, and languages Operation on languages: Usual set-theoretic operations: union, intersection, complement (w.r.t. Σ ∗ ), ... Concatenation : L 1 · L 2 = { ω : ∃ α ∈ L 1 . ∃ β ∈ L 2 .ω = α · β } Philippe de Groote Formal Languages 2018-2019 7 / 12

  19. Phrase Structure Grammars Alphabets, words, and languages Alphabets, words, and languages Operation on languages: Usual set-theoretic operations: union, intersection, complement (w.r.t. Σ ∗ ), ... Concatenation : L 1 · L 2 = { ω : ∃ α ∈ L 1 . ∃ β ∈ L 2 .ω = α · β } Exponentiation : L 0 = { ǫ } L n +1 = L · L n Philippe de Groote Formal Languages 2018-2019 7 / 12

  20. Phrase Structure Grammars Alphabets, words, and languages Alphabets, words, and languages Operation on languages: Usual set-theoretic operations: union, intersection, complement (w.r.t. Σ ∗ ), ... Concatenation : L 1 · L 2 = { ω : ∃ α ∈ L 1 . ∃ β ∈ L 2 .ω = α · β } Exponentiation : L 0 = { ǫ } L n +1 = L · L n Closure : L ∗ = � L i i ∈ N Philippe de Groote Formal Languages 2018-2019 7 / 12

  21. Phrase Structure Grammars Definition of a phrase structure grammar Definition of a phrase structure grammar A phrase structure grammar is a 4-tuple G = � N, Σ , P, S � , where N is an alphabet, the elements of which are called non-terminal symbols ; Σ is an alphabet disjoint from N , the elements of which are called terminal symbols ; P ⊂ (( N ∪ Σ) ∗ N ( N ∪ Σ) ∗ ) × ( N ∪ Σ) ∗ is a set of production rules ; S ∈ N is called the start symbol . Philippe de Groote Formal Languages 2018-2019 8 / 12

  22. Phrase Structure Grammars Definition of a phrase structure grammar Definition of a phrase structure grammar A phrase structure grammar is a 4-tuple G = � N, Σ , P, S � , where N is an alphabet, the elements of which are called non-terminal symbols ; Σ is an alphabet disjoint from N , the elements of which are called terminal symbols ; P ⊂ (( N ∪ Σ) ∗ N ( N ∪ Σ) ∗ ) × ( N ∪ Σ) ∗ is a set of production rules ; S ∈ N is called the start symbol . A production rule ( α, β ) ∈ P will be written as α → β . Philippe de Groote Formal Languages 2018-2019 8 / 12

  23. Phrase Structure Grammars Definition of a phrase structure grammar Definition of a phrase structure grammar Let G = � N, Σ , P, S � be a phrase structure grammar, and let α, β ∈ ( N ∪ Σ) ∗ . We say that α directly generates β , and we write α ⇒ β , if and only if there exist α 0 , β 0 , γ, δ ∈ ( N ∪ Σ) ∗ such that: α = γα 0 δ and β = γβ 0 δ and ( α 0 → β 0 ) ∈ P Philippe de Groote Formal Languages 2018-2019 9 / 12

  24. Phrase Structure Grammars Definition of a phrase structure grammar Definition of a phrase structure grammar Let G = � N, Σ , P, S � be a phrase structure grammar, and let α, β ∈ ( N ∪ Σ) ∗ . We say that α directly generates β , and we write α ⇒ β , if and only if there exist α 0 , β 0 , γ, δ ∈ ( N ∪ Σ) ∗ such that: α = γα 0 δ and β = γβ 0 δ and ( α 0 → β 0 ) ∈ P We write ⇒ ∗ for the reflexive-transitive closure of ⇒ . Philippe de Groote Formal Languages 2018-2019 9 / 12

Recommend


More recommend