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

the representational adequacy of hybrid
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

The Representational Adequacy of Hybrid

Roy L. Crole

University of Leicester

2 December 2011

The Representational Adequacy of Hybrid 1/33

slide-2
SLIDE 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

slide-3
SLIDE 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

slide-4
SLIDE 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

slide-5
SLIDE 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:

◮ injective ◮ a compositional homomorphism, ie commute with (capture

avoiding) substitution

Talk focuses on object languages with binding

The Representational Adequacy of Hybrid 3/33

slide-6
SLIDE 6

How to Implement Object Syntax with Binding

How might we implement object level syntax such as Q ::= Vi | Q ⊃ Q | ∀Vi. 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

slide-7
SLIDE 7

How to Implement Object Syntax with Binding

How might we implement object level syntax such as Q ::= Vi | Q ⊃ Q | ∀Vi. 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.

D i s a d v a n t a g e s : T h e d e fi n i t i

  • n

s a r e r e q u i r e d f

  • r

e a c h

  • b

j e c t l

  • g

i c .

The Representational Adequacy of Hybrid 4/33

slide-8
SLIDE 8

How to Implement Object Syntax with Binding

How might we implement object level syntax such as Q ::= Vi | Q ⊃ Q | ∀Vi. Q QPL Or – Higher Order Abstract Syntax

◮ Implement the λ-calculus once and only once

C ::= c | vk | LAM vk. C | C1 C2

◮ Define substitution and α(βη)-equivalence once and only once.

The Representational Adequacy of Hybrid 4/33

slide-9
SLIDE 9

How to Implement Object Syntax with Binding

How might we implement object level syntax such as Q ::= Vi | Q ⊃ Q | ∀Vi. 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

Q1 ⊃ Q2

def

=

Imp Q1 Q2 ∀Vi. Q

def

=

All (LAM vi. Q)

The Representational Adequacy of Hybrid 4/33

slide-10
SLIDE 10

Human or Machine?

I prefer LF to have binders with names: C ::= c | vi | LAM vi. C | C1 C2

The Representational Adequacy of Hybrid 5/33

slide-11
SLIDE 11

Human or Machine?

I prefer LF to have binders with names: C ::= c | vi | LAM vi. C | C1 C2 However, if I was a machine I’d prefer de Bruijn expressions C ::= CON n | VAR i | BND j | ABS C | C1 $$ C2 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

slide-12
SLIDE 12

Human or Machine?

I prefer LF to have binders with names: C ::= c | vi | LAM vi. C | C1 C2 However, if I was a machine I’d prefer de Bruijn expressions C ::= CON n | VAR i | BND j | ABS C | C1 $$ C2 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

slide-13
SLIDE 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

slide-14
SLIDE 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

slide-15
SLIDE 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

slide-16
SLIDE 16

The Heart of Hybrid

◮ Hybrid includes a datatype exp of de Bruijn expressions:

exp ::= CON con | VAR var | BND bnd

| ABS exp | exp $$ exp

◮ But a user can write expressions of the form

C ::= CON ν | VAR i | BND j

| ABS C | C $$ C | LAM v. C

The Representational Adequacy of Hybrid 7/33

slide-17
SLIDE 17

The Heart of Hybrid

◮ Hybrid includes a datatype exp of de Bruijn expressions:

exp ::= CON con | VAR var | BND bnd

| ABS exp | exp $$ exp

◮ But a user can write expressions of the form

C ::= CON ν | VAR i | BND j

| ABS C | C $$ C | LAM v. C

Hybrid is a hybrid of λ-calculus and de Bruijn notation

The Representational Adequacy of Hybrid 7/33

slide-18
SLIDE 18

◮ User inputs Hybrid expression

LAM v1. (LAM v0. (v1 $$ v0)) † where LAM vi. ξ 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 vi. ξ → ABS (lbnd 0 Λ vi. ξ)

The Representational Adequacy of Hybrid 8/33

slide-19
SLIDE 19

◮ User inputs Hybrid expression

LAM v1. (LAM v0. (v1 $$ v0)) † where LAM vi. ξ 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 vi. ξ → ABS (lbnd 0 Λ vi. ξ)

We need to define lbnd HOL meta-binding Λ. vi

The Representational Adequacy of Hybrid 8/33

slide-20
SLIDE 20

Translating λ-Expressions

An example of − : LE → Hybrid:

OL LF

Let EO = λ v8. λ v2. v8 v3. Then EH

def

= EO

def

= LAM v8. (LAM v2. (v8 $$ VAR 3))

In Hybrid EH is provably equal to ABS (ABS (BND 1 $$ VAR 3))

The Representational Adequacy of Hybrid 9/33

slide-21
SLIDE 21

Key Translation Principles

◮ object level free variables vi are expressed as Hybrid

expressions of the form VAR i;

◮ object level bound variables vj are expressed as Hybrid

(bound) meta-variables vj;

◮ object level abstractions λ vj. E are expressed as Hybrid

expressions LAM vj. C; and

◮ object level applications E1 E2 are expressed as Hybrid

expressions C1 $$ C2. 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

slide-22
SLIDE 22

Defining LAM Via lbnd

Consider the (object level) expression EO

def

= λ v8. λ v2. v8 v2.

This expression is encoded in Hybrid as EH

def

= LAM v8. (LAM v2. (v8 $$ v2))

Thought 1: LAM vi. ξ denotes ABS (Λ vi. ξ). Then EH would be ABS (Λ v8. (ABS (Λ v2. (v8 $$ v2))))

The Representational Adequacy of Hybrid 11/33

slide-23
SLIDE 23

Defining LAM Via lbnd

Consider the (object level) expression EO

def

= λ v8. λ v2. v8 v2.

This expression is encoded in Hybrid as EH

def

= LAM v8. (LAM v2. (v8 $$ v2))

