Sunteți pe pagina 1din 10

FAFL ASSIGNMENT

NAME : PRABHAKAR GOUDA ASSIGNMENT NO : 04,05,06


ROLL NO : 35 WEEK NO : 02
SEM : V CS&E SECTION : B

1
Contents
1 Formal languages 2
1.0.1 For the English Language: . . . . . . . . . . . . . . . . 2
1.1 Finite-state grammars . . . . . . . . . . . . . . . . . . . . . . 3
1.2 The general form of finite state grammars . . . . . . . . . . . 3
1.3 The Chomsky Hierarchy . . . . . . . . . . . . . . . . . . . . . 4

2 DIFFERENT PROVING TECHNIQUES 6


2.1 Mathematical Induction . . . . . . . . . . . . . . . . . . . . . 6
2.1.1 Description . . . . . . . . . . . . . . . . . . . . . . . . 6

3 Contradiction 7
3.1 Example: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

4 Deduction 8
4.1 Deduction Logic . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Formalization of a natural languages using formal structure

1 Formal languages
In formal language theory, a language is a set of strings. A string is just a
sequence of

symbols chosen from an agreed-upon set of symbols, called the vocabulary


or lexicon.

1.0.1 For the English Language:


• Any sequence of English words from the Oxford English Dictionary like
what a language!, let things wont change are examples whereas I go awbe oij
ahq will not make English a formal language.

•million bs is an example whereas bcacc, the zero-length string epsilon.

•Strings over {a, b, c} starting with a like abbb, a, a followed by a Strings


over {a, b, c, d} in alphabetical order like abd, ad, bcd, b, abcd are examples
whereas dbcd, ba.

2
All the examples are defined with rules given before each example.
The idea of generative grammar is to use grammars to define a set that closely
resembles
a natural language for instance, all and only the acceptable English sen-
tences. However,
not all sets are definable by all types of grammars. We require a set of rules
to accurately describe a natural language.

1.1 Finite-state grammars


To define (generate) strings over {a, b, c, d} in alphabetical order, let S be
the start symbol
of the grammar.
S → a S1
S → b S2
S → c S3
S→d
S1 → b S2
S1 → c S3
S1 → d
S2 → c S3
S2 → d
S3 → d

Grammar has a corresponding finite state machine that recognizes all and
only the sentences it generates.

1.2 The general form of finite state grammars


Any grammar having only rules of the form A ! bC where A,B are nontermi-
nals and b is
a terminal has a corresponding finite state machine. Given a string, if a path
can be found through the machine, the string is generated by the grammar
and vice versa. There are some languages that cannot be recognized by finite
state machines.
Sequence of as followed by an equal number of bs like ab, aabb, aaabbb,
. . . is an example whereas aabbb, aaaaaaaaaaaabbb do not form the grammer
as per the rule.

3
Call the number of as in the sentence being analyzed n. A finite state
machine would need to remember this number n while waiting for the end
of the bs. But, by definition, a finite state machine will only have enough
states to remember some fixed number of as. Hence there exists neither a
finite-state grammar nor a finite state machine for the language an bn .
English is just like an bn
Consider
a. The cat died.
b. The cat the dog chased died.
c. The cat the dog the rat bit chased died.
d. The cat the dog the rat the elephant admired bit chased died
...
f A = {the cat, the dog, the rat, the elephant, the kangaroo, . . .} and
B = {chased, bit, admired, ate, befriended, . . .} its clear that it has the
structure an bn died.

Chomsky and Miller (1963) argued that the obligatory paired dependen-
cies presented by either. . .or, if. . .then or the agreement between verbs and
subjects can nest inside one another to an arbitrary depth.

The following grammar does not generate the language anbn. It is a


context-free grammar, and as such is capable of deriving any number of
center-embeddings.
S→ab
S→aSb

1.3 The Chomsky Hierarchy


Let A,B be nonterminals, b a terminal, alpha nonempty sequence of either
kind of symbol, and , γ, δ possibly empty sequences of either kind of symbol.
The Chomsky Hierarchy is a classification of languages in a subset relation-
ship. Each language has corresponding class of machine that recognizes it.

language attribute rule type machine


finite-state A →bC finite state machine
context-free A→α push down automata
context-sensitive γ A δ → γαδ linear bounded
automation unrestricted no restrictin Turing machine

4
The cardinality of the set of languages definable by a grammar formalism
is called its generative capacity.
Natural languages are believed to reside somewhere between context-free and
context-sensitive.

5
2 DIFFERENT PROVING TECHNIQUES
2.1 Mathematical Induction
Mathematical induction is a method of mathematical proof typically used to
establish that a given statement is true of all natural numbers. It is done
by proving that the first statement in the infinite sequence of statements is
true, and then proving that if any one statement in the infinite sequence of
statements is true, then so is the next one.
The method can be extended to prove statements about more general
well-founded structures, such as trees; this generalization, known as struc-
tural induction, is used in mathematical logic and computer science. Math-
ematical induction in this extended sense is closely related to recursion.

2.1.1 Description
Description
The simplest and most common form of mathematical induction proves
that a statement involving a natural number n holds for all values of n. The
proof consists of two steps:
1. The basis (base case): showing that the statement holds when n = 0
or n = 1.
2. The inductive step: showing that if the statement holds for some n, then
the statement also holds when n + 1 is substituted for n.
The assumption in the inductive step that the statement holds for some
n is called the induction hypothesis (or inductive hypothesis). To perform
the inductive step, one assumes the induction hypothesis and then uses this
assumption to prove the statement for n + 1.
The description above of the basis applies when 0 is considered a natural
number, as is common in the fields of combinatorics and mathematical logic.
If, on the other hand, 1 is taken to be the first natural number, then the base
case is given by n = 1.
This method works by first proving the statement is true for a starting
value, and then proving that the process used to go from one value to the
next is valid. If these are both proven, then any value can be obtained by
performing the process repeatedly. It may be helpful to think of the domino
effect; if one is presented with a long row of dominoes standing on end, one
can be sure that:
1. The first domino will fall
2. Whenever a domino falls, its next neighbor will also fall,

