full reduction in open strict calculus
play

Full Reduction in Open Strict Calculus Alvaro Garc a IMDEA - PowerPoint PPT Presentation

Full Reduction in Open Strict Calculus Alvaro Garc a IMDEA Software 2011 1 / 1 Motivation Typing rules for dependent type systems: = t : (cons) t : 2 / 1 Motivation Typing rules for


  1. Full Reduction in Open Strict Calculus ´ Alvaro Garc´ ıa IMDEA Software 2011 1 / 1

  2. Motivation ◮ Typing rules for dependent type systems: τ = β τ ′ Γ ⊢ t : τ (cons) Γ ⊢ t : τ ′ 2 / 1

  3. Motivation ◮ Typing rules for dependent type systems: τ = β τ ′ Γ ⊢ t : τ (cons) Γ ⊢ t : τ ′ ◮ Usually by-value (strict) semantics. 2 / 1

  4. Target Strategies Full-reducing strategies in open strict calculus: ◮ Full normal forms (NF). 3 / 1

  5. Target Strategies Full-reducing strategies in open strict calculus: ◮ Full normal forms (NF). ◮ Free variables. 3 / 1

  6. Target Strategies Full-reducing strategies in open strict calculus: ◮ Full normal forms (NF). ◮ Free variables. ◮ By-value semantics. 3 / 1

  7. Plotkin’s theory λ N β ( λ x . B ) N ⊲ [ N / x ] B 4 / 1

  8. Plotkin’s theory λ N β ( λ x . B ) N ⊲ [ N / x ] B M ⊲ M ′ N ⊲ N ′ B ⊲ B ′ µ ν ξ M N ⊲ M ′ N M N ⊲ M N ′ λ x . B ⊲ λ x . B ′ 4 / 1

  9. Plotkin’s theory λ N β ( λ x . B ) N ⊲ [ N / x ] B M ⊲ M ′ N ⊲ N ′ B ⊲ B ′ µ ν ξ M N ⊲ M ′ N M N ⊲ M N ′ λ x . B ⊲ λ x . B ′ τ M ⊲ N N ⊲ P ρ M ⊲ M M ⊲ P 4 / 1

  10. Plotkin’s theory λ N β ( λ x . B ) N = [ N / x ] B M = M ′ N = N ′ B = B ′ µ ν ξ M N = M ′ N M N = M N ′ λ x . B = λ x . B ′ τ M = N N = P σ M = N ρ M = M M = P N = M 4 / 1

  11. Plotkin’s theory λ V β V ( λ x . B ) N ⊲ [ N / x ] B ( N ∈ Val ) 5 / 1

  12. Plotkin’s theory λ V β V ( λ x . B ) N ⊲ [ N / x ] B ( N ∈ Val ) M ⊲ M ′ N ⊲ N ′ B ⊲ B ′ µ ν ξ M N ⊲ M ′ N M N ⊲ M N ′ λ x . B ⊲ λ x . B ′ 5 / 1

  13. Plotkin’s theory λ V β V ( λ x . B ) N ⊲ [ N / x ] B ( N ∈ Val ) M ⊲ M ′ N ⊲ N ′ B ⊲ B ′ µ ν ξ M N ⊲ M ′ N M N ⊲ M N ′ λ x . B ⊲ λ x . B ′ τ M ⊲ N N ⊲ P ρ M ⊲ M M ⊲ P 5 / 1

  14. Plotkin’s theory λ V β V ( λ x . B ) N = [ N / x ] B ( N ∈ Val ) M = M ′ N = N ′ B = B ′ µ ν ξ M N = M ′ N M N = M N ′ λ x . B = λ x . B ′ τ M = N N = P σ M = N ρ M = M M = P N = M 5 / 1

  15. Values and Irreducible Forms (I) ◮ Values: ::= Val x | λ x . B 6 / 1

  16. Values and Irreducible Forms (I) ◮ Values: ::= Val x | λ x . B ◮ Weak normal forms in λ V : ::= λ x . B WNF V | Stuck W x WNF ∗ Stuck W ::= (( λ x . B ) Stuck W ) WNF ∗ | 6 / 1

  17. Values and Irreducible Forms (I) ◮ Values: ::= Val x | λ x . B ◮ Weak normal forms in λ V : ::= λ x . B WNF V | Stuck W x WNF ∗ Stuck W ::= (( λ x . B ) Stuck W ) WNF ∗ | Note that Val = ( WNF V − Stuck W ) ∪ { x } . 6 / 1

  18. Values and Irreducible Forms (II) ◮ Normal forms in λ V : NF V ::= λ x . NF V | Stuck V ∗ Stuck V ::= x NF V ∗ | (( λ x . NF V ) Stuck V ) NF V 7 / 1

  19. Values and Irreducible Forms (II) ◮ Normal forms in λ V : NF V ::= λ x . NF V | Stuck V ∗ Stuck V ::= x NF V ∗ | (( λ x . NF V ) Stuck V ) NF V Note that Val � = ( NF V − Stuck V ) ∪ { x } . 7 / 1

  20. Call-by-value Strategy (cbv) Uniform standard strategy in λ V : var x → x 8 / 1

  21. Call-by-value Strategy (cbv) Uniform standard strategy in λ V : var x → x abs λ x . B → λ x . B 8 / 1

  22. Call-by-value Strategy (cbv) Uniform standard strategy in λ V : var x → x abs λ x . B → λ x . B N → N ′ [ N ′ / x ] B → B ′ red M → λ x . B M N → B ′ 8 / 1

  23. Call-by-value Strategy (cbv) Uniform standard strategy in λ V : var x → x abs λ x . B → λ x . B N → N ′ [ N ′ / x ] B → B ′ red M → λ x . B M N → B ′ app M → M ′ �≡ λ x . B N → N ′ M N → M ′ N ′ 8 / 1

  24. Standardisation Theorem Theorem λ V ⊢ M ⊲ N iff s.r. M ⊲ 1 . . . ⊲ 1 N 9 / 1

  25. Standardisation Theorem Theorem λ V ⊢ M ⊲ N iff s.r. M ⊲ 1 . . . ⊲ 1 N Corolary → N ′ , N ′ ∈ Val cbv λ V ⊢ M ⊲ N , N ∈ Val iff M 9 / 1

  26. Standardisation Theorem Theorem λ V ⊢ M ⊲ N iff s.r. M ⊲ 1 . . . ⊲ 1 N Corolary → N ′ , N ′ ∈ Val cbv λ V ⊢ M ⊲ N , N ∈ Val iff M Weak reduction is not enoguh for implementing joinability! 9 / 1

  27. Full Reduction and Confluence ◮ Restricting NF’s as arguments breaks Church-Rosser: M ≡ ( λ x . ( λ y . z ) ( x ( λ x . x x ))) ( λ x . x x ) 10 / 1

  28. Hybrid Strategies Example: call-by-name and normal order in λ N . 11 / 1

  29. Hybrid Strategies Example: call-by-name and normal order in λ N . Call-by-name (cbn): cbn x → x cbn λ x . B → λ x . B �� �� �� �� cbn → M ′ ≡ λ x . B cbn [ N / x ] B → S M cbn M N → S �� �� �� �� → M ′ �≡ λ x . B cbn M → M ′ N cbn M N 11 / 1

  30. Hybrid Strategies Example: call-by-name and normal order in λ N . Call-by-name (cbn): Normal order (nor): nor cbn → x x x → x nor → B ′ B nor cbn → λ x . B ′ λ x . B λ x . B → λ x . B �� �� �� �� �� �� �� �� cbn → M ′ ≡ λ x . B cbn → M ′ ≡ λ x . B cbn nor [ N / x ] B → S [ N / x ] B → S M M nor cbn M N → S M N → S �� �� �� �� �� �� �� �� → M ′ �≡ λ x . B → M ′ �≡ λ x . B cbn cbn M ′ nor nor → M ′′ → N ′′ M M N → M ′′ N ′′ nor → M ′ N cbn M N M N Subsidiary Hybrid 11 / 1

  31. Hybrid Strategies Example: call-by-name and normal order in λ N . Call-by-name (cbn): Normal order (nor): nor cbn → x x x → x nor → B ′ B nor cbn → λ x . B ′ λ x . B λ x . B → λ x . B �� �� �� �� �� �� �� �� cbn → M ′ ≡ λ x . B cbn → M ′ ≡ λ x . B cbn nor [ N / x ] B → S [ N / x ] B → S M M nor cbn M N → S M N → S �� �� �� �� �� �� �� �� → M ′ �≡ λ x . B → M ′ �≡ λ x . B cbn cbn M ′ nor nor → M ′′ → N ′′ M M N → M ′′ N ′′ nor → M ′ N cbn M N M N Subsidiary Hybrid 11 / 1

  32. Rule Template var x → x 12 / 1

  33. Rule Template la → B ′ B var x → x abs λ x . B → λ x . B ′ 12 / 1

  34. Rule Template la → B ′ B var x → x abs λ x . B → λ x . B ′ ar 1 → N ′ [ N ′ / x ] B → B ′ red M → λ x . B N M N → B ′ 12 / 1

  35. Rule Template la → B ′ B var x → x abs λ x . B → λ x . B ′ ar 1 → N ′ [ N ′ / x ] B → B ′ red M → λ x . B N M N → B ′ app M → M ′ �≡ λ x . B ar 2 → N ′ N M N → M ′ N ′ 12 / 1

  36. The Beta Cube Booleans la , ar 1 and ar 2 encode the occurrence of the coloured premises in the rule template. 13 / 1

  37. � � � � � � � � � � The Beta Cube Booleans la , ar 1 and ar 2 encode the occurrence of the coloured premises in the rule template. la AOR CBV � � � � � � � � � � ar 1 � � � � 101 001 ( ⊑ ) � � � 110 010 ar 2 � � � � � � � � � � HE CBN 13 / 1

  38. � � � � � � � � � � The Beta Cube Booleans la , ar 1 and ar 2 encode the occurrence of the coloured premises in the rule template. la 0 weakness 1 fullness AOR CBV � � � � � � � � � � ar 1 � � � � 0 non-strictness 1 strictness 101 001 ( ⊑ ) � � � 110 010 ar 2 0 headness 1 non-headness � � � � � � � � � � HE CBN 13 / 1

  39. � � � � � � � � � � � � � � The Beta Cube Booleans la , ar 1 and ar 2 encode the occurrence of the coloured premises in the rule template. la 0 weakness 1 fullness AOR CBV � � � � � � � � � � ar 1 � � � � 0 non-strictness 1 strictness 101 001 ( ⊑ ) � � � 110 010 ar 2 0 headness 1 non-headness � � � � � � � � � � HE CBN nf wnf hnf whnf 13 / 1

  40. Hybridisation Operator sub x → x sub → B ′ B sub → λ x . B ′ λ x . B �� �� �� �� sub sub sub → N ′ [ N ′ / x ] B M → λ x . B N → S sub M N → S �� �� �� �� → M ′ �≡ λ x . B sub sub M → N ′ N → M ′ N ′ sub M N Subsidiary 14 / 1

  41. Hybridisation Operator sub hyb x → x x → x sub hyb → B ′ → B ′ B B sub hyb → λ x . B ′ → λ x . B ′ λ x . B λ x . B �� �� �� �� �� �� �� �� sub sub sub sub hyb hyb → N ′ [ N ′ / x ] B [ N ′ / x ] B M → λ x . B N → S M → λ x . B N → N ′ → S sub hyb M N → S M N → S �� �� �� �� �� �� �� �� → M ′ �≡ λ x . B → M ′ �≡ λ x . B sub sub sub M ′ hyb hyb M → N ′ M → M ′′ → N ′ N N → M ′ N ′ → M ′′ N ′ sub hyb M N M N Subsidiary Hybrid 14 / 1

  42. � � � � � � � � Hybrids in the Non-strict Face of the Cube nor = hyb ( 101 , cbn ) AOR CBV � � � � � � � � � � 101 001 ( ⊑ ) 110 010 � � � � � � � � � � HE CBN 15 / 1

Recommend


More recommend