CSE321 Programming Languages Inductive Definitions POSTECH March 14

  • Slides: 31
Download presentation
CSE-321 Programming Languages Inductive Definitions 박성우 POSTECH March 14, 2007

CSE-321 Programming Languages Inductive Definitions 박성우 POSTECH March 14, 2007

Why Inductive Definitions? • Definition of SML – finite in size • SML programs

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. 2

Outline • • Inductive definitions of syntactic categories Judgments and inference rules Derivable rules

Outline • • Inductive definitions of syntactic categories Judgments and inference rules Derivable rules and admissible rules Inductive proofs 3

Natural Numbers 4

Natural Numbers 4

Natural Numbers - Examples 5

Natural Numbers - Examples 5

Regular Binary Trees 6

Regular Binary Trees 6

Mutual Induction 7

Mutual Induction 7

Strings of Parentheses 8

Strings of Parentheses 8

Strings of Matched Parentheses 9

Strings of Matched Parentheses 9

Strings of Matched Parentheses 10

Strings of Matched Parentheses 10

Strings of Parentheses 11

Strings of Parentheses 11

Outline • • Inductive definitions of syntactic categories Judgments and inference rules Derivable rules

Outline • • Inductive definitions of syntactic categories Judgments and inference rules Derivable rules and admissible rules Inductive proofs 12

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

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. " –. . . 13

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

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. 14

Inference Rules 15

Inference Rules 15

Examples of Inference Rules 16

Examples of Inference Rules 16

Examples of Axioms 17

Examples of Axioms 17

Natural Numbers using Judgments • Judgment • Inference rules 18

Natural Numbers using Judgments • Judgment • Inference rules 18

Metavariables • is called a metavariable. – It is just a placeholder for a

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. " 19

Derivation Tree 20

Derivation Tree 20

Even and Odd Numbers 21

Even and Odd Numbers 21

Outline • • Inductive definitions of syntactic categories Judgments and inference rules Derivable rules

Outline • • Inductive definitions of syntactic categories Judgments and inference rules Derivable rules and admissible rules Inductive proofs 25

Question • We know arithmetic rules. • But do we use arithmetic rules to

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? 26

From a Derivation Tree • Inference rules • A derivation tree • May I

From a Derivation Tree • Inference rules • A derivation tree • May I use the following rule? 27

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

Derivable Rule • There is a derivation tree from the premises to the conclusion. • May be used as if it was an original inference rule. 28

Is this rule derivable? • No! – no derivation tree like 29

Is this rule derivable? • No! – no derivation tree like 29

But does this rule make sense? • Yes! 30

But does this rule make sense? • Yes! 30

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

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. 31

Derivable Rules vs. Admissible Rules • Which is stronger? – A derivable rule is

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 32

Derivable Rules vs. Admissible Rules • A derivable rule remains valid no matter what.

Derivable Rules vs. Admissible Rules • 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? 33

Announcement • Assignment 2 is out. – Due at 1 am, March 21 (next

Announcement • Assignment 2 is out. – Due at 1 am, March 21 (next Wednesday) – tail-recursive functions, structures, . . . • Course notes – Sections 2. 1 - 2. 3 cover today's lecture. – Sections 2. 4 and 2. 5 might be expanded a bit this weekend. 34