CSE-321 Programming Languages Inductive Definitions POSTECH March 14, 2007 박성우
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.
3 Outline Inductive definitions of syntactic categories Judgments and inference rules Derivable rules and admissible rules Inductive proofs
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 Inductive proofs
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
23 Full Regular Binary Trees
24 A Full Regular Binary Tree
25 Outline Inductive definitions of syntactic categories Judgments and inference rules Derivable rules and admissible rules Inductive proofs
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
34 Announcement Assignment 2 is out. –Due at 1am, March 21 (next Wednesday) –tail-recursive functions, structures,... Course notes –Sections cover today's lecture. –Sections 2.4 and 2.5 might be expanded a bit this weekend.