Thought 1: LAM vi. ξ denotes ABS (Λ vi. ξ). Then EH would be ABS (Λ v8. (ABS (Λ v2. (v8 $$ v2)))) EH should equal ABS (Λ v8. (ABS (Λ v2. (BND 1 $$ BND 0)))) but with the “meta binders and variables deleted”.

The Representational Adequacy of Hybrid 11/33

slide-24
SLIDE 24

Defining LAM Via lbnd

Consider the (object level) expression EO

def

= λ v8. λ v2. v8 v2.

This expression is encoded in Hybrid as EH

def

= LAM v8. (LAM v2. (v8 $$ v2))

Thought 2: LAM vi. ξ denotes ABS (lbnd0(Λ vi. ξ)) and where (hopefully!)

LAM v8. (LAM v2. (v8 $$ v2)) = ABS (lbnd0(Λ v8. ABS (lbnd0(Λ v2. v8 $$ v2)))) = . . . = ABS (BND 1 $$ BND 0)

The Representational Adequacy of Hybrid 11/33

slide-25
SLIDE 25

We try to define lbndn

◮ recurse through the ABS nodes and use n to count them—in

  • rder to compute the bound de Bruijn indices;

◮ recurse over $$ nodes; ◮ and in each case recursively move the meta-binders Λ towards

the bound meta-variables. lbnd0(Λ vi. ABS (C[vi, vj]))

=

ABS (lbnd1(Λ vi. C[vi, vj])) . . .

=

ABS (C[lbndn1(Λ vi. vi), lbndn2(Λ vi. vj)])

The Representational Adequacy of Hybrid 12/33

slide-26
SLIDE 26

We try to define lbndn

◮ recurse through the ABS nodes and use n to count them—in

  • rder to compute the bound de Bruijn indices;

◮ recurse over $$ nodes; ◮ and in each case recursively move the meta-binders Λ towards

the bound meta-variables.

LAM vi. ξ

def

= ABS(lbnd0(Λ vi. ξ))

ABS( lbnd0(Λ vi. ABS (C[vi, vj])))

= ABS(ABS (lbnd1(Λ vi. C[vi, vj])))

. . .

= ABS(ABS (C[lbndn1(Λ vi. vi), lbndn2(Λ vi. vj)]))

The Representational Adequacy of Hybrid 12/33

slide-27
SLIDE 27

We try to define lbndn

◮ recurse through the ABS nodes and use n to count them—in

  • rder to compute the bound de Bruijn indices;

◮ recurse over $$ nodes; ◮ and in each case recursively move the meta-binders Λ towards

the bound meta-variables.

LAM vi. ξ

def

= ABS(lbnd0(Λ vi. ξ))

ABS( lbnd0(Λ vi. ABS (C[vi, vj])))

= ABS(ABS (lbnd1(Λ vi. C[vi, vj])))

. . .

= ABS(ABS (C[lbndn1(Λ vi. vi), lbndn2(Λ vi. vj)])) = ABS(ABS (C[BND n1, lbndn2(Λ vi. vj)]))

The Representational Adequacy of Hybrid 12/33

slide-28
SLIDE 28

We try to define lbndn

◮ recurse through the ABS nodes and use n to count them—in

  • rder to compute the bound de Bruijn indices;

◮ recurse over $$ nodes; ◮ and in each case recursively move the meta-binders Λ towards

the bound meta-variables.

LAM vi. ξ

def

= ABS(lbnd0(Λ vi. ξ))

ABS( lbnd0(Λ vi. ABS (C[vi, vj])))

= ABS(ABS (lbnd1(Λ vi. C[vi, vj])))

. . .

= ABS(ABS (C[lbndn1(Λ vi. vi), lbndn2(Λ vi. vj)])) = ABS(ABS (C[BND n1, lbndn2(Λ vi. vj)])) = ABS(ABS (C[BND n1, vj]))

The Representational Adequacy of Hybrid 12/33

slide-29
SLIDE 29

Example Calculation of LAM Via lbnd

LAM vi. ξ

def

= ABS (lbnd0(Λ vi. ξ)) and hence

LAM v8. (LAM v2. (v8 $$ v2)) = ABS (lbnd0(Λ v8. ABS (lbnd0(Λ v2. v8 $$ v2))))

The Representational Adequacy of Hybrid 13/33

slide-30
SLIDE 30

Example Calculation of LAM Via lbnd

LAM vi. ξ

def

= ABS (lbnd0(Λ vi. ξ)) and hence

LAM v8. (LAM v2. (v8 $$ v2)) = ABS (lbnd0(Λ v8. ABS (lbnd0(Λ v2. v8 $$ v2)))) = ABS (lbnd0(Λ v8. ABS (lbnd0(Λ v2. v8) $$ lbnd0(Λ v2. v2))))

The Representational Adequacy of Hybrid 13/33

slide-31
SLIDE 31

Example Calculation of LAM Via lbnd

LAM vi. ξ

def

= ABS (lbnd0(Λ vi. ξ)) and hence

LAM v8. (LAM v2. (v8 $$ v2)) = ABS (lbnd0(Λ v8. ABS (lbnd0(Λ v2. v8 $$ v2)))) = ABS (lbnd0(Λ v8. ABS (lbnd0(Λ v2. v8) $$ lbnd0(Λ v2. v2)))) = ABS (lbnd0(Λ v8. ABS (v8 $$ BND 0)))

The Representational Adequacy of Hybrid 13/33

slide-32
SLIDE 32

Example Calculation of LAM Via lbnd

LAM vi. ξ

def

= ABS (lbnd0(Λ vi. ξ)) and hence

LAM v8. (LAM v2. (v8 $$ v2)) = ABS (lbnd0(Λ v8. ABS (lbnd0(Λ v2. v8 $$ v2)))) = ABS (lbnd0(Λ v8. ABS (lbnd0(Λ v2. v8) $$ lbnd0(Λ v2. v2)))) = ABS (lbnd0(Λ v8. ABS (v8 $$ BND 0))) = ABS (ABS (lbnd1(Λ v8. v8) $$ lbnd1(Λ v8. (BND 0))))

