objectives introduction to semantics
play

Objectives Introduction to Semantics Defjne judgment and explain - PowerPoint PPT Presentation

3 is odd Bool Bool Objectives Judgments Proof Trees References Objectives Judgments Proof Trees References Objectives Introduction to Semantics Defjne judgment and explain its purpose in programming languages. Use proof rules to


  1. 3 is odd Bool Bool Objectives Judgments Proof Trees References Objectives Judgments Proof Trees References Objectives Introduction to Semantics ◮ Defjne judgment and explain its purpose in programming languages. ◮ Use proof rules to defjne judgments inductively. Dr. Mattox Beckman ◮ Use proof trees to prove properties about complex syntactic objects. University of Illinois at Urbana-Champaign This presentation draws from Robert Harper’s fjrst chapters in [Har12]. Department of Computer Science Objectives Judgments Proof Trees References Objectives Judgments Proof Trees References Judgments Judgments ◮ A judgment is an assertion about a syntactic object. ◮ A judgment is an assertion about a syntactic object. ◮ Examples: ◮ Examples: ◮ 3 is odd

  2. The J J n are called assumptions or premises . J is called a conclusion . Bool Objectives Judgments Proof Trees References Objectives Judgments Proof Trees References Judgments Judgments ◮ A judgment is an assertion about a syntactic object. ◮ A judgment is an assertion about a syntactic object. ◮ Examples: ◮ Examples: ◮ 3 is odd ◮ 3 is odd ◮ 2 + 3 ⇓ 5 ◮ 2 + 3 ⇓ 5 ◮ ⊢ 2 . 4 > 3 . 5 : Bool Objectives Judgments Proof Trees References Objectives Judgments Proof Trees References The Parts of a Rule The Parts of a Rule ◮ We can also defjne judgments inductively. ◮ We can also defjne judgments inductively. ◮ Let J , J 1 , J 2 , . . . J n be a set of judgments. ◮ Let J , J 1 , J 2 , . . . J n be a set of judgments. ◮ Then we can have a rule as follows: ◮ Then we can have a rule as follows: J 1 J 2 J n Label J 1 J 2 J n Label · · · · · · J J ◮ The J 1 . . . J n are called assumptions or premises . ◮ J is called a conclusion .

  3. Objectives Judgments Proof Trees References Objectives Judgments Proof Trees References Axioms Side Conditions ◮ It’s possible for there to be no assumptions! ◮ If a premise is not a judgment, we sometimes write it as a side condition . ◮ Such a rule is called an axiom . Mod0 , x mod 2 = 0 x is even Label J Objectives Judgments Proof Trees References Objectives Judgments Proof Trees References Example: Even and Odd Numbers with Addition Example: Even and Odd Numbers with Multiplication 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 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 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

  4. Decide which rule applies. Recursively prove fjrst subexpression. Recursively prove second subexpression. Recursively prove fjrst subexpression. Recursively prove second subexpression. Recursively prove second subexpression. Objectives Judgments Proof Trees References Objectives Judgments Proof Trees References Building Proof Trees Using Proof Trees to Prove How to use it: ◮ We can use these rules to prove judgments about objects inductively. ◮ Start with the judgment you want to prove. 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. 4 + 7 is odd ◮ Infer a property you don’t already know. Objectives Judgments Proof Trees References Objectives Judgments Proof Trees References Using Proof Trees to Prove Using Proof Trees to Prove How to use it: How to use it: ◮ Start with the judgment you want to prove. ◮ Start with the judgment you want to prove. ◮ Decide which rule applies. ◮ Decide which rule applies. ◮ Recursively prove fjrst subexpression. Mod0 , 4 mod 2 = 0 Even+Odd 4 is even 4 + 7 is odd Even+Odd 4 + 7 is odd

  5. Objectives Judgments Proof Trees References Objectives Judgments Proof Trees References Using Proof Trees to Prove How to use it: ◮ Start with the judgment you want to prove. References ◮ Decide which rule applies. [Har12] Robert Harper. Practical Foundations for Programming Languages . 2012, p. 496. ◮ Recursively prove fjrst subexpression. DOI: 10.1017/CBO9781139342131 . ◮ Recursively prove second subexpression. Mod1 , 7 mod 2 = 1 Mod0 , 4 mod 2 = 0 4 is even 7 is odd Even+Odd 4 + 7 is odd

Recommend


More recommend