1. Trang chủ
  2. » Kỹ Năng Mềm

Automata and Formal language docx

34 575 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Automata and Formal Language
Người hướng dẫn TS. Huỳnh Trung Hiếu
Trường học Ho Chi Minh City University of Industry
Chuyên ngành Information Technology
Thể loại Lecture Notes
Thành phố Ho Chi Minh City
Định dạng
Số trang 34
Dung lượng 209 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Formal Languages & Automata A formal language:  Is an abstraction of the general characteristics of programming languages.. Formal Languages & Automata An automaton:  Is a construction

Trang 1

Automata and formal language

Dr Huỳnh Trung Hiếu Faculty of Information Technology HoChiMinh City University of Industry

Trang 3

Formal Languages & Automata

A formal language:

 Is an abstraction of the general characteristics of programming languages.

 Consists of a set of symbols and some formation rules by which these symbols can be

combined into sentences

Trang 4

Formal Languages & Automata

An automaton:

 Is a construction that possesses all the indispensable features of a digital computer.

 Accepts input, produces output, may have some temporary storage, and can make

decisions in transforming the input into the output

Trang 6

 Introduction to automata theory, languages, and computation.

John Hopcroft & Jeffrey Ullman

Trang 7

Mục tiêu môn học

 Xây dựng mô hình trừu tượng cho máy tính.

 Lý thuyết cung cấp cho chúng ta những khái niệm giúp ta đi đến những ứng dụng như :

 Thiết kế kỹ thuật số.

 Ngôn ngữ lập trình.

 Trình biên dịch.

 Nhận dạng ngôn ngữ,….

Trang 8

Nội dung môn học

 Phần 3: Ngôn ngữ và văn phạm chính quy.

Trang 9

GiỚI THIỆU KHÁI NiỆM, DẪN NHẬP

Trang 11

Languages

 Là một hệ thống thích hợp nhằm để diễn tả những ý kiến, sự kiện, khái niệm chắc

chắn Chúng bao gồm tập hợp các ký hiệu và quy luật

Trang 14

Languages

 Example 1:

Σ = {a, b}

Σ* = {λ, a, b, aa, ab, ba, aaa, }

L1 = {a, aa, aab} (finite language)

L2 = {anbn | n ≥ 0} = {λ, ab, aabb, }

Các chuỗi aabb, aaaabbbb là các từ trên ngôn ngữ L2, nhưng chuỗi abb thì không.

Trang 18

<noun> → boy | dog

<verb> → runs | walks

khi đó ta có những câu như: "a boy runs" và "the dog walks" là có

"dạng đúng" có nghĩa là được sinh

ra từ văn phạm trên

Trang 19

Grammars

 Formal grammar:

G = (V, T, S, P) V: finite set of variables (tập biến)

T: finite set of terminal symbols (tập ký hiệu kết thúc)

S ∈ V: start variable (tập biến bắt đầu)

P: finite set of productions (luật sinh)

Trang 21

Grammars

 Generated language:

Cho G = (V, T, S, P) là 1 văn phạm thì tập:

L(G) = {w∈T* | S ⇒* w} là ngôn ngữ được sinh ra bởi G

 Derivation: nếu w∈L(G) thì tồn tại dẫn xuất:

S ⇒ w1 ⇒ w2 ⇒ ⇒ wn ⇒ w

 Sentential forms: S, w1, w2, , wn (containing variables)

Trang 22

Grammars

 Example 3:

G = ({S}, {a, b}, S, P)P: S → aSb

S → λ

S ⇒ aSb ⇒ aaSbb ⇒ aabb

aabb: sentence aaSbb: sentential form

Trang 23

Grammars

 Example 3:

G = ({S}, {a, b}, S, P)P: S → aSb

S → λ

L(G) = {anbn | n ≥ 0}

Trang 25

Grammars

 Example 4:

G1 = ({A, S}, {a, b}, S, P1)P1: S → aAb | λ

A → aAb | λ

L(G1) = {anbn | n ≥ 0}

G and G1 are equivalent

Trang 26

 Để chỉ ra một ngôn ngữ L được sinh ra bởi một văn phạm G Chúng ta cần chỉ ra:

a) mỗi w ∈ L được dẫn ra từ S bằng các luật sinh của văn phạm G.

b) mỗi w như ở (a) phải thuộc L.

Trang 27

A → aAb

A → λ

Trang 28

Grammars

 Example 5:

G2 = ({S}, {a, b}, S, P2)P2: S → SS

S → λ

S → aSb

S → bSa

=>L(G2) = {w | na(w) = nb(w)}

Trang 29

Automata

An abstract model of digital computer:

Control unit Input file

Output

Storage

Trang 30

Automata

Input file: is divided into squares

 Input is a string over a given alphabet.

 Each input square holds a symbol.

 The symbols are read from left to right, one at a time.

 The end of the input string can be detected.

Trang 31

Automata

Storage: consists of an unlimited number of cells

 Each cell can hold a symbol from an alphabet (which can be different from the input

alphabet)

 The contents of the storage cells can be read and changed.

Trang 32

Automata

Control unit: has a finite number of internal states

 Can be in any one of the internal states.

 Can change state in some defined manner.

Trang 33

Automata

 Transition function:

current state × input symbol × storage info → next state

Output may be produced Info in the storage may be changed

 Configuration: current state × input symbol × storage info

 Move: current configuration → next configuration

Trang 34

Transducer: string of symbols as output

Ngày đăng: 11/07/2014, 19:20

TỪ KHÓA LIÊN QUAN

w