6
so it is concluded that all of the dominoes will fall, and that this fact is
inevitable.
Another analogy can be to consider a set of identical lily pads, all equally
spaced in a line across a pond, with the first and last lily pads adjacent to
the two sides of the pond. If a frog wishes to traverse the pond, he must:
1. Determine if the first lily pad will hold his weight.
2. Prove that he can jump from one lily pad to another.
Thus, he can conclude that he can jump to all of the lily pads, however
many lily pads there are, and cross the pond.

3 Contradiction
In logic, proof by contradiction is a form of proof that establishes the truth
or validity of a proposition by showing that the premise that the proposition
is false implies a contradiction. Since by the law of bivalence a proposition
must be either true or false, and its falsity has been shown impossible, the
proposition must be true.
In other words, to prove by contradiction that P, show that ¬ P ⇒⊥ or
its equivalent ¬ P ⇒ (Q ∧ ¬ Q). Then, since ¬ P implies a contradiction,
conclude P.
Proof by contradiction is also known as indirect proof, apagogical argu-
ment, reductio ad impossibile, or reductio ad absurdum.
In a proof by contradiction we assume, along with the hypotheses, the
logical negation of the result we wish to prove, and then reach some kind of
contradiction. That is, if we want to prove ”If P, Then Q”, we assume P and
Not Q. The contradiction we arrive at could be some conclusion contradicting
one of our assumptions, or something obviously untrue like 1 = 0.

3.1 Example:
A classic proof by contradiction from Greek mathematics is the proof that
the square root of 2 is irrational. If it were rational, it could be expressed
as a fraction a/b in lowest terms,
√ where a and b are integers, at least one of
which is odd. But if a/b = 2, then a2 = 2b2 . Therefore a2 must be even.
Because the square of an odd number is odd, that in turn implies that a is
even. This means that b must be odd because a/b is in lowest terms.
On the other hand, if a is even, then a2 is a multiple of 4. If a2 is a
multiple of 4 and a2 = 2b2 , then 2b2 is a multiple of 4, and therefore b2 is
even, and so is b.

7
So√b is odd and even, a contradiction. Therefore the initial assumption-
that 2 can be expressed as a fractionmust be false. One of the first proofs
by contradiction is the following gem attributed to Euclid.
Theorem. There are infinitely many prime numbers.
Proof. Assume to the contrary that there are only finitely many prime
numbers, and all of them are listed as follows:
p1, p2 ..., pn. Consider the number q = p1p2... pn + 1.The number q is
either prime or composite. If we divided any of the listed primes pi into q,
there would result a remainder of 1 for each i = 1, 2, ..., n. Thus, q cannot
be composite. We conclude that q is a prime number, not among the primes
listed above, contradicting our assumption that all primes are in the list p1,
p2 ..., pn. Proof by contradiction is often used when you wish to prove
the impossibility of something. You assume it is possible, and then reach a
contradiction.

4 Deduction
In logic, natural deduction is an approach to proof theory that attempts to
provide a deductive system which is a formal model of logical reasoning as it
”naturally” occurs. This approach is in contrast to axiomatic systems which
use axioms.

4.1 Deduction Logic


The nine primitive rules

1. The Rule of Assumption (A)

2. Modus Ponendo Ponens (MPP)

3. The Rule of Double Negation (DN)

4. The Rule of Conditional Proof (CP)

5. The Rule of -introduction (I)

6. The Rule of -elimination (E)

7. The Rule of -introduction (I)

8
8. The Rule of -elimination (E)

9. Reductio Ad Absurdum (RAA)

In system L, a proof has a definition with the following conditions:


1. has a finite sequence of well-formed formulas (or wffs)
2. each line of it is justified by a rule of the system L
3. the last line of the proof is what is intended, and this last line of the proof
uses only the premises which were given, if any.
An example of the proof of a sequent
p → q, ¬q ` ¬p [Modus Tollendo Tollens (MTT)]

Assumption number Line number Formula (wff) Lines in-use and Justification
1 (1) (p→q) A
2 (2) ¬q A
3 (3) p A(For RAA)
1,3 (4) q 1,3,MPP
1,2,3 (5) q∧ ¬q 2,4
1,2 (6) ¬p 3,5,RAA
Q.E.D
A deduction (or proof) can be defined precisely in the context of a formal
system like the propositional calculus. A proposition is deduced from a
collection of premises by applying inference rules repeatedly (see above sec-
tion). The deduction is a record of this repeated application of inference
rules.

9
REAL LIFE EXAMPLE OF FINITE AUTOMATA:
ATM WORKING SYSTEM Conside the following:
P
A={Q, ,δ,q0,F}
Q:set of states
for ATM system
Q={ATM,server1,ask PIN,amount,rejectserver2,abort,give amount,done}
P
:set of inputs
P
=card,check valid,ok,verify PIN,PIN ok,invalid,request balance,bal amount,deduct
amount,deduct failed,deducted,End}
q0:initial state
q0=ATM
F:final state
F=Done

Figure 1: DFA

10

S-ar putea să vă placă și