The Representational Adequacy of Hybrid
Roy L. Crole
University of Leicester
2 December 2011
The Representational Adequacy of Hybrid 1/33
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
The Representational Adequacy of Hybrid 1/33
The Representational Adequacy of Hybrid 2/33
◮ 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
◮ Logical frameworks enjoy a rich history (too long to summarize
◮
◮ “A Framework for Defining Logics” by Honsell, Harper and
◮ One may also use a λ-calculus with constants: Higher Order
The Representational Adequacy of Hybrid 3/33
◮ 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
◮ An object language is represented in a logical framework by
◮ The translation function should be representationally adequate,
◮ injective ◮ a compositional homomorphism, ie commute with (capture
The Representational Adequacy of Hybrid 3/33
◮ 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
◮ An object language is represented in a logical framework by
◮ The translation function should be representationally adequate,
◮ injective ◮ a compositional homomorphism, ie commute with (capture
The Representational Adequacy of Hybrid 3/33
◮ Define a recursive type specifying the raw syntax
◮ Define capture avoiding substitution (for given notions of free
◮ hence define language expressions to be the quotient of exp by
The Representational Adequacy of Hybrid 4/33
◮ Define a recursive type specifying the raw syntax
◮ Define capture avoiding substitution (for given notions of free
◮ hence define language expressions to be the quotient of exp by
The Representational Adequacy of Hybrid 4/33
◮ Implement the λ-calculus once and only once
◮ Define substitution and α(βη)-equivalence once and only once.
The Representational Adequacy of Hybrid 4/33
◮ We get a logical framework infrastructure. To encode QPL
◮ One can define an encoding function −, where
The Representational Adequacy of Hybrid 4/33
The Representational Adequacy of Hybrid 5/33
The Representational Adequacy of Hybrid 5/33
The Representational Adequacy of Hybrid 5/33
◮ Hybrid is a theory in Isabelle/HOL. ◮ There is a “λ-calculus datatype” which specifies a form of
◮ Hybrid is a logical framework, in which both HOAS and
◮ Object level variable binding is represented by Isabelle/HOL’s
The Representational Adequacy of Hybrid 6/33
◮ Hybrid is a theory in Isabelle/HOL. ◮ There is a “λ-calculus datatype” which specifies a form of
◮ Hybrid is a logical framework, in which both HOAS and
◮ Object level variable binding is represented by Isabelle/HOL’s
The Representational Adequacy of Hybrid 6/33
◮ Hybrid is a theory in Isabelle/HOL. ◮ There is a “λ-calculus datatype” which specifies a form of
◮ Hybrid is a logical framework, in which both HOAS and
◮ Object level variable binding is represented by Isabelle/HOL’s
The Representational Adequacy of Hybrid 6/33
◮ Hybrid includes a datatype exp of de Bruijn expressions:
◮ But a user can write expressions of the form
The Representational Adequacy of Hybrid 7/33
◮ Hybrid includes a datatype exp of de Bruijn expressions:
◮ But a user can write expressions of the form
The Representational Adequacy of Hybrid 7/33
◮ User inputs Hybrid expression
◮ † can be automatically proved equal to a Hybrid expression
◮ This is implemented by a function lbnd
The Representational Adequacy of Hybrid 8/33
◮ User inputs Hybrid expression
◮ † can be automatically proved equal to a Hybrid expression
◮ This is implemented by a function lbnd
The Representational Adequacy of Hybrid 8/33
The Representational Adequacy of Hybrid 9/33
◮ object level free variables vi are expressed as Hybrid
◮ object level bound variables vj are expressed as Hybrid
◮ object level abstractions λ vj. E are expressed as Hybrid
◮ object level applications E1 E2 are expressed as Hybrid
The Representational Adequacy of Hybrid 10/33
The Representational Adequacy of Hybrid 11/33
The Representational Adequacy of Hybrid 11/33
The Representational Adequacy of Hybrid 11/33
◮ recurse through the ABS nodes and use n to count them—in
◮ recurse over $$ nodes; ◮ and in each case recursively move the meta-binders Λ towards
The Representational Adequacy of Hybrid 12/33
◮ recurse through the ABS nodes and use n to count them—in
◮ recurse over $$ nodes; ◮ and in each case recursively move the meta-binders Λ towards
def
The Representational Adequacy of Hybrid 12/33
◮ recurse through the ABS nodes and use n to count them—in
◮ recurse over $$ nodes; ◮ and in each case recursively move the meta-binders Λ towards
def
The Representational Adequacy of Hybrid 12/33
◮ recurse through the ABS nodes and use n to count them—in
◮ recurse over $$ nodes; ◮ and in each case recursively move the meta-binders Λ towards
def
The Representational Adequacy of Hybrid 12/33
The Representational Adequacy of Hybrid 13/33
The Representational Adequacy of Hybrid 13/33
The Representational Adequacy of Hybrid 13/33
The Representational Adequacy of Hybrid 13/33
The Representational Adequacy of Hybrid 13/33
The Representational Adequacy of Hybrid 14/33
◮ We take the object expressions to be LE/∼α.
The Representational Adequacy of Hybrid 14/33
◮ We take the object expressions to be LE/∼α. ◮ We take Hybrid to be a model of a subset of the system
The Representational Adequacy of Hybrid 14/33
◮ We take the object expressions to be LE/∼α. ◮ We take Hybrid to be a model of a subset of the system
◮ !! Our model is a theory in a logical framework !!:
The Representational Adequacy of Hybrid 14/33
◮ We take the object expressions to be LE/∼α. ◮ We take Hybrid to be a model of a subset of the system
◮ !! Our model is a theory in a logical framework !!: ◮ The meta-variables of the logical framework play the rôle of
The Representational Adequacy of Hybrid 14/33
◮ We take the object expressions to be LE/∼α. ◮ We take Hybrid to be a model of a subset of the system
◮ !! Our model is a theory in a logical framework !!: ◮ The meta-variables of the logical framework play the rôle of
◮ logical framework binding and application play the rôle of
The Representational Adequacy of Hybrid 14/33
◮ The types are
◮ The constants are
◮ The inductive definition of canonical forms C is standard . . .
The Representational Adequacy of Hybrid 15/33
(0≤i≤n)
(0≤i≤n)
The Representational Adequacy of Hybrid 15/33
(0≤i≤n)
(0≤i≤n)
The Representational Adequacy of Hybrid 15/33
(0≤i≤n)
(0≤i≤n)
The Representational Adequacy of Hybrid 15/33
◮ lbnd n (Λ vk. vk) = BND n ◮ lbnd n (Λ vk. vk′) = vk′ where k = k′ ◮ lbnd n (Λ vk. VAR i) = VAR i ◮ lbnd n (Λ vk. BND j) = BND j ◮ lbnd n (Λ vk. C1 $$ C2) = (lbnd n (Λ vk. C1)) $$
◮ lbnd n (Λ vk. ABS C) = ABS (lbnd (n + 1) (Λ vk. C))
The Representational Adequacy of Hybrid 16/33
The Representational Adequacy of Hybrid 17/33
The Representational Adequacy of Hybrid 17/33
The Representational Adequacy of Hybrid 17/33
The Representational Adequacy of Hybrid 17/33
The Representational Adequacy of Hybrid 17/33
The Representational Adequacy of Hybrid 17/33
◮ Shankar (1988) gave a mechanical proof for pure de Bruijn. ◮ Crole (MSCS, 2011) is the first detailed proof for locally
The Representational Adequacy of Hybrid 17/33
The Representational Adequacy of Hybrid 18/33
The Representational Adequacy of Hybrid 18/33
The Representational Adequacy of Hybrid 18/33
The Representational Adequacy of Hybrid 19/33
The Representational Adequacy of Hybrid 20/33
The Representational Adequacy of Hybrid 20/33
The Representational Adequacy of Hybrid 20/33
The Representational Adequacy of Hybrid 20/33
The Representational Adequacy of Hybrid 20/33
exp)
exp)
◮ LEMMA proving existence of inst ◮ PROPOSITION showing ΘL = (inst 0 L) ◦ ι ◦ θL
The Representational Adequacy of Hybrid 21/33
exp)
exp)
◮ θ = θǫ is representationally adequate (de Bruijn adequacy). ◮ Since Θ = Θǫ = (inst 0 ǫ) ◦ ι ◦ θǫ, then Θǫ is representationally
The Representational Adequacy of Hybrid 21/33
exp)
exp)
◮ LEMMA proving existence of hdb, and ◮ LEMMA showing hdb is a left inverse for inst.
The Representational Adequacy of Hybrid 21/33
exp)
exp)
The Representational Adequacy of Hybrid 21/33
def
The Representational Adequacy of Hybrid 22/33
L
◮ BND 2 matches λ-binding variable 2. ◮ λ-binding v2 has been counted by 1. ◮ Therefore BND 2 matches λ-binding (2 − 1) in [v8, v6] = v6. ◮ BND j matches λ-binder (j − n) in L.
The Representational Adequacy of Hybrid 22/33
L
◮ BND 2 matches λ-binding variable 2. ◮ λ-binding v2 has been counted by 1. ◮ Therefore BND 2 matches λ-binding (2 − 1) in [v8, v6] = v6. ◮ BND j matches λ-binder (j − n) in L.
The Representational Adequacy of Hybrid 22/33
L
◮ BND 2 matches λ-binding variable 2. ◮ λ-binding v2 has been counted by 1. ◮ Therefore BND 2 matches λ-binding (2 − 1) in [v8, v6] = v6. ◮ BND j matches λ-binder (j − n) in L.
The Representational Adequacy of Hybrid 22/33
L
◮ BND 2 matches λ-binding variable 2. ◮ λ-binding v2 has been counted by 1. ◮ Therefore BND 2 matches λ-binding (2 − 1) in [v8, v6] = v6. ◮ BND j matches λ-binder (j − n) in L.
The Representational Adequacy of Hybrid 22/33
L
The Representational Adequacy of Hybrid 22/33
◮ inst n L (VAR i) = VAR i ◮
◮ inst n L (D1 $$ D2) = (inst n L D1) $$ (inst n L D2) ◮ inst n L (ABS D) = ABS (inst (n + 1) L D)
The Representational Adequacy of Hybrid 23/33
The Representational Adequacy of Hybrid 24/33
The Representational Adequacy of Hybrid 24/33
The Representational Adequacy of Hybrid 24/33
The Representational Adequacy of Hybrid 24/33
exp)
exp)
The Representational Adequacy of Hybrid 25/33
The Representational Adequacy of Hybrid 25/33
The Representational Adequacy of Hybrid 25/33
The Representational Adequacy of Hybrid 25/33
The Representational Adequacy of Hybrid 25/33
The Representational Adequacy of Hybrid 25/33
The Representational Adequacy of Hybrid 25/33
◮ hdb n L vk = BND ((pos vk L) + n) ◮ hdb n L (VAR i) = VAR i ◮ hdb n L (BND j) = BND j ◮ hdb n L (C1 $$ C2) = (hdb n L (C1)) $$ (hdb n L (C2)) ◮ hdb n L (ABS C) = ABS (hdb (n + 1) L C)
The Representational Adequacy of Hybrid 26/33
The Representational Adequacy of Hybrid 27/33
The Representational Adequacy of Hybrid 27/33
The Representational Adequacy of Hybrid 27/33
The Representational Adequacy of Hybrid 28/33
◮ Suppose ABS C is proper eg
The Representational Adequacy of Hybrid 29/33
◮ Suppose ABS C is proper eg
◮ Then C is of level 1, and some bound indices may dangle; for
The Representational Adequacy of Hybrid 29/33
◮ Suppose ABS C is proper eg
◮ Then C is of level 1, and some bound indices may dangle; for
◮ An abstraction is produced by replacing each occurrence of a
The Representational Adequacy of Hybrid 29/33
◮ Suppose ABS C is proper eg
◮ Then C is of level 1, and some bound indices may dangle; for
◮ An abstraction is produced by replacing each occurrence of a
The Representational Adequacy of Hybrid 29/33
◮ abst n (Λ vk. vk) = T ◮ abst n (Λ vk. vk′) = F
◮ abst n (Λ vk. VAR i) = T ◮ abst n (Λ vk. BND j) = n < j
◮ abst n (Λ vk. C1 $$ C2) =
◮ abst n (Λ vk. ABS C) = abst (n + 1) (Λ vk. C)
The Representational Adequacy of Hybrid 30/33
The Representational Adequacy of Hybrid 31/33
◮ Nameless binders introduced by de Bruijn (1972). Free
◮ Shankar (1988) investigated bijections between pure de Bruijn
◮ The closest work to ours detailing a bijection. ◮ No need to identify proper expressions, but complicated
◮ Our work extends Gordon’s (1994) on locally nameless de
◮ Norrish and Vestergaard (2007) provide a very thorough survey
The Representational Adequacy of Hybrid 32/33
◮ We have shown the Hybrid system representationally
◮ We have representation results that link Hybrid predicates
◮ Further work could involve the investigation of the notion of
◮ We might consider a dependently typed version of Hybrid . . . ◮ Categorical and nominal models and techniques . . . especially
The Representational Adequacy of Hybrid 33/33