Processing math: 100%

0.Key Concept: Language§

So, a language is a sets of strings, in particular, some subset of the powerset of Σ.

Language Examples

Key Concept: Grammars

A tiny subset of the english language, not complete!
<sentence> <subject><verb><d.o.>
<subject> <noun> | <article><noun>
<verb> hit | ran | ate
<d.o.> <article><noun> | <noun>
<noun> Fritz | ball
<article> the | an | a

Variables vs. Terminals

Deriving a sentence

A variable in the grammar can be replaced by the right hand side of its rule:

Fritz hit the ball

<sentence> -> <subject><verb><d.o>
           -> <noun><verb><d.o>
           -> Fritz <verb><d.o.>
           -> Fritz hit <d.o.>
           -> Fritz hit <article><noun>
           -> Fritz hit the <noun>
           -> Fritz hit the ball

Can we derive these sentences? If not, can we change the grammar?:

The ball hit Fritz

The ball ate the ball

Formal definition of a grammar

A grammar G=(V,T,S,P) where
V is a finite set of variables (nonterminals).
T is a finite set of terminals (generally, these are strings).
S is the start variable (SV).
P is a set of productions (rules).

xy means to replace x by y.

Here, x(VT)+,y(VT).

Example

.

.

Grammar Notation

wz:w derives z
wz: derives in 0 or more steps
w+z: derives in 1 or more steps
Given grammar G=(V,T,S,P), define
L(G)={wTSw}
Example
G=({S},{a,b},S,P)
P={SaaS,Sb}
L(G)= ?

Another Grammar Example

G=({S,B},{a},S,P)
P={SaaB,BaaaaB}
L(G)= ?

Key Concept: Automata

Created with Raphaël 2.1.2
  1. a
  2. a
  3. b
  4. b
  5. a
  6. b
input tape
tape head
control unit
0
1
storage
(optional)

Numbers in control unit symbolize “states”, which are the specific positions on the dial that the arrow may point to.