The Representational Adequacy of Hybrid 13/33

slide-33
SLIDE 33

Example Calculation of LAM Via lbnd

LAM vi. ξ

def

= ABS (lbnd0(Λ vi. ξ)) and hence

LAM v8. (LAM v2. (v8 $$ v2)) = ABS (lbnd0(Λ v8. ABS (lbnd0(Λ v2. v8 $$ v2)))) = ABS (lbnd0(Λ v8. ABS (lbnd0(Λ v2. v8) $$ lbnd0(Λ v2. v2)))) = ABS (lbnd0(Λ v8. ABS (v8 $$ BND 0))) = ABS (ABS (lbnd1(Λ v8. v8) $$ lbnd1(Λ v8. (BND 0)))) = ABS (ABS (BND 1 $$ BND 0))

The Representational Adequacy of Hybrid 13/33

slide-34
SLIDE 34

A Mathematical Model of Hybrid

Θ : (object level) λ-expressions −

→ Hybrid

Task: formally define Θ and prove it representationally adequate.

The Representational Adequacy of Hybrid 14/33

slide-35
SLIDE 35

A Mathematical Model of Hybrid

Θ : LE/∼α −

→ Hybrid

Task: formally define Θ and prove it representationally adequate.

◮ We take the object expressions to be LE/∼α.

The Representational Adequacy of Hybrid 14/33

slide-36
SLIDE 36

A Mathematical Model of Hybrid

Θ : LE/∼α −

→ Hybrid

Task: formally define Θ and prove it representationally adequate.

◮ We take the object expressions to be LE/∼α. ◮ We take Hybrid to be a model of a subset of the system

implemented in Isabelle/HOL.

The Representational Adequacy of Hybrid 14/33

slide-37
SLIDE 37

A Mathematical Model of Hybrid

Θ : LE/∼α −

→ Hybrid

Task: formally define Θ and prove it representationally adequate.

◮ We take the object expressions to be LE/∼α. ◮ We take Hybrid to be a model of a subset of the system

implemented in Isabelle/HOL.

◮ !! Our model is a theory in a logical framework !!:

The Representational Adequacy of Hybrid 14/33

slide-38
SLIDE 38

A Mathematical Model of Hybrid

Θ : LE/∼α −

→ Hybrid

Task: formally define Θ and prove it representationally adequate.

◮ We take the object expressions to be LE/∼α. ◮ We take Hybrid to be a model of a subset of the system

implemented in Isabelle/HOL.

◮ !! Our model is a theory in a logical framework !!: ◮ The meta-variables of the logical framework play the rôle of

Isabelle/HOL meta-variables of implemented Hybrid; and

The Representational Adequacy of Hybrid 14/33

slide-39
SLIDE 39

A Mathematical Model of Hybrid

Θ : LE/∼α −

→ Hybrid

Task: formally define Θ and prove it representationally adequate.

◮ We take the object expressions to be LE/∼α. ◮ We take Hybrid to be a model of a subset of the system

implemented in Isabelle/HOL.

◮ !! Our model is a theory in a logical framework !!: ◮ The meta-variables of the logical framework play the rôle of

Isabelle/HOL meta-variables of implemented Hybrid; and

◮ logical framework binding and application play the rôle of

Isabelle/HOL meta-binding and meta-application respectively.

The Representational Adequacy of Hybrid 14/33

slide-40
SLIDE 40

Hybrid Types and Canonical Expressions

◮ The types are

σ ::= exp | con | var | bnd | σ ⇒ σ

◮ The constants are

N :: con CON :: con ⇒ exp i :: var VAR :: var ⇒ exp j :: bnd BND :: bnd ⇒ exp $$ :: exp ⇒ exp ⇒ exp ABS :: exp ⇒ exp

◮ The inductive definition of canonical forms C is standard . . .

The Representational Adequacy of Hybrid 15/33

slide-41
SLIDE 41

Hybrid Types and Canonical Expressions

Γ(vk) = σ1 ⇒ σ2 ⇒ . . . σn ⇒ γ Γ ⊢can Ci :: σi

(0≤i≤n)

Γ ⊢can vk C :: γ κ :: σ1 ⇒ σ2 ⇒ . . . σn ⇒ γ Γ ⊢can Ci :: σi

(0≤i≤n)

Γ ⊢can κ C :: γ Γ, vk :: σ ⊢can C :: σ′ Γ ⊢can Λ vk. C :: σ ⇒ σ′

Examples: BND 0 Λ vk. BND 0 ABS C

The Representational Adequacy of Hybrid 15/33

slide-42
SLIDE 42

Hybrid Types and Canonical Expressions

Γ(vk) = σ1 ⇒ σ2 ⇒ . . . σn ⇒ γ Γ ⊢can Ci :: σi

(0≤i≤n)

Γ ⊢can vk C :: γ κ :: σ1 ⇒ σ2 ⇒ . . . σn ⇒ γ Γ ⊢can Ci :: σi

(0≤i≤n)

Γ ⊢can κ C :: γ Γ, vk :: σ ⊢can C :: σ′ Γ ⊢can Λ vk. C :: σ ⇒ σ′

Examples: C1 $$ C2 Λ vk. vk $$ VAR 3 ABS (BND 0 $$ v4) and LAM v4. ABS (BND 0 $$ v4) is equal to a canonical expression.

The Representational Adequacy of Hybrid 15/33

slide-43
SLIDE 43

Hybrid Types and Canonical Expressions

Γ(vk) = σ1 ⇒ σ2 ⇒ . . . σn ⇒ γ Γ ⊢can Ci :: σi

(0≤i≤n)

Γ ⊢can vk C :: γ κ :: σ1 ⇒ σ2 ⇒ . . . σn ⇒ γ Γ ⊢can Ci :: σi

