administration
play

Administration Homework 1 due September 11 CS 611 Advanced - PDF document

Administration Homework 1 due September 11 CS 611 Advanced Programming Languages Andrew Myers Cornell University Lecture 6: Inductive definitions 6 Sep 00 CS 611 Lecture 6 Andrew Myers, Cornell University 2 Proofs Well-founded


  1. Administration • Homework 1 due September 11 CS 611 Advanced Programming Languages Andrew Myers Cornell University Lecture 6: Inductive definitions 6 Sep 00 CS 611 Lecture 6 – Andrew Myers, Cornell University 2 Proofs Well-founded induction • Goal: Prove property P( e ) holds for all • In PL, want to prove various things about elements e of a set … inductively defined sets 4 • Idea: generalize predecessor relation � – expression termination, equivalence of 3 expressions – abstract syntax –natural numbers: n � n + 1 2 • Aexp, C[ ] –inductive step: show P( n ) & n � n � � P( n � ) 1 – equivalence of semantics – legal executions � c , σ � � • Well-founded relation � is any relation σ � , � c , σ � → ∗ � skip , σ �� with no infinite descending chains • What are inductively defined sets, exactly? • What is the basis for inductive proofs? –must be irreflexive, no cycles – Winskel: well-founded induction ∀ e . ( ∀ e �� e . P( e � )) � P( e ) (well-founded – Alternative: induction on proof height induction) ∀ e . P( e ) … CS 611 Lecture 6 – Andrew Myers, Cornell University 3 CS 611 Lecture 6 – Andrew Myers, Cornell University 4 Structural induction Induction on derivation • Well-founded relation � : • Inductive hypothesis for well-founded structural induction: P( e � ) for all sub- def e � e � = e is a sub-expression of e � expressions e � 1+2 if x < 2 then skip else skip • Last time, inductive hypothesis slightly x skip 1 2 stronger: P( e � ) for all e with shorter AST • To prove ( ∀ e �� e . P( e � )) � P( e ) –based on course-of-values induction –for expressions e with no predecessors –only alluded to in Winskel Ch. 4 (atoms), prove P( e ) –caveat: rarely a difference in practice –for expressions e with ≥ 1 predecessors e � , • How does this work? prove P( e ) assuming P( e � ) CS 611 Lecture 6 – Andrew Myers, Cornell University 5 CS 611 Lecture 6 – Andrew Myers, Cornell University 6 1

  2. Inductive definitions Rule operator • Set defined inductively by set of rules (proof • Given a set of elements A assumed to be members of the set being defined, define R ( A ) system) to be elements derived by applying all rule • By consistent substitution in agreement with instances to A side conditions, rules generate rule instances x ... x with form x 1 … x n R ( A ) { x | 1 n is a rule inst. & x A } = ∀ ∈ i 1 .. n i ∈ x x • x , x i are elements of set (no meta-variables) • R ( ∅ ) = ? • Meaning: if the elements x 1 … x n are all • R ( R ( ∅ )) = ? members of the set, so is x • R ( A 1 ∪ A 2 ) = ? CS 611 Lecture 6 – Andrew Myers, Cornell University 7 CS 611 Lecture 6 – Andrew Myers, Cornell University 8 Fixed points Monotonicity x ... x R ( A ) { x | 1 n is a rule inst. & x A } = ∀ ∈ • Inductively defined set A is a fixed point i 1 .. n i ∈ x of rule operator R • If applied to larger set, R yields at least • Applying R to A should give us no new as large a set (monotonic): elements: A = R ( A ) A B R ( A ) R ( B ) ⊆ ⊆ � • Recall: fixed point of function f : D → D • Consider ∅ , R ( ∅ ), R ( R ( ∅ )), R ( R ( R ( ∅ ))), … is x ∈ D such that x = f ( x ) = R 0 ( ∅ ), R 1 ( ∅ ), R 2 ( ∅ ), R 3 ( ∅ ), … • A = R ( A ) is equation , not definition • By induction: R n ( ∅ ) ⊆ R n +1 ( ∅ ) for all n • Which fixed point of R do we want? R 0 ( ∅ ) ⊆ R 1 ( ∅ ) ⊆ R 2 ( ∅ ) ⊆ R 3 ( ∅ ), … CS 611 Lecture 6 – Andrew Myers, Cornell University 9 CS 611 Lecture 6 – Andrew Myers, Cornell University 10 Inductive definition Properties of set • The set A defined by the rules is the union • The least fixed point operator fix : ( D → D ) → D of all sets R n ( ∅ ): • Why does � n ∈ω R n ( ∅ ) give fix ( R ) ? A = � n ∈ω R n ( ∅ ) • First must show A = R ( A ), i.e. A = � n ∈ω R n ( ∅ ) = R ( � n ∈ω R n ( ∅ )) • A is the least fixed point of function R • Step 1: A ⊇ R ( A ) x 1 … x m –if x in R ( A ), some rule was applied – smallest set A such that A = R ( A ) x –recall R n ( ∅ ) increasing with n –finite (but arbitrarily large) number of applications of R –must exist n such that x 1 … x m all in R n ( ∅ ) –therefore x in R n +1 ( ∅ ), x in A –elements whose proof trees have finite height CS 611 Lecture 6 – Andrew Myers, Cornell University 11 CS 611 Lecture 6 – Andrew Myers, Cornell University 12 2

  3. LFP property Induction on proof height A = � n ∈ω R n ( ∅ ) • Goal: P( e ) for all e in set • Step 2: A ⊆ R ( A ) • Height of derivation of R 3 ( ∅ ) –Assume x in A. Then x in R n ( ∅ ) for some n. element e is n at which R 2 ( ∅ ) – x in R ( R n -1 ( ∅ )) ⊆ R ( A ) (by monotonicity) e ∈ R n ( ∅ ) R ( ∅ ) • Inductive step: prove that ∅ – x in R ( A ) P( e ) holds for all e in P • Step 3: A is no larger than any fixed pt R n ( ∅ ) assuming it holds –Suppose B = R ( B ) for all e � in R 1 ( ∅ )… R n -1 ( ∅ ) – R n ( ∅ ) ⊆ B � R n +1 ( ∅ ) ⊆ R ( B ) = B • Course-of-values: ∀ n . ∀ e ∈ R n ( ∅ ) . P( e ) –Induction: all R n ( ∅ ) ⊆ B , so A ⊆ B • Result: ∀ e ∈ fix ( R ) . P( e ) CS 611 Lecture 6 – Andrew Myers, Cornell University 13 CS 611 Lecture 6 – Andrew Myers, Cornell University 14 3

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend