arith-ind - CS 221 Programming Languages Handout 1 Fall...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS 221 Programming Languages Handout 1 Fall 2005 Oct 25, 2005 Rule Induction Example This handout provides a detailed examination of Rule Induction for the particular rule set defining the small-step dynamic semantics for the simple language Arith+Let (see Section 1). It gives a full presentation of the Induction Principle for this rule set, and then a detailed (even pedantic) sample inductive proof based on the Induction Principle. 1 Small-step dynamic semantics for Arith with Let ( p = m + n ) plus ( num [ m ] , num [ n ]) 7 num [ p ] ( AD 1 ) ( p = m n ) times ( num [ m ] , num [ n ]) 7 num [ p ] ( AD 2 ) let ( num [ n ] , x.e 2 ) 7 { num [ p ] /x } e 2 ( AD 3 ) e 1 7 e 1 plus ( e 1 ,e 2 ) 7 plus ( e 1 ,e 2 ) ( AD 4 ) e 2 7 e 2 plus ( num [ n ] ,e 2 ) 7 plus ( num [ n ] ,e 2 ) ( AD 5 ) e 1 7 e 1 times ( e 1 ,e 2 ) 7 times ( e 1 ,e 2 ) ( AD 6 ) e 2 7 e 2 times ( num [ n ] ,e 2 ) 7 times ( num [ n ] ,e 2 ) ( AD 7 ) e 1 7 e 1 let ( e 1 , x.e 2 ) 7 let ( e 1 , x.e 2 ) ( AD 8 ) 1 2 Induction Principle for Dynamic Sematics Rules The Induction Principle for the transition relation 7 defined by rules AD 1 through AD 8 allows us to prove general statements of the form IConc : e,e .e 7 e P ( e,e ) (1) where P is some binary property on expressions. For instance, to prove the following proposition stating that the transition relation is deterministic: e 1 ,e 2 ,e 3 . e 1 7 e 2 & e 1 7 e 3 e 2 = e 3 (2) we could define the property P as follows: P ( e,e ) e 00 .e 7 e 00 e 00 = e (3) The Induction Principle is the implication IC 1 & IC 2 & ... & IC 8 IConc (4) where each IC i is an induction clause for the corresponding inference rule AD i , as described below. Instruction Rules: The induction clauses for the three instruction rules are simple because they do not introduce induction hypotheses. Rule AD 1 IC 1 : e,e . if e 7 e by AD 1 , then P ( e,e ) (5) or equivalently IC 1 : m,n.P ( plus ( num [ m ] , num [ n ]) , num [ m + n ]) (6) Rule AD 2 IC 2 : e,e . if e 7 e by AD 2 , then P ( e,e ) (7) or equivalently IC 2 : m,n.P ( times ( num [ m ] , num [ n ]) , num [ m n ]) (8) Rule AD 3 IC 3 : e,e...
View Full Document

Page1 / 6

arith-ind - CS 221 Programming Languages Handout 1 Fall...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online