(0≤i≤n)

Γ ⊢can κ C :: γ Γ, vk :: σ ⊢can C :: σ′ Γ ⊢can Λ vk. C :: σ ⇒ σ′

We shall define:

CLF σ(Γ)

def

= {C | vi1 :: σ1, . . . , vim :: σm

  • Γ

⊢can C :: σ}

The Representational Adequacy of Hybrid 15/33

slide-44
SLIDE 44

Formally Defining lbnd

If ΓL

exp = vk1 :: exp, . . . , vkm :: exp there is a unique function

lbnd n : CLF exp⇒exp(ΓL

exp) → CLF exp(ΓL exp)

which satisfies the following recursion equations

◮ 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. C2))

◮ lbnd n (Λ vk. ABS C) = ABS (lbnd (n + 1) (Λ vk. C))

The Representational Adequacy of Hybrid 16/33

slide-45
SLIDE 45

de Bruijn Representational Adequacy

Let DB(l) be de Bruijn expressions of level l. Let L = vk1, . . . , vkm. Then there is a function θL : LE/∼α → DB(|L|) where, for example, θǫ[λ v8. λ v2. v8 v3]α

The Representational Adequacy of Hybrid 17/33

slide-46
SLIDE 46

de Bruijn Representational Adequacy

Let DB(l) be de Bruijn expressions of level l. Let L = vk1, . . . , vkm. Then there is a function θL : LE/∼α → DB(|L|) where, for example, θǫ[λ v8. λ v2. v8 v3]α

= ABS (ABS θ[v2,v8]([v8]α [v3]α))

The Representational Adequacy of Hybrid 17/33

slide-47
SLIDE 47

de Bruijn Representational Adequacy

Let DB(l) be de Bruijn expressions of level l. Let L = vk1, . . . , vkm. Then there is a function θL : LE/∼α → DB(|L|) where, for example, θǫ[λ v8. λ v2. v8 v3]α

= ABS (ABS θ[v2,v8]([v8]α [v3]α)) = ABS (ABS (BND (pos v8 [v2, v8]) $$ VAR 3))

The Representational Adequacy of Hybrid 17/33

slide-48
SLIDE 48

de Bruijn Representational Adequacy

Let DB(l) be de Bruijn expressions of level l. Let L = vk1, . . . , vkm. Then there is a function θL : LE/∼α → DB(|L|) where, for example, θǫ[λ v8. λ v2. v8 v3]α

= ABS (ABS θ[v2,v8]([v8]α [v3]α)) = ABS (ABS (BND (pos v8 [v2, v8]) $$ VAR 3)) = ABS (ABS (BND 1 $$ VAR 3))

The Representational Adequacy of Hybrid 17/33

slide-49
SLIDE 49

de Bruijn Representational Adequacy

Theorem

There is a function θ : LE/∼α → DB(0) ⊆ DB which is representationally adequate, that is to say θ is a compositional isomorphism LE/∼α ∼

= DB(0).

The Representational Adequacy of Hybrid 17/33

slide-50
SLIDE 50

de Bruijn Representational Adequacy

Theorem

There is a function θ : LE/∼α → DB(0) ⊆ DB which is representationally adequate, that is to say θ is a compositional isomorphism LE/∼α ∼

= DB(0).

Equivalently B θ is bijective; and CH θ is a compositional homomorphism θ([E]α[[E′]α/vk]) = θ([E]α)[θ([E′]α)/VAR k]

The Representational Adequacy of Hybrid 17/33

slide-51
SLIDE 51

de Bruijn Representational Adequacy

Theorem

There is a function θ : LE/∼α → DB(0) ⊆ DB which is representationally adequate, that is to say θ is a compositional isomorphism LE/∼α ∼

= DB(0).

◮ Shankar (1988) gave a mechanical proof for pure de Bruijn. ◮ Crole (MSCS, 2011) is the first detailed proof for locally

nameless de Bruijn.

The Representational Adequacy of Hybrid 17/33

slide-52
SLIDE 52

Approaching Hybrid Adequacy

There is a well-defined function Θǫ : LE/∼α → Θǫ (LE/∼α) ⊆ CLF exp(ǫ) arising from the family of unique well-defined functions ΘL : LE/∼α → CLF exp(ΓL

exp)

satisfying the recursion equations ΘL ([E1 E2]α)

def

= (ΘL [E1]α) $$ (ΘL [E2]α)

The Representational Adequacy of Hybrid 18/33

slide-53
SLIDE 53

Approaching Hybrid Adequacy

There is a well-defined function Θǫ : LE/∼α → Θǫ (LE/∼α) ⊆ CLF exp(ǫ) arising from the family of unique well-defined functions ΘL : LE/∼α → CLF exp(ΓL

exp)

satisfying the recursion equations ΘL ([λ vi. E]α)

def

= LAM vi. Θvi,L ([E]α)

where we write LAM vi. ξ as an abbreviation for ABS (lbnd 0 (Λ vi. ξ)).

The Representational Adequacy of Hybrid 18/33

slide-54
SLIDE 54

Approaching Hybrid Adequacy

There is a well-defined function Θǫ : LE/∼α → Θǫ (LE/∼α) ⊆ CLF exp(ǫ) arising from the family of unique well-defined functions ΘL : LE/∼α → CLF exp(ΓL

exp)

satisfying the recursion equations ΘL ([vi]α)

def

=

vi if vi ∈ L VAR i if vi ∈ L

The Representational Adequacy of Hybrid 18/33

slide-55
SLIDE 55

Hybrid Adequacy

Theorem

The function Θǫ : LE/∼α → Θǫ (LE/∼α) ⊆ CLF exp(ǫ) is representationally adequate, that is B it is bijective (onto its image); and CH it is a compositional homomorphism which means that Θǫ ([E]α[[E′]α/vk]) = Θǫ ([E]α)[Θǫ ([E′]α)/VAR k]

