Presentation.TOA.pptxjiihugydrawagkjiggkfgtsed

HassanShahg2 15 views 31 slides Oct 14, 2024
Slide 1
Slide 1 of 31
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31

About This Presentation

kdsjoifdaj;sljfddiScMOISE


Slide Content

Muhammad Bilal ADP-CS IV

Regular Language Non-regular Language Turing Machine Decidability

Regular Language: In the theory of automata and formal languages, a regular language is a type of language that can be recognized by a finite automation. Regular languages are one of the simplest and most well-defined classes of languages in formal language theory. These languages have a simple and regular structure that can be described by regular expressions or modeled by finite state machines.

Regular Expressions: A regular language can be described using regular expressions, which are patterns that specify sets of strings. Regular expressions provide a concise and expressive way to represent regular languages. Finite Automata: A regular language can be recognized by a finite automaton. A finite automaton is a mathematical model of computation with a finite set of states, transitions between states, and an input alphabet. It accepts or rejects strings based on its current state and the transitions defined in its transition function. A regular language can be defined in two ways:

Given Regular Expression is: R1=(0+1)* (00+11) Strings (00 , 11 , 011 , 100 , 1100 , 0011 , 0111 , 1000 ,---------) The set of all strings that can be generated by any regular expression is referred to as a regular language.

Non-Regular Languages Non-regular languages are those languages that cannot be recognized by finite automata. These languages have more complex structures that go beyond the capabilities of finite state machines.

Example Palindrome over {0, 1}: The language of palindromes over the alphabet {0, 1} is non-regular. Palindromes are strings that read the same forwards and backward, such as "010", "11", or "001100". The Dyck Language: A classic example of a non-regular language is the set of balanced parentheses, where each string consists of an equal number of left and right parentheses in the correct order. For example, the strings "()," "(())", and "((()))" are in the language, while "(()", and "()(" are not.

Turing Machine

Turing Machine A Turing machine is a theoretical mathematical model of computation introduced by Alan Turing in 1936. It serves as a foundational concept in the theory of computation and is used to understand the limits and capabilities of computing devices.

A Turing machine is formally defined by a 7-tuple (Q, Σ, Γ, δ, q₀, B, F), where : Q is a finite set of states. Σ is the input alphabet, which is a finite set of symbols that can appear on the machine's tape. Γ is the tape alphabet ( is commonly referred to as "Gamma" (Γ) ), which is also a finite set of symbols, including the blank symbol B.

δ is the transition function ; The transition function δ defines how the Turing machine moves between states based on the current state and the symbol it reads from the tape. q₀ is the initial state, where q₀ ∈ Q. B is the blank symbol, where B ∈ Γ and B is not in Σ. F is the set of final (or accepting) states, where F ⊆ Q.

The Turing machine operates as follows: 1. It starts in the initial state q₀ with the tape head positioned over the leftmost symbol of the input. 2. At each step, the machine reads the symbol under the tape head, consults the transition function δ, performs the specified actions, and transitions to a new state. 3. The computation continues until the machine enters a state in the set F, at which point it halts.

Turing machine for anbn | n ≥ 1;

Input is given in the TAPE as "aabb", "B" is BLANK symbol. R/W head will point to first "a" (from left) TM will mark first "a" with "X" (custom), and move to right, skipping all "a"s and will stop at first "b" TM will mark "b" with "Y" (custom) and move to left till it finds "X" and then stop at one step ahead at "a" Now we will explain the logic step by step:

TM will mark first "a" with "X", and move to right, skipping all "a"s and "Y"s and will stop at "b" TM will mark "b" with "Y" and move to left till it finds "X" and then after it there is "Y" that means all "a"s are finished TM will move to right to check whether all "b"s are finished. If R/W reaches "B"(BLANK) that means all "b"s are also finished. That means TM has acceted the language.

PROPERTIES OF TM Recognizability: A language is recognizable if a TM accepts when an input string is in the language,and either rejects or loops forever when an input string is not in the language. Decidability: A language is decidable if a TM accepts strings that are in the language and rejects that are not in the language. That is, TM will halt on all inputs. The Halting Problem is recognizable but undecidable.

Decidability:

Example Find all odd numbers in the range from 1-50 For this problem we can find easily solution by constructing an algorithm. In term of turing machine if a problem is decideable then the turing machine halts whether or not it accept its input.

Context-free grammar A context-free grammar (CFG) is a formal grammar in the field of formal language theory, which is a branch of theoretical computer science and mathematics. It is used to describe the syntax or structure of programming languages, natural languages, and other formal languages.

Emptiness Problem for CFLs: Problem: Given a context-free grammar G, is the language generated by G empty? Decidability: The emptiness problem for CFLs is decidable. There are algorithms, such as the CYK (Cocke-Younger-Kasami) algorithm, that can determine whether the language generated by a context-free grammar is empty.

Membership Problem for CFLs: Problem: Given a context-free grammar G and a string w, does w belong to the language generated by G? Decidability: The membership problem for CFLs is decidable. The CYK algorithm and the Earley parser are examples of algorithms that can determine membership in a context-free language.

Finiteness Problem for CFLs: Input: A context-free grammar G. Problem: Does the language generated by G contain only a finite number of distinct strings? Decidability: The finiteness problem for CFLs is undecidable, meaning that there is no algorithm that can always correctly determine whether a given context-free language generates only a finite number of strings.

Regular Expression R1 (0+1)* (00+11) Regular Expression R2 (0+1)*00 + (0+1)11

Yes, it is possible for two different regular expressions (R.Es) to define the same language. Two Regular expression are said to be equivalent if they generates the same language.
Tags