Top Banner
CSE-321 Programming Languages Inductive Definitions POSTECH March 15, 2006 박박박
32

CSE-321 Programming Languages Inductive Definitions POSTECH March 15, 2006 박성우.

Jan 03, 2016

Download

Documents

Barrie Norris
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: CSE-321 Programming Languages Inductive Definitions POSTECH March 15, 2006 박성우.

CSE-321 Programming Languages

Inductive Definitions

POSTECH

March 15, 2006

박성우

Page 2: CSE-321 Programming Languages Inductive Definitions POSTECH March 15, 2006 박성우.

2

Why Inductive Definitions?• Definition of SML

– finite in size

• SML programs– infinite in number

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

– We need inductive definitions.

Page 3: CSE-321 Programming Languages Inductive Definitions POSTECH March 15, 2006 박성우.

3

Outline• Inductive definitions of syntactic categories• Inductive definitions of judgments• Derivable rules and admissible rules• Inductive proofs

Page 4: CSE-321 Programming Languages Inductive Definitions POSTECH March 15, 2006 박성우.

4

Natural Numbers

Page 5: CSE-321 Programming Languages Inductive Definitions POSTECH March 15, 2006 박성우.

5

Natural Numbers - Examples

Page 6: CSE-321 Programming Languages Inductive Definitions POSTECH March 15, 2006 박성우.

6

Regular Binary Trees

Page 7: CSE-321 Programming Languages Inductive Definitions POSTECH March 15, 2006 박성우.

7

Mutual Induction

Page 8: CSE-321 Programming Languages Inductive Definitions POSTECH March 15, 2006 박성우.

8

Strings of Parentheses

Page 9: CSE-321 Programming Languages Inductive Definitions POSTECH March 15, 2006 박성우.

9

Outline• Inductive definitions of syntactic categories V• Inductive definitions of judgments• Derivable rules and admissible rules• Inductive proofs

Page 10: CSE-321 Programming Languages Inductive Definitions POSTECH March 15, 2006 박성우.

10

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."– "succ succ zero belongs to the syntactic

category nat."– ...

Page 11: CSE-321 Programming Languages Inductive Definitions POSTECH March 15, 2006 박성우.

11

Inference Rules

Page 12: CSE-321 Programming Languages Inductive Definitions POSTECH March 15, 2006 박성우.

12

Examples of Inference Rules

Page 13: CSE-321 Programming Languages Inductive Definitions POSTECH March 15, 2006 박성우.

13

Examples of Axioms

Page 14: CSE-321 Programming Languages Inductive Definitions POSTECH March 15, 2006 박성우.

14

Remember:• Judgments make sense only if there are

inference rules for proving or refuting them.

• Example:– Without arithmetic rules, what is the meaning of:

"1 - 1 is equal to 0"?

Page 15: CSE-321 Programming Languages Inductive Definitions POSTECH March 15, 2006 박성우.

15

Natural Numbers using Judgments

• Judgment

• Inference rules

Page 16: CSE-321 Programming Languages Inductive Definitions POSTECH March 15, 2006 박성우.

16

Metavariables

• is called a metavariable.– It is just a placeholder for a sequence of zero

and succ.– We are not talking about " nat."– We are talking about "succ succ zero nat."

Page 17: CSE-321 Programming Languages Inductive Definitions POSTECH March 15, 2006 박성우.

17

Derivation Tree

Page 18: CSE-321 Programming Languages Inductive Definitions POSTECH March 15, 2006 박성우.

18

Even and Odd Numbers

Page 19: CSE-321 Programming Languages Inductive Definitions POSTECH March 15, 2006 박성우.

19

Regular Binary Trees

Page 20: CSE-321 Programming Languages Inductive Definitions POSTECH March 15, 2006 박성우.

20

Full Regular Binary Trees

Page 21: CSE-321 Programming Languages Inductive Definitions POSTECH March 15, 2006 박성우.

21

A Full Regular Binary Tree

Page 22: CSE-321 Programming Languages Inductive Definitions POSTECH March 15, 2006 박성우.

22

Proof

Page 23: CSE-321 Programming Languages Inductive Definitions POSTECH March 15, 2006 박성우.

23

Outline• Inductive definitions of syntactic categories V• Inductive definitions of judgments V• Derivable rules and admissible rules• Inductive proofs

Page 24: CSE-321 Programming Languages Inductive Definitions POSTECH March 15, 2006 박성우.

24

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?

Page 25: CSE-321 Programming Languages Inductive Definitions POSTECH March 15, 2006 박성우.

25

• Inference rules

• A derivation tree

• May I use the following rule?

From a Derivation Tree

Page 26: CSE-321 Programming Languages Inductive Definitions POSTECH March 15, 2006 박성우.

26

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

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

Page 27: CSE-321 Programming Languages Inductive Definitions POSTECH March 15, 2006 박성우.

27

Is this rule derivable?

• No!– because the premise is always smaller than the

conclusion in the inference rules:

Page 28: CSE-321 Programming Languages Inductive Definitions POSTECH March 15, 2006 박성우.

28

But does this rule make sense?

• Yes!– because the only way to prove the premise is by

first proving the conclusion:

Page 29: CSE-321 Programming Languages Inductive Definitions POSTECH March 15, 2006 박성우.

29

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

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

if the system does not change.

Page 30: CSE-321 Programming Languages Inductive Definitions POSTECH March 15, 2006 박성우.

30

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

Page 31: CSE-321 Programming Languages Inductive Definitions POSTECH March 15, 2006 박성우.

31

• 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

Page 32: CSE-321 Programming Languages Inductive Definitions POSTECH March 15, 2006 박성우.

32

Homework 1• Good News

– Everyone did a great job!– Solution and statistics will be uploaded today.

• Bad News– Everyone did such a wonderful job that

Assignment 2 will be out tonight.

– Assignment 2 will be due next Monday.

• Good or Bad News– Assignment 2 will be as much fun.– Many problems require a bit/lot of thinking:

• tail recursion• structures and signatures• functional objects