The Representational Adequacy of Hybrid 19/33

slide-56
SLIDE 56

Example Calculation of Θ

Θǫ [λ v8. λ v2. v8 v3]α

=

LAM v8. LAM v2. Θ[v2,v8]([v8]α [v3]α)

The Representational Adequacy of Hybrid 20/33

slide-57
SLIDE 57

Example Calculation of Θ

Θǫ [λ v8. λ v2. v8 v3]α

=

LAM v8. LAM v2. Θ[v2,v8]([v8]α [v3]α)

=

LAM v8. LAM v2. (Θ[v2,v8][v8]α $$ Θ[v2,v8][v3]α)

The Representational Adequacy of Hybrid 20/33

slide-58
SLIDE 58

Example Calculation of Θ

Θǫ [λ v8. λ v2. v8 v3]α

=

LAM v8. LAM v2. Θ[v2,v8]([v8]α [v3]α)

=

LAM v8. LAM v2. (Θ[v2,v8][v8]α $$ Θ[v2,v8][v3]α)

=

LAM v8. LAM v2. (v8 $$ VAR 3)

The Representational Adequacy of Hybrid 20/33

slide-59
SLIDE 59

Example Calculation of Θ

Θǫ [λ v8. λ v2. v8 v3]α

=

LAM v8. LAM v2. Θ[v2,v8]([v8]α [v3]α)

=

LAM v8. LAM v2. (Θ[v2,v8][v8]α $$ Θ[v2,v8][v3]α)

=

LAM v8. LAM v2. (v8 $$ VAR 3)

=

ABS (lbnd 0 Λ v8. (ABS (lbnd 0 Λ v2. (v8 $$ VAR 3))))

The Representational Adequacy of Hybrid 20/33

slide-60
SLIDE 60

Example Calculation of Θ

Θǫ [λ v8. λ v2. v8 v3]α

=

LAM v8. LAM v2. Θ[v2,v8]([v8]α [v3]α)

=

LAM v8. LAM v2. (Θ[v2,v8][v8]α $$ Θ[v2,v8][v3]α)

=

LAM v8. LAM v2. (v8 $$ VAR 3)

=

ABS (lbnd 0 Λ v8. (ABS (lbnd 0 Λ v2. (v8 $$ VAR 3))))

=

. . .

=

ABS (ABS (BND 1 $$ VAR 3))

The Representational Adequacy of Hybrid 20/33

slide-61
SLIDE 61

Outline Proof of Hybrid Adequacy

LE/∼α ΘL

✲ CLF exp(ΓL

exp)

LE/∼α

  • θL

✲ DB(|L|) ⊂ ι ✲ DB inst 0 L ✲ CLF exp(ΓL

exp)

  • hdb 0 L

✲ DB

LE/∼α

  • θL

✲ DB(|L|)

  • ⊂ ι ✲ DB
  • id

✲ DB

  • We show ΘL exists by

◮ LEMMA proving existence of inst ◮ PROPOSITION showing ΘL = (inst 0 L) ◦ ι ◦ θL

The Representational Adequacy of Hybrid 21/33

slide-62
SLIDE 62

Outline Proof of Hybrid Adequacy

LE/∼α ΘL

✲ CLF exp(ΓL

exp)

LE/∼α

  • θL

✲ DB(|L|) ⊂ ι ✲ DB inst 0 L ✲ CLF exp(ΓL

exp)

  • hdb 0 L

✲ DB

LE/∼α

  • θL

✲ DB(|L|)

  • ⊂ ι ✲ DB
  • id

✲ DB

  • A Proof of Adequacy:

◮ θ = θǫ is representationally adequate (de Bruijn adequacy). ◮ Since Θ = Θǫ = (inst 0 ǫ) ◦ ι ◦ θǫ, then Θǫ is representationally

adequate if inst 0 ǫ is.

The Representational Adequacy of Hybrid 21/33

slide-63
SLIDE 63

Outline Proof of Hybrid Adequacy

LE/∼α ΘL

✲ CLF exp(ΓL

exp)

LE/∼α

  • θL

✲ DB(|L|) ⊂ ι ✲ DB inst 0 L ✲ CLF exp(ΓL

exp)

  • hdb 0 L

✲ DB

LE/∼α

  • θL

✲ DB(|L|)

  • ⊂ ι ✲ DB
  • id

✲ DB

  • PROPOSITION We show inst is injective by

◮ LEMMA proving existence of hdb, and ◮ LEMMA showing hdb is a left inverse for inst.

The Representational Adequacy of Hybrid 21/33

slide-64
SLIDE 64

Outline Proof of Hybrid Adequacy

LE/∼α ΘL

✲ CLF exp(ΓL

exp)

LE/∼α

  • θL

✲ DB(|L|) ⊂ ι ✲ DB inst 0 L ✲ CLF exp(ΓL

exp)

  • hdb 0 L

✲ DB

LE/∼α

  • θL

✲ DB(|L|)

  • ⊂ ι ✲ DB
  • id

✲ DB

  • PROPOSITION We show that inst is a compositional homomorphism by

direct proof (omitted from this talk—see the paper).

The Representational Adequacy of Hybrid 21/33

slide-65
SLIDE 65

Deriving inst

λ v6

  • 2

. λ v8

  • 1

. λ v2

  • . v6 v3

seek Θǫ = (inst 0 ǫ)◦ι ◦ θǫ

λ v2. v6 v3 ΘL

✲ ABS (v6 $$ VAR 3)

λ v2. v6 v3

  • θL

✲ ABS (BND 2 $$ VAR 3) inst 0 L ✲ ABS (v6 $$ VAR 3)

  • where L

def

= [v8, v6]

The Representational Adequacy of Hybrid 22/33

slide-66
SLIDE 66

Deriving inst

λ v6

  • 2

. λ v8

  • 1

. λ v2

  • . v6 v3

