the safe calculus
play

The Safe -Calculus William Blum Joint work with C.-H. Luke Ong - PowerPoint PPT Presentation

The Safe -Calculus William Blum Joint work with C.-H. Luke Ong Oxford University Computing Laboratory BCTCS, 25 April 2007 Overview Safety: a restriction for higher-order grammars. Transposed to the -calculus, it gives rise to


  1. The Safe λ -Calculus William Blum Joint work with C.-H. Luke Ong Oxford University Computing Laboratory BCTCS, 2–5 April 2007

  2. Overview ◮ Safety: a restriction for higher-order grammars. ◮ Transposed to the λ -calculus, it gives rise to the Safe λ -calculus. ◮ Safety has nice algorithmic properties, automata-theoretic and game-semantic characterisations.

  3. What is the Safety Restriction? ◮ First appeared under the name “restriction of derived types” in “IO and OI Hierarchies” by W. Damm, TCS 1982 ◮ It is a syntactic restriction for higher-order grammars that constrains the occurrences of the variables in the grammar equations according to their orders. Theorem (Knapik, Niwi´ nski and Urzyczyn (2001,2002)) 1. The Monadic Second Order (MSO) model checking problem for trees generated by safe higher-order grammars of any order is decidable. 2. Automata-theoretic characterisation: Safe grammars of order n are as expressive as pushdown automata of order n. ◮ Aehlig, de Miranda, Ong (2004) introduced the Safe λ -calculus.

  4. What is the Safety Restriction? ◮ First appeared under the name “restriction of derived types” in “IO and OI Hierarchies” by W. Damm, TCS 1982 ◮ It is a syntactic restriction for higher-order grammars that constrains the occurrences of the variables in the grammar equations according to their orders. Theorem (Knapik, Niwi´ nski and Urzyczyn (2001,2002)) 1. The Monadic Second Order (MSO) model checking problem for trees generated by safe higher-order grammars of any order is decidable. 2. Automata-theoretic characterisation: Safe grammars of order n are as expressive as pushdown automata of order n. ◮ Aehlig, de Miranda, Ong (2004) introduced the Safe λ -calculus.

  5. What is the Safety Restriction? ◮ First appeared under the name “restriction of derived types” in “IO and OI Hierarchies” by W. Damm, TCS 1982 ◮ It is a syntactic restriction for higher-order grammars that constrains the occurrences of the variables in the grammar equations according to their orders. Theorem (Knapik, Niwi´ nski and Urzyczyn (2001,2002)) 1. The Monadic Second Order (MSO) model checking problem for trees generated by safe higher-order grammars of any order is decidable. 2. Automata-theoretic characterisation: Safe grammars of order n are as expressive as pushdown automata of order n. ◮ Aehlig, de Miranda, Ong (2004) introduced the Safe λ -calculus.

  6. Simply Typed λ -Calculus ◮ Simple types A := o | A → A . ◮ The order of a type is given by order( o ) = 0, order( A → B ) = max(order( A ) + 1 , order( B )). ◮ Jugdements of the form Γ ⊢ M : T where Γ is the context, M is the term and T is the type: ( wk ) Γ ⊢ M : A ( var ) x : A ⊢ x : A ∆ ⊢ M : A Γ ⊂ ∆ ( app ) Γ ⊢ M : A → B Γ ⊢ N : A Γ , x : A ⊢ M : B ( abs ) Γ ⊢ λ x A . M : A → B Γ ⊢ MN : B ◮ Example: f : o → o → o , x : o ⊢ ( λϕ o → o x o .ϕ x )( f x ) ◮ A single rule: β -reduction. e.g. ( λ x . M ) N → β M [ N / x ]

  7. Simply Typed λ -Calculus ◮ Simple types A := o | A → A . ◮ The order of a type is given by order( o ) = 0, order( A → B ) = max(order( A ) + 1 , order( B )). ◮ Jugdements of the form Γ ⊢ M : T where Γ is the context, M is the term and T is the type: ( wk ) Γ ⊢ M : A ( var ) x : A ⊢ x : A ∆ ⊢ M : A Γ ⊂ ∆ ( app ) Γ ⊢ M : A → B Γ ⊢ N : A Γ , x : A ⊢ M : B ( abs ) Γ ⊢ λ x A . M : A → B Γ ⊢ MN : B ◮ Example: f : o → o → o , x : o ⊢ ( λϕ o → o x o .ϕ x )( f x ) ◮ A single rule: β -reduction. e.g. ( λ x . M ) N → β M [ N / x ]

  8. Simply Typed λ -Calculus ◮ Simple types A := o | A → A . ◮ The order of a type is given by order( o ) = 0, order( A → B ) = max(order( A ) + 1 , order( B )). ◮ Jugdements of the form Γ ⊢ M : T where Γ is the context, M is the term and T is the type: ( wk ) Γ ⊢ M : A ( var ) x : A ⊢ x : A ∆ ⊢ M : A Γ ⊂ ∆ ( app ) Γ ⊢ M : A → B Γ ⊢ N : A Γ , x : A ⊢ M : B ( abs ) Γ ⊢ λ x A . M : A → B Γ ⊢ MN : B ◮ Example: f : o → o → o , x : o ⊢ ( λϕ o → o x o .ϕ x )( f x ) ◮ A single rule: β -reduction. e.g. ( λ x . M ) N → β M [ N / x ]

  9. Simply Typed λ -Calculus ◮ Simple types A := o | A → A . ◮ The order of a type is given by order( o ) = 0, order( A → B ) = max(order( A ) + 1 , order( B )). ◮ Jugdements of the form Γ ⊢ M : T where Γ is the context, M is the term and T is the type: ( wk ) Γ ⊢ M : A ( var ) x : A ⊢ x : A ∆ ⊢ M : A Γ ⊂ ∆ ( app ) Γ ⊢ M : A → B Γ ⊢ N : A Γ , x : A ⊢ M : B ( abs ) Γ ⊢ λ x A . M : A → B Γ ⊢ MN : B ◮ Example: f : o → o → o , x : o ⊢ ( λϕ o → o x o .ϕ x )( f x ) ◮ A single rule: β -reduction. e.g. ( λ x . M ) N → β M [ N / x ]

  10. Simply Typed λ -Calculus ◮ Simple types A := o | A → A . ◮ The order of a type is given by order( o ) = 0, order( A → B ) = max(order( A ) + 1 , order( B )). ◮ Jugdements of the form Γ ⊢ M : T where Γ is the context, M is the term and T is the type: ( wk ) Γ ⊢ M : A ( var ) x : A ⊢ x : A ∆ ⊢ M : A Γ ⊂ ∆ ( app ) Γ ⊢ M : A → B Γ ⊢ N : A Γ , x : A ⊢ M : B ( abs ) Γ ⊢ λ x A . M : A → B Γ ⊢ MN : B ◮ Example: f : o → o → o , x : o ⊢ ( λϕ o → o x o .ϕ x )( f x ) ◮ A single rule: β -reduction. e.g. ( λ x . M ) N → β M [ N / x ]

  11. Variable Capture The usual “problem” in λ -calculus: avoid variable capture when performing substitution: ( λ x . ( λ y . x )) y → β ( λ y . x )[ y / x ] � = λ y . y 1. Standard solution: Barendregt’s convention. Variables are renamed so that free variables and bound variables have different names. Eg. ( λ x . ( λ y . x )) y becomes ( λ x . ( λ z . x )) y which reduces to ( λ z . x )[ y / x ] = λ z . y Drawback: requires to have access to an unbounded supply of names to perform a given sequence of β -reductions. 2. Another solution: switch to the λ -calculus ` a la de Brujin where variable binding is specified by an index instead of a name. Variable renaming then becomes unnecessary. Drawback: the conversion to nameless de Brujin λ -terms requires an unbounded supply of indices. Safety avoids the need for variable renaming!

  12. Variable Capture The usual “problem” in λ -calculus: avoid variable capture when performing substitution: ( λ x . ( λ y . x )) y → β ( λ y . x )[ y / x ] � = λ y . y 1. Standard solution: Barendregt’s convention. Variables are renamed so that free variables and bound variables have different names. Eg. ( λ x . ( λ y . x )) y becomes ( λ x . ( λ z . x )) y which reduces to ( λ z . x )[ y / x ] = λ z . y Drawback: requires to have access to an unbounded supply of names to perform a given sequence of β -reductions. 2. Another solution: switch to the λ -calculus ` a la de Brujin where variable binding is specified by an index instead of a name. Variable renaming then becomes unnecessary. Drawback: the conversion to nameless de Brujin λ -terms requires an unbounded supply of indices. Safety avoids the need for variable renaming!

  13. Variable Capture The usual “problem” in λ -calculus: avoid variable capture when performing substitution: ( λ x . ( λ y . x )) y → β ( λ y . x )[ y / x ] � = λ y . y 1. Standard solution: Barendregt’s convention. Variables are renamed so that free variables and bound variables have different names. Eg. ( λ x . ( λ y . x )) y becomes ( λ x . ( λ z . x )) y which reduces to ( λ z . x )[ y / x ] = λ z . y Drawback: requires to have access to an unbounded supply of names to perform a given sequence of β -reductions. 2. Another solution: switch to the λ -calculus ` a la de Brujin where variable binding is specified by an index instead of a name. Variable renaming then becomes unnecessary. Drawback: the conversion to nameless de Brujin λ -terms requires an unbounded supply of indices. Safety avoids the need for variable renaming!

  14. Variable Capture The usual “problem” in λ -calculus: avoid variable capture when performing substitution: ( λ x . ( λ y . x )) y → β ( λ y . x )[ y / x ] � = λ y . y 1. Standard solution: Barendregt’s convention. Variables are renamed so that free variables and bound variables have different names. Eg. ( λ x . ( λ y . x )) y becomes ( λ x . ( λ z . x )) y which reduces to ( λ z . x )[ y / x ] = λ z . y Drawback: requires to have access to an unbounded supply of names to perform a given sequence of β -reductions. 2. Another solution: switch to the λ -calculus ` a la de Brujin where variable binding is specified by an index instead of a name. Variable renaming then becomes unnecessary. Drawback: the conversion to nameless de Brujin λ -terms requires an unbounded supply of indices. Safety avoids the need for variable renaming!

  15. Variable Capture The usual “problem” in λ -calculus: avoid variable capture when performing substitution: ( λ x . ( λ y . x )) y → β ( λ y . x )[ y / x ] � = λ y . y 1. Standard solution: Barendregt’s convention. Variables are renamed so that free variables and bound variables have different names. Eg. ( λ x . ( λ y . x )) y becomes ( λ x . ( λ z . x )) y which reduces to ( λ z . x )[ y / x ] = λ z . y Drawback: requires to have access to an unbounded supply of names to perform a given sequence of β -reductions. 2. Another solution: switch to the λ -calculus ` a la de Brujin where variable binding is specified by an index instead of a name. Variable renaming then becomes unnecessary. Drawback: the conversion to nameless de Brujin λ -terms requires an unbounded supply of indices. Safety avoids the need for variable renaming!

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