Objectives Judgments Proof Trees References Introduction to Semantics Dr. Mattox Beckman University of Illinois at Urbana-Champaign Department of Computer Science
Objectives Judgments Proof Trees References Objectives ◮ Defjne judgment and explain its purpose in programming languages. ◮ Use proof rules to defjne judgments inductively. ◮ Use proof trees to prove properties about complex syntactic objects. This presentation draws from Robert Harper’s fjrst chapters in [Har12].
3 is odd Bool Objectives Judgments Proof Trees References Judgments ◮ A judgment is an assertion about a syntactic object. ◮ Examples:
Bool Objectives Judgments Proof Trees References Judgments ◮ A judgment is an assertion about a syntactic object. ◮ Examples: ◮ 3 is odd
Bool Objectives Judgments Proof Trees References Judgments ◮ A judgment is an assertion about a syntactic object. ◮ Examples: ◮ 3 is odd ◮ 2 + 3 ⇓ 5
Objectives Judgments Proof Trees References Judgments ◮ A judgment is an assertion about a syntactic object. ◮ Examples: ◮ 3 is odd ◮ 2 + 3 ⇓ 5 ◮ ⊢ 2 . 4 > 3 . 5 : Bool
The J J n are called assumptions or premises . J is called a conclusion . Objectives Judgments Proof Trees References The Parts of a Rule ◮ We can also defjne judgments inductively. ◮ Let J , J 1 , J 2 , . . . J n be a set of judgments. ◮ Then we can have a rule as follows: J 1 J 2 J n Label · · · J
Objectives Judgments Proof Trees References The Parts of a Rule ◮ We can also defjne judgments inductively. ◮ Let J , J 1 , J 2 , . . . J n be a set of judgments. ◮ Then we can have a rule as follows: J 1 J 2 J n Label · · · J ◮ The J 1 . . . J n are called assumptions or premises . ◮ J is called a conclusion .
Objectives Judgments Proof Trees References Axioms ◮ It’s possible for there to be no assumptions! ◮ Such a rule is called an axiom . Label J
Objectives Judgments Proof Trees References Side Conditions ◮ If a premise is not a judgment, we sometimes write it as a side condition . Mod0 , x mod 2 = 0 x is even
Objectives Judgments Proof Trees References Example: Even and Odd Numbers with Addition Mod0 , x mod 2 = 0 Mod1 , x mod 2 = 1 x is even x is odd x is even y is even Even+Even x is odd y is odd Odd+Odd x + y is even x + y is even x is even y is odd Even+Odd x is odd y is even Odd+Even x + y is odd x + y is odd
Objectives Judgments Proof Trees References Example: Even and Odd Numbers with Multiplication x is even y is even Even × Even x is odd y is odd Odd × Odd x × y is even x × y is odd x is even y is odd Even × Odd x is odd y is even Odd × Even x × y is even x × y is even
Objectives Judgments Proof Trees References Building Proof Trees ◮ We can use these rules to prove judgments about objects inductively. Mod0 , 4 mod 2 = 0 Mod1 , 7 mod 2 = 1 4 is even 7 is odd Even+Odd 4 + 7 is odd ◮ There are two ways you can use proof trees. ◮ Prove a property you already know. ◮ Infer a property you don’t already know.
Decide which rule applies. Recursively prove fjrst subexpression. Recursively prove second subexpression. Objectives Judgments Proof Trees References Using Proof Trees to Prove How to use it: ◮ Start with the judgment you want to prove. 4 + 7 is odd
Recursively prove fjrst subexpression. Recursively prove second subexpression. Objectives Judgments Proof Trees References Using Proof Trees to Prove How to use it: ◮ Start with the judgment you want to prove. ◮ Decide which rule applies. Even+Odd 4 + 7 is odd
Recursively prove second subexpression. Objectives Judgments Proof Trees References Using Proof Trees to Prove How to use it: ◮ Start with the judgment you want to prove. ◮ Decide which rule applies. ◮ Recursively prove fjrst subexpression. Mod0 , 4 mod 2 = 0 4 is even Even+Odd 4 + 7 is odd
Objectives Judgments Proof Trees References Using Proof Trees to Prove How to use it: ◮ Start with the judgment you want to prove. ◮ Decide which rule applies. ◮ Recursively prove fjrst subexpression. ◮ Recursively prove second subexpression. Mod0 , 4 mod 2 = 0 Mod1 , 7 mod 2 = 1 4 is even 7 is odd Even+Odd 4 + 7 is odd
Objectives Judgments Proof Trees References References [Har12] Robert Harper. Practical Foundations for Programming Languages . 2012, p. 496. DOI: 10.1017/CBO9781139342131 .
Recommend
More recommend