inst 0 [v8, v6] (ABS (BND 2 $$ VAR 3)) = ABS (inst 1

  • n

[v8, v6]

L

(BND 2

  • j

$$ VAR 3))

◮ 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

slide-67
SLIDE 67

Deriving inst

λ v6

  • 2

. λ v8

  • 1

. λ v2

  • . v6 v3

inst 0 [v8, v6] (ABS (BND 2 $$ VAR 3)) = ABS (inst 1

  • n

[v8, v6]

L

(BND 2

  • j

$$ VAR 3))

◮ 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

slide-68
SLIDE 68

Deriving inst

λ v6

  • 2

. λ v8

  • 1

. λ v2

  • . v6 v3

inst 0 [v8, v6] (ABS (BND 2 $$ VAR 3)) = ABS (inst 1

  • n

[v8, v6]

L

(BND 2

  • j

$$ VAR 3))

◮ 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

slide-69
SLIDE 69

Deriving inst

λ v6

  • 2

. λ v8

  • 1

. λ v2

  • . v6 v3

inst 0 [v8, v6] (ABS (BND 2 $$ VAR 3)) = ABS (inst 1

  • n

[v8, v6]

L

(BND 2

  • j

$$ VAR 3))

◮ 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

slide-70
SLIDE 70

Deriving inst

λ v6

  • 2

. λ v8

  • 1

. λ v2

  • . v6 v3

inst 0 [v8, v6] (ABS (BND 2 $$ VAR 3)) = ABS (inst 1

  • n

[v8, v6]

L

(BND 2

  • j

$$ VAR 3)) = ABS (v6 $$ VAR 3)

inst n L (BND j)

def

= elt (j − n) L

The Representational Adequacy of Hybrid 22/33

slide-71
SLIDE 71

Lemma

There is a unique function inst n L : DB → CLF exp(ΓL

exp)

which satisfies the recursion equations

◮ inst n L (VAR i) = VAR i ◮

inst n L (BND j)

=

elt (j − n) L if 0 ≤ j − n < |L| BND j

  • therwise

◮ 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

slide-72
SLIDE 72

Example Calculation of inst

inst n [vi1, . . . , vim] D

level counter meta-variables de Bruijn expression

inst 0 [v2, v8] (ABS (BND 1 $$ BND 0 $$ VAR 3))

= ABS (inst 1 [v2, v8] (BND 1 $$ BND 0 $$ VAR 3)) = ABS (inst 1 [v2, v8] (BND 1) $$ . . .

. . . inst 1 [v2, v8] (BND 0) $$ inst 1 [v2, v8] (VAR 3))

= v2 $$ BND 0 $$ VAR 3

The Representational Adequacy of Hybrid 24/33

slide-73
SLIDE 73

Example Calculation of inst

inst n [vi1, . . . , vim] D

level counter meta-variables de Bruijn expression

inst 0 [v2, v8] (ABS (BND 1 $$ BND 0 $$ VAR 3))

= ABS (inst 1 [v2, v8] (BND 1 $$ BND 0 $$ VAR 3)) = ABS (inst 1 [v2, v8] (BND 1) $$ . . .

. . . inst 1 [v2, v8] (BND 0) $$ inst 1 [v2, v8] (VAR 3))

= v2 $$ BND 0 $$ VAR 3

The Representational Adequacy of Hybrid 24/33

slide-74
SLIDE 74

Example Calculation of inst

inst n [vi1, . . . , vim] D

level counter meta-variables de Bruijn expression

inst 0 [v2, v8] (ABS (BND 1 $$ BND 0 $$ VAR 3))

= ABS (inst 1 [v2, v8] (BND 1 $$ BND 0 $$ VAR 3)) = ABS (inst 1 [v2, v8] (BND 1) $$ . . .

. . . inst 1 [v2, v8] (BND 0) $$ inst 1 [v2, v8] (VAR 3))

= v2 $$ BND 0 $$ VAR 3

The Representational Adequacy of Hybrid 24/33

slide-75
SLIDE 75

Example Calculation of inst

inst n [vi1, . . . , vim] D

level counter meta-variables de Bruijn expression

inst 0 [v2, v8] (ABS (BND 1 $$ BND 0 $$ VAR 3))

= ABS (inst 1 [v2, v8] (BND 1 $$ BND 0 $$ VAR 3)) = ABS (inst 1 [v2, v8] (BND 1) $$ . . .

. . . inst 1 [v2, v8] (BND 0) $$ inst 1 [v2, v8] (VAR 3))

= v2 $$ BND 0 $$ VAR 3

The Representational Adequacy of Hybrid 24/33

slide-76
SLIDE 76

Proposition

Θǫ = (inst 0 ǫ) ◦ ι ◦ θǫ

LE/∼α ΘL

✲ CLF exp(ΓL

exp)

LE/∼α

  • θL

✲ DB(|L|) ⊂ ι ✲ DB inst 0 L ✲ CLF exp(ΓL

exp)

  • hdb 0 L

✲ DB

LE/∼α

  • θL

✲ DB(|L|)

  • ⊂ ι ✲ DB
  • id

✲ DB

  • Let’s illustrate the proof . . . uses a key lemma . . .

The Representational Adequacy of Hybrid 25/33

slide-77
SLIDE 77

Lemma

lbnd n (Λ vk. inst n (vk, L) D) = inst (n + 1) L D

