Introduction to Semantics Dr. Mattox Beckman University of Illinois - - PowerPoint PPT Presentation

introduction to semantics
SMART_READER_LITE
LIVE PREVIEW

Introduction to Semantics Dr. Mattox Beckman University of Illinois - - PowerPoint PPT Presentation

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


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

slide-2
SLIDE 2

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

slide-3
SLIDE 3

Objectives Judgments Proof Trees References

Judgments

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

3 is odd Bool

slide-4
SLIDE 4

Objectives Judgments Proof Trees References

Judgments

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

◮ 3 is odd

Bool

slide-5
SLIDE 5

Objectives Judgments Proof Trees References

Judgments

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

◮ 3 is odd ◮ 2 + 3 ⇓ 5

Bool

slide-6
SLIDE 6

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

slide-7
SLIDE 7

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.

slide-8
SLIDE 8

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-9
SLIDE 9

Objectives Judgments Proof Trees References

Axioms

◮ It’s possible for there to be no assumptions! ◮ Such a rule is called an axiom.

Label J

slide-10
SLIDE 10

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

slide-11
SLIDE 11

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

slide-12
SLIDE 12

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-13
SLIDE 13

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.

slide-14
SLIDE 14

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

slide-15
SLIDE 15

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

slide-16
SLIDE 16

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-17
SLIDE 17

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

slide-18
SLIDE 18

Objectives Judgments Proof Trees References

References [Har12] Robert Harper. Practical Foundations for Programming Languages. 2012, p. 496. DOI: 10.1017/CBO9781139342131.