the representational adequacy of hybrid
play

The Representational Adequacy of Hybrid Roy L. Crole University of - PowerPoint PPT Presentation

The Representational Adequacy of Hybrid Roy L. Crole University of Leicester 2 December 2011 The Representational Adequacy of Hybrid 1/33 Seminar Outline A Brief Summary of Logical Frameworks The Hybrid Logical Framework Translating


  1. The Representational Adequacy of Hybrid Roy L. Crole University of Leicester 2 December 2011 The Representational Adequacy of Hybrid 1/33

  2. Seminar Outline A Brief Summary of Logical Frameworks The Hybrid Logical Framework Translating λ -Expressions into Hybrid A Model of Hybrid The Adequacy of de Bruijn Expressions for λ -Expressions The Adequacy of Hybrid for λ -Expressions Simple Representation Results The Representational Adequacy of Hybrid 2/33

  3. The Rationale for a Logical Framework ◮ At its simplest, a logical framework is a logic/type theory with ◮ tools for representing syntax and semantics; ◮ principles for reasoning about syntax and semantics. ◮ A logical framework is usually thought of as a meta-language into which object languages are translated. ◮ Logical frameworks enjoy a rich history (too long to summarize here): ◮ “A Framework for Defining Logics” by Honsell, Harper and ◮ Plotkin (1993) proposed use of dependent type theory. ◮ One may also use a λ -calculus with constants: Higher Order Abstract Syntax - HOAS; Martin Löf’s Theory of Arities and Expressions. The Representational Adequacy of Hybrid 3/33

  4. The Rationale for a Logical Framework ◮ At its simplest, a logical framework is a logic/type theory with ◮ tools for representing syntax and semantics; ◮ principles for reasoning about syntax and semantics. ◮ A logical framework is usually thought of as a meta-language into which object languages are translated. ◮ An object language is represented in a logical framework by giving a translation � − � : OL → LF . ◮ The translation function should be representationally adequate, ie: ◮ injective ◮ a compositional homomorphism, ie commute with (capture avoiding) substitution The Representational Adequacy of Hybrid 3/33

  5. The Rationale for a Logical Framework ◮ At its simplest, a logical framework is a logic/type theory with ◮ tools for representing syntax and semantics; ◮ principles for reasoning about syntax and semantics. ◮ A logical framework is usually thought of as a meta-language into which object languages are translated. ◮ An object language is represented in a logical framework by giving a translation � − � : OL → LF . ◮ The translation function should be representationally adequate, ie: Talk focuses on object languages with binding ◮ injective ◮ a compositional homomorphism, ie commute with (capture avoiding) substitution The Representational Adequacy of Hybrid 3/33

  6. How to Implement Object Syntax with Binding How might we implement object level syntax such as Q :: = V i | Q ⊃ Q | ∀ V i . Q QPL A Traditional Approach ◮ Define a recursive type specifying the raw syntax exp :: = var | Imp exp exp | All var exp ◮ Define capture avoiding substitution (for given notions of free and bound variables), and ◮ hence define language expressions to be the quotient of exp by the ∼ α equivalence relation. The Representational Adequacy of Hybrid 4/33

  7. How to Implement Object Syntax with Binding . c i g How might we implement object level syntax such as o l t c e j b o Q :: = V i | Q ⊃ Q | ∀ V i . Q QPL h c a e r o f A Traditional Approach d e r i u q e ◮ Define a recursive type specifying the raw syntax r e r a s n o i exp :: = var | Imp exp exp | All var exp t i n fi e d e h T ◮ Define capture avoiding substitution (for given notions of free : s e g and bound variables), and a t n a v ◮ hence define language expressions to be the quotient of exp by d a s i D the ∼ α equivalence relation. The Representational Adequacy of Hybrid 4/33

  8. How to Implement Object Syntax with Binding How might we implement object level syntax such as Q :: = V i | Q ⊃ Q | ∀ V i . Q QPL Or – Higher Order Abstract Syntax ◮ Implement the λ -calculus once and only once C :: = c | v k | LAM v k . C | C 1 C 2 ◮ Define substitution and α ( βη ) -equivalence once and only once . The Representational Adequacy of Hybrid 4/33

  9. How to Implement Object Syntax with Binding How might we implement object level syntax such as Q :: = V i | Q ⊃ Q | ∀ V i . Q QPL Or – Higher Order Abstract Syntax ◮ We get a logical framework infrastructure. To encode QPL specify constants Imp :: exp ⇒ exp ⇒ exp and All :: ( exp ⇒ exp ) ⇒ exp ◮ One can define an encoding function � − � , where def � Q 1 ⊃ Q 2 � = Imp � Q 1 � � Q 2 � def � ∀ V i . Q � = All ( LAM v i . � Q � ) The Representational Adequacy of Hybrid 4/33

  10. Human or Machine? I prefer LF to have binders with names: C :: = c | v i | LAM v i . C | C 1 C 2 The Representational Adequacy of Hybrid 5/33

  11. Human or Machine? I prefer LF to have binders with names: C :: = c | v i | LAM v i . C | C 1 C 2 However, if I was a machine I’d prefer de Bruijn expressions C :: = CON n | VAR i | BND j | ABS C | C 1 $$ C 2 We use locally nameless de Bruijn expressions: BND j is a bound variable with index j ; but VAR i is a named variable, with name i . The Representational Adequacy of Hybrid 5/33

  12. Human or Machine? I prefer LF to have binders with names: C :: = c | v i | LAM v i . C | C 1 C 2 However, if I was a machine I’d prefer de Bruijn expressions C :: = CON n | VAR i | BND j | ABS C | C 1 $$ C 2 We use locally nameless de Bruijn expressions: BND j is a bound variable with index j ; but VAR i is a named variable, with name i . Hybrid gives us the best of both worlds . . . The Representational Adequacy of Hybrid 5/33

  13. Introducing Hybrid ◮ Hybrid is a theory in Isabelle/HOL . ◮ There is a “ λ -calculus datatype” which specifies a form of HOAS. ◮ Hybrid is a logical framework, in which both HOAS and (co)induction are consistent . . . but that is another story. ◮ Object level variable binding is represented by Isabelle/HOL ’s internal meta-variable binding. The Representational Adequacy of Hybrid 6/33

  14. Introducing Hybrid ◮ Hybrid is a theory in Isabelle/HOL . ◮ There is a “ λ -calculus datatype” which specifies a form of HOAS. ◮ Hybrid is a logical framework, in which both HOAS and (co)induction are consistent . . . but that is another story. ◮ Object level variable binding is represented by Isabelle/HOL ’s internal meta-variable binding. Hybrid can convert λ -expressions into de Bruijn expressions The Representational Adequacy of Hybrid 6/33

  15. Introducing Hybrid ◮ Hybrid is a theory in Isabelle/HOL . ◮ There is a “ λ -calculus datatype” which specifies a form of HOAS. ◮ Hybrid is a logical framework, in which both HOAS and (co)induction are consistent . . . but that is another story. ◮ Object level variable binding is represented by Isabelle/HOL ’s internal meta-variable binding. Hybrid can convert λ -expressions into de Bruijn expressions user supplied machine produced The Representational Adequacy of Hybrid 6/33

  16. The Heart of Hybrid ◮ Hybrid includes a datatype exp of de Bruijn expressions: :: = CON con | VAR var | BND bnd exp | ABS exp | exp $$ exp ◮ But a user can write expressions of the form :: = CON ν | VAR i | BND j C | ABS C | C $$ C | LAM v . C The Representational Adequacy of Hybrid 7/33

  17. The Heart of Hybrid ◮ Hybrid includes a datatype exp of de Bruijn expressions: :: = CON con | VAR var | BND bnd exp | ABS exp | exp $$ exp ◮ But a user can write expressions of the form :: = CON ν | VAR i | BND j C | ABS C | C $$ C | LAM v . C Hybrid is a hybrid of λ -calculus and de Bruijn notation The Representational Adequacy of Hybrid 7/33

  18. ◮ User inputs Hybrid expression LAM v 1 . ( LAM v 0 . ( v 1 $$ v 0 )) † where LAM v i . ξ is Isabelle/HOL binder syntax ◮ † can be automatically proved equal to a Hybrid expression ABS ( ABS ( BND 1 $$ BND 0 )) :: exp ◮ This is implemented by a function lbnd LAM v i . ξ �→ ABS ( lbnd 0 Λ v i . ξ ) The Representational Adequacy of Hybrid 8/33

  19. ◮ User inputs Hybrid expression LAM v 1 . ( LAM v 0 . ( v 1 $$ v 0 )) † where LAM v i . ξ is Isabelle/HOL binder syntax ◮ † can be automatically proved equal to a Hybrid expression ABS ( ABS ( BND 1 $$ BND 0 )) :: exp ◮ This is implemented by a function lbnd LAM v i . ξ �→ ABS ( lbnd 0 Λ v i . ξ ) We need to define lbnd HOL meta-binding Λ . v i The Representational Adequacy of Hybrid 8/33

  20. Translating λ -Expressions LF An example of � − � : LE → Hybrid : OL Let E O = λ v 8 . λ v 2 . v 8 v 3 . Then def def = � E O � = LAM v 8 . ( LAM v 2 . ( v 8 $$ VAR 3 )) E H In Hybrid E H is provably equal to ABS ( ABS ( BND 1 $$ VAR 3 )) The Representational Adequacy of Hybrid 9/33

  21. Key Translation Principles ◮ object level free variables v i are expressed as Hybrid expressions of the form VAR i ; ◮ object level bound variables v j are expressed as Hybrid (bound) meta-variables v j ; ◮ object level abstractions λ v j . E are expressed as Hybrid expressions LAM v j . C ; and ◮ object level applications E 1 E 2 are expressed as Hybrid expressions C 1 $$ C 2 . Main theorem : a proof that the translation function Θ , derived from these principles, Θ : (object level) λ - expressions − → Hybrid , exists and is representationally adequate. The Representational Adequacy of Hybrid 10/33

  22. Defining LAM Via lbnd def Consider the (object level) expression E O = λ v 8 . λ v 2 . v 8 v 2 . This expression is encoded in Hybrid as def E H = LAM v 8 . ( LAM v 2 . ( v 8 $$ v 2 )) Thought 1: LAM v i . ξ denotes ABS ( Λ v i . ξ ) . Then E H would be ABS ( Λ v 8 . ( ABS ( Λ v 2 . ( v 8 $$ v 2 )))) The Representational Adequacy of Hybrid 11/33

Recommend


More recommend