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

objectives introduction to semantics
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

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

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

Bool

slide-2
SLIDE 2

Objectives Judgments Proof Trees References

Judgments

◮ A judgment is an assertion about a syntactic object. ◮ Examples:

◮ 3 is odd ◮ 2 + 3 ⇓ 5

Bool

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 Objectives Judgments Proof Trees References

The Parts of a Rule

◮ We can also defjne judgments inductively. ◮ Let J, J1, J2, . . . Jn be a set of judgments. ◮ Then we can have a rule as follows:

J1 J2 · · · Jn Label J The J Jn 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, J1, J2, . . . Jn be a set of judgments. ◮ Then we can have a rule as follows:

J1 J2 · · · Jn Label J

◮ The J1 . . . Jn are called assumptions or premises. ◮ J is called a conclusion.

slide-3
SLIDE 3

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 x is even x is even y is even Even+Even x + y is even x is even y is odd Even+Odd x + y is odd Mod1, x mod 2 = 1 x is odd x is odd y is odd Odd+Odd x + y is even x is odd y is even Odd+Even 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 × y is even x is even y is odd Even×Odd x × y is even x is odd y is odd Odd×Odd x × y is odd x is odd y is even Odd×Even x × y is even

slide-4
SLIDE 4

Objectives Judgments Proof Trees References

Building Proof Trees

◮ We can use these rules to prove judgments about objects inductively.

Mod0, 4 mod 2 = 0 4 is even Mod1, 7 mod 2 = 1 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. 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. 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. 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 4 is even Even+Odd 4 + 7 is odd

slide-5
SLIDE 5

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 4 is even Mod1, 7 mod 2 = 1 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.