inductive definitions kangwon national university 임현승 programming languages these slides were...

Post on 18-Jan-2018

220 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

3 Outline Inductive Definitions of Syntactic Categories Judgments and Inference Rules Derivable Rules and Admissible Rules

TRANSCRIPT

Inductive Definitions

Kangwon National University

임현승

Programming Languages

These slides were originally created by Prof. Sungwoo Park at POSTECH.

2

Why Inductive Definitions?• Definition of Ocaml

– finite in size• Ocaml programs

– infinite in number

• We need a mechanism by which a finite description of OCaml produces infinitely many OCaml programs.

– We need inductive definitions.

3

Outline• Inductive Definitions of Syntactic Categories• Judgments and Inference Rules• Derivable Rules and Admissible Rules

4

Natural Numbers

5

Natural Numbers - Examples

6

Regular Binary Trees

7

Mutual Induction

8

Strings of Parentheses

9

Strings of Matched Parentheses

10

Strings of Matched Parentheses

11

Strings of Parentheses

12

Outline• Inductive Definitions of Syntactic Categories• Judgments and Inference Rules• Derivable Rules and Admissible Rules

13

Judgments• An object of knowledge that may or may not be

provable.• Examples

– "1 - 1 is equal to 0."– "1 + 1 is equal to 0."– "It is raining."– "S S O belongs to the syntactic category nat."– ...

14

Question• "1 - 1 is equal to 0" is a judgment.

• What is the meaning of "1 - 1 is equal to 0"without arithmetic rules?

• Judgments make sense only if there are inference rules for proving or refuting them.

15

Inference Rules

16

Examples of Inference Rules

17

Examples of Axioms

18

Natural Numbers using Judgments• Judgment

• Inference rules

19

Metavariables

• is called a metavariable.– It is just a placeholder for a sequence of O and S.– We are not talking about " nat."– We are talking about "S S O nat."

20

Derivation Tree

21

Even and Odd Numbers

22

Regular Binary Trees

Full Regular Binary Trees• Also known as perfect binary trees

23

24

A Full Regular Binary Tree

25

Outline• Inductive Definitions of Syntactic Categories• Judgments and Inference Rules• Derivable Rules and Admissible Rules

26

Question• We know arithmetic rules.

• But do we use arithmetic rules to calculate 4 * 9?– Why not just use 4 * 9 = 36 from the multiplication

table?

27

• Inference rules

• A derivation tree

• May I use the following rule?

From a Derivation Tree

28

Derivable Rule• There is a derivation tree from the premises to the

conclusion.• May be used as if it was an original inference rule.

29

Is this rule derivable?

• No!– no derivation tree like

30

But does this rule make sense?

• Yes!

31

Admissible Rules• There is a proof that the premise implies the

conclusion.• May be used as if it was an original inference rule

if the system does not change.

32

Derivable Rules vs. Admissible Rules• Which is stronger?

– A derivable rule is an admissible rule?• Yes• No

– An admissible rule is a derivable rule?• Yes• No

33

• A derivable rule remains valid no matter what.• An admissible rule may be invalidated

when a new inference rule is introduced.

• Now is the rule below still admissible?

Derivable Rules vs. Admissible Rules

top related