Θǫ([λ v8. λ v2. v8 v3]α) = LAM v8. LAM v3. Θ[v2,v8]([v8]α [v3]α) = ABS (lbnd 0 Λ v8. (ABS (lbnd 0 Λ v2. (v8 $$ VAR 3)))) = ABS (lbnd 0 Λ v8. (ABS (. . . . . . lbnd 0 Λ v2. inst 0 [v2, v8] (BND 1 $$ VAR 3)))) = ABS (lbnd 0 Λ v8. (ABS (inst 1 [v8] (BND 1 $$ VAR 3)))) = ABS (lbnd 0 Λ v8. (inst 0 [v8] ABS ((BND 1 $$ VAR 3)))) = ABS (inst 1 ǫ (ABS ((BND 1 $$ VAR 3)))) = inst 0 ǫ (ABS (ABS ((BND 1 $$ VAR 3))) = inst 0 ǫ θǫ([λ v8. λ v2. v8 v3]α)

The Representational Adequacy of Hybrid 25/33

slide-78
SLIDE 78

Lemma

lbnd n (Λ vk. inst n (vk, L) D) = inst (n + 1) L D

Θǫ([λ v8. λ v2. v8 v3]α) = LAM v8. LAM v3. Θ[v2,v8]([v8]α [v3]α) = ABS (lbnd 0 Λ v8. (ABS (lbnd 0 Λ v2. (v8 $$ VAR 3)))) = ABS (lbnd 0 Λ v8. (ABS (. . . . . . lbnd 0 Λ v2. inst 0 [v2, v8] (BND 1 $$ VAR 3)))) = ABS (lbnd 0 Λ v8. (ABS (inst 1 [v8] (BND 1 $$ VAR 3)))) = ABS (lbnd 0 Λ v8. (inst 0 [v8] ABS ((BND 1 $$ VAR 3)))) = ABS (inst 1 ǫ (ABS ((BND 1 $$ VAR 3)))) = inst 0 ǫ (ABS (ABS ((BND 1 $$ VAR 3))) = inst 0 ǫ θǫ([λ v8. λ v2. v8 v3]α)

The Representational Adequacy of Hybrid 25/33

slide-79
SLIDE 79

Lemma

lbnd n (Λ vk. inst n (vk, L) D) = inst (n + 1) L D

Θǫ([λ v8. λ v2. v8 v3]α) = LAM v8. LAM v3. Θ[v2,v8]([v8]α [v3]α) = ABS (lbnd 0 Λ v8. (ABS (lbnd 0 Λ v2. (v8 $$ VAR 3)))) = ABS (lbnd 0 Λ v8. (ABS (. . . . . . lbnd 0 Λ v2. inst 0 [v2, v8] (BND 1 $$ VAR 3)))) = ABS (lbnd 0 Λ v8. (ABS (inst 1 [v8] (BND 1 $$ VAR 3)))) = ABS (lbnd 0 Λ v8. (inst 0 [v8] ABS ((BND 1 $$ VAR 3)))) = ABS (inst 1 ǫ (ABS ((BND 1 $$ VAR 3)))) = inst 0 ǫ (ABS (ABS ((BND 1 $$ VAR 3))) = inst 0 ǫ θǫ([λ v8. λ v2. v8 v3]α)

The Representational Adequacy of Hybrid 25/33

slide-80
SLIDE 80

Lemma

lbnd n (Λ vk. inst n (vk, L) D) = inst (n + 1) L D

Θǫ([λ v8. λ v2. v8 v3]α) = LAM v8. LAM v3. Θ[v2,v8]([v8]α [v3]α) = ABS (lbnd 0 Λ v8. (ABS (lbnd 0 Λ v2. (v8 $$ VAR 3)))) = ABS (lbnd 0 Λ v8. (ABS (. . . . . . lbnd 0 Λ v2. inst 0 [v2, v8] (BND 1 $$ VAR 3)))) = ABS (lbnd 0 Λ v8. (ABS (inst 1 [v8] (BND 1 $$ VAR 3)))) = ABS (lbnd 0 Λ v8. (inst 0 [v8] ABS ((BND 1 $$ VAR 3)))) = ABS (inst 1 ǫ (ABS ((BND 1 $$ VAR 3)))) = inst 0 ǫ (ABS (ABS ((BND 1 $$ VAR 3))) = inst 0 ǫ θǫ([λ v8. λ v2. v8 v3]α)

The Representational Adequacy of Hybrid 25/33

slide-81
SLIDE 81

Lemma

lbnd n (Λ vk. inst n (vk, L) D) = inst (n + 1) L D

Θǫ([λ v8. λ v2. v8 v3]α) = LAM v8. LAM v3. Θ[v2,v8]([v8]α [v3]α) = ABS (lbnd 0 Λ v8. (ABS (lbnd 0 Λ v2. (v8 $$ VAR 3)))) = ABS (lbnd 0 Λ v8. (ABS (. . . . . . lbnd 0 Λ v2. inst 0 [v2, v8] (BND 1 $$ VAR 3)))) = ABS (lbnd 0 Λ v8. (ABS (inst 1 [v8] (BND 1 $$ VAR 3)))) = ABS (lbnd 0 Λ v8. (inst 0 [v8] ABS ((BND 1 $$ VAR 3)))) = ABS (inst 1 ǫ (ABS ((BND 1 $$ VAR 3)))) = inst 0 ǫ (ABS (ABS ((BND 1 $$ VAR 3))) = inst 0 ǫ θǫ([λ v8. λ v2. v8 v3]α)

The Representational Adequacy of Hybrid 25/33

slide-82
SLIDE 82

Proposition

Θǫ = (inst 0 ǫ) ◦ ι ◦ θǫ

Θǫ([λ v8. λ v2. v8 v3]α) = LAM v8. LAM v3. Θ[v2,v8]([v8]α [v3]α) = ABS (lbnd 0 Λ v8. (ABS (lbnd 0 Λ v2. (v8 $$ VAR 3)))) = ABS (lbnd 0 Λ v8. (ABS (. . . . . . lbnd 0 Λ v2. inst 0 [v2, v8] (BND 1 $$ VAR 3)))) = ABS (lbnd 0 Λ v8. (ABS (inst 1 [v8] (BND 1 $$ VAR 3)))) = ABS (lbnd 0 Λ v8. (inst 0 [v8] ABS ((BND 1 $$ VAR 3)))) = ABS (inst 1 ǫ (ABS ((BND 1 $$ VAR 3)))) = inst 0 ǫ (ABS (ABS ((BND 1 $$ VAR 3))) = inst 0 ǫ θǫ([λ v8. λ v2. v8 v3]α)

The Representational Adequacy of Hybrid 25/33

slide-83
SLIDE 83

Defining hdb

Lemma

There is a unique function (an inverse to inst) hdb n L : CLF exp(ΓL

exp) → DB

satisfying the recursion equations

◮ 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

slide-84
SLIDE 84

Proposition

inst is injective. 0 ≤ j − n < |L| hdb n L (inst n L (BND j))

= BND (pos ((elt (j − n) L) L)) + n = BND ((j − n) + n) = BND j

The Representational Adequacy of Hybrid 27/33

slide-85
SLIDE 85

Proposition

inst is injective. 0 ≤ j − n < |L| hdb n L (inst n L (BND j))

= BND (pos ((elt (j − n) L) L)) + n = BND ((j − n) + n) = BND j

The Representational Adequacy of Hybrid 27/33

slide-86
SLIDE 86

Proposition

inst is injective. 0 ≤ j − n < |L| hdb n L (inst n L (BND j))

= BND (pos ((elt (j − n) L) L)) + n = BND ((j − n) + n) = BND j

n > j or j − n ≥ |L| hdb n L (inst n L (BND j)) = hdb n L (BND j) = BND j

The Representational Adequacy of Hybrid 27/33

slide-87
SLIDE 87

Proposition

inst is a compositional homomorphism: see journal paper

The Representational Adequacy of Hybrid 28/33

slide-88
SLIDE 88

Hybrid Representation Results

◮ Suppose ABS C is proper eg

ABS (ABS (BND 0 $$ BND 1)).

The Representational Adequacy of Hybrid 29/33

slide-89
SLIDE 89

Hybrid Representation Results

◮ Suppose ABS C is proper eg

ABS (ABS (BND 0 $$ BND 1)).

◮ Then C is of level 1, and some bound indices may dangle; for

example ABS (BND 0 $$ BND 1).

The Representational Adequacy of Hybrid 29/33

slide-90
SLIDE 90

Hybrid Representation Results

◮ Suppose ABS C is proper eg

ABS (ABS (BND 0 $$ BND 1)).

◮ Then C is of level 1, and some bound indices may dangle; for

example ABS (BND 0 $$ BND 1).

◮ An abstraction is produced by replacing each occurrence of a

dangling index with a meta-variable and then abstracting: Λ v. ABS (BND 0 $$ v).

The Representational Adequacy of Hybrid 29/33

slide-91
SLIDE 91

Hybrid Representation Results

◮ Suppose ABS C is proper eg

ABS (ABS (BND 0 $$ BND 1)).

◮ Then C is of level 1, and some bound indices may dangle; for

example ABS (BND 0 $$ BND 1).

◮ An abstraction is produced by replacing each occurrence of a

dangling index with a meta-variable and then abstracting: Λ v. ABS (BND 0 $$ v). Abstractions feature in the induction rule

∀i. Φ(VAR i) ∀C , C′. proper C ∧ Φ(C) ∧ proper C′ ∧ Φ(C′) = ⇒ Φ(C $$ C′) ∀C. abst C∧ (∀C′. proper C′ = ⇒ Φ(C′) = ⇒ Φ(C C′)) = ⇒ Φ(LAM vi. C vi) Φ(C)

The Representational Adequacy of Hybrid 29/33

slide-92
SLIDE 92

Hybrid Representation Results

Proposition

There is a unique function abst n : CLF exp⇒exp(ΓL

exp) → B

which satisfies the following recursion equations

◮ abst n (Λ vk. vk) = T ◮ abst n (Λ vk. vk′) = F

no free meta-variables

◮ abst n (Λ vk. VAR i) = T ◮ abst n (Λ vk. BND j) = n < j

j does not dangle

◮ abst n (Λ vk. C1 $$ C2) =

(abst n (Λ vk. C1)) ∧ (abst n (Λ vk. C2))

◮ abst n (Λ vk. ABS C) = abst (n + 1) (Λ vk. C)

The Representational Adequacy of Hybrid 30/33

slide-93
SLIDE 93

Hybrid Representation Results

We say that an element C ∈ CLF exp⇒exp(ΓL

exp) is an abstraction

if abst 0 C is equal to T.

Theorem

Suppose that C ∈ CLF exp⇒exp(ǫ) and that C is an abstraction. Then there exists [λ vi. E]α ∈ LE/∼α such that Θǫ [λ vi. E]α = LAM vi. C vi

The Representational Adequacy of Hybrid 31/33

slide-94
SLIDE 94

Related Work

◮ Nameless binders introduced by de Bruijn (1972). Free

variables may be named, the locally nameless approach, or specified as indices, the pure approach.

◮ Shankar (1988) investigated bijections between pure de Bruijn

and λ-expressions:

◮ The closest work to ours detailing a bijection. ◮ No need to identify proper expressions, but complicated

substitution.

◮ Our work extends Gordon’s (1994) on locally nameless de

Bruijn expressions and conversions from λ-expressions; he does not formalise α-equivalence classes.

◮ Norrish and Vestergaard (2007) provide a very thorough survey

  • f such bijections. They work with another variation of de

Bruijn expressions . . .

The Representational Adequacy of Hybrid 32/33

slide-95
SLIDE 95

Conclusions

◮ We have shown the Hybrid system representationally

adequate for the λ-calculus.

◮ We have representation results that link Hybrid predicates

and λ-expressions.

◮ Further work could involve the investigation of the notion of

n-ary abstraction and associated higher order induction principles . . .

◮ We might consider a dependently typed version of Hybrid . . . ◮ Categorical and nominal models and techniques . . . especially

presheaf models.

The Representational Adequacy of Hybrid 33/33