FORMAL LANGUAGES Lesson 1

advertisement
FORMAL LANGUAGES
(in Automata Theory)
BASIC OF LANGUAGES
BASIC OF LANGUAGES
What is a language ?
minds
symbolize
refers to
External
world
language
stand for
The meaning triangle:
BASIC OF LANGUAGES
Different levels of language analysis
• phonetic and phonological analysis
• determine how words are related to sounds that realize them;
required for speech understanding.
• morphological analysis:
• determine how words are formed from more basic meaning units
called "morphemes".
• morpheme: primitive unit of meaning in a language.
• eg: friendly = friend + ly; luckily = lucky + ly
• syntax analysis:
• determine how words can be put together to form correct
sentences
• determine what structure role each word plays in the sentence
• determine what phrases are subparts of what other parts.
BASIC OF LANGUAGES
Levels of Language Analysis
• Semantics analysis :
• determine what words mean and how these meanings combine in
sentence to form sentence meanings.
• context independent.
• Pragmatic analysis:
• concern how sentences are used in different situation and how use
affects the interpretation of sentences.
• Discourse analysis,...
• World knowledge,...
• Languages (including natural and programming languages) contains
many facets, each an active research domain of AI, linguistics,
psychology, philosophy, cognitive science and mathematics.
BASIC OF LANGUAGES
Two Types of Languages
1. Formal Languages (also known as Syntactic languages)
The formal language is strict with their rules. In formal language
letters join with each other to make the words and this process is
properly well-formed and following the international standards of
the given language and it must be according to a specific set of
rules provided by the language.
BASIC OF LANGUAGES
Two Types of Languages
2. Informal Languages (also known as Semantic languages)
The informal language is not strict with their rules.
BASIC OF LANGUAGES
Comparison of Formal and Informal Languages
Formal languages
Informal languages
Hello, How are you?
Helo, hw r u?
My Message Package is finished.
My Msg Pckg is finished.
He is my brother.
He is my bro.
FORMAL LANGUAGES
FORMAL LANGUAGES
What are Formal Languages
• In the study of formal languages we care only the well-formedness (or
more abstractly the membership of), but not the meaning of
sentences, in a language.
Ex1: Our usual decimal language of positive numbers ?
• Prob: Which of the following are well-formed [representation of]
numbers:
(1) 128 (2) 0023
(3) 44ac (4) 3327
• Let L be the set of all well-formed [representations of ] numbers.
==> 123, 3327 in L but 0023, 44ac not in L.
• So according to the view of FL, The usual decimal language of
positive numbers (i.e., L) is just the set { x | x is a finite sequence of
digits w/t leading zeros }.
• Note: FL don't care that string '134' corresponds to the (abstract) positive number
whose binary rep. is 10000000
FORMAL LANGUAGES
Symbols
• Is a unique character
A character could be
• the letter in the alphabet a,b,c,….z (so each letter is considered
as a character, each character is a symbol)
• the digit in the decimal value 0,1,2,…9 (each digit is a
character, so each digit is a symbol
• Other special character such as +, -, %, <space>,… (each
special character is a symbol)
FORMAL LANGUAGES
Alphabets in Automata
• Alphabets are the finite non-empty set of symbols or characters.
Alphabets can be denoted by the symbol of the Greek letter sigma
(Σ).
Examples of alphabets in Automata
• Σ = {a,b,c,d,…. z}
• Σ = {X,Y}
• Σ = {0,1,2,3,….9}
• Σ = {0,1}
• Alphabets can includes letters, digits and a variety of operators.
FORMAL LANGUAGES
Alphabets in Automata
• An alphabet S (or vocabulary) is a finite set of distinct symbols.
Examples
• Digit in the Decimal Number = {0,1,2,3,4,5,6,7,8,9}
• binary_digit = {0,1}
• Hexidecimal-alphabet = {0,..,9,A,..,F}
• Letters in the English Alphabet = {a,...,z,A,...,Z}
• Arithmetic operators = {+, -, *, /, %, (, )}
• Elements of an alphabet are called letters or characters or symbols
FORMAL LANGUAGES
String (or Word) in Automata
• A string (or word or sentence) over S is a finite sequence of elements
of S.
• Strings are the Single character or the combination of a finite number
of characters from the alphabet.
Example:
• If S = {x,y} then x, xyxy, xxxyy, xyxyxyxyx, xyxyxyxyxyxyxyxyxy are strings over
the S.
• String is finite set sequence of symbols chosen from the alphabet S
FORMAL LANGUAGES
String (or Word) in Automata
What is Empty string or null string?
• Empty string or null string is the strings with no symbols or strings. The null
string can be denoted with a Small Greek letter Lambda (λ) or
sometimes people love to represent it with Capital Greek letter
Lambda Λ.
What are Words in Automata
• Words are the strings belonging to some language.
• Example of words in Automata
• If Σ= {x} then a language can be defined as
Language ={xn : n=1,2,3,…..} or Language ={x,xx,xxx,….}
Here x, xx,… are the words of the language.
FORMAL LANGUAGES
Length of Strings
• The length of string, denoted by |s|, is the number of symbols
(characters or letters) in the string.
Examples:
#
Alphabet S
String s
Length of
string
1
2
3
Σ={a,b}
Σ={a, b, c, d, e , f}
Σ={a, b, c, d, e , f, g, h, I, j, k , l, m}
s = ababaab
s = ababaabdef
s =ababaabdefj
|s|= 7
|s|= 10
|s|= 11
FORMAL LANGUAGES
Symbol  alphabet  string/word
REFERENCES
https://t4tutorials.com/alphabets-strings-words-examples-in-theory-of-automata-tafl/
https://www.youtube.com/watch?v=jQRUkXhwHa4&list=PLrjkTql3jnm_TWSXXvWX1_jXL6f1QJSx&index=2
PPT on Formal Language and Automata Theory by Cheng-Chia Chen (September 2007)
Download