mechanizing metatheory without typing contexts

Post on 02-Jan-2016

47 Views

Category:

Documents

2 Downloads

Preview:

Click to see full reader

DESCRIPTION

Mechanizing Metatheory without Typing Contexts. Jonghyun Park, Jeongbong Seo, Sungwoo Park, Gyesik Lee* Pohang University of Science and Technology, Korea Hankyong National University, Korea*. TYPES 2011 September 10, 2011. Mechanizing Metatheory. - PowerPoint PPT Presentation

TRANSCRIPT

Mechanizing Metatheory without Typing Contexts

TYPES 2011

September 10, 2011

Jonghyun Park, Jeongbong Seo, Sungwoo Park, Gyesik Lee*Pohang University of Science and Technology, Korea

Hankyong National University, Korea*

2

Mechanizing Metatheory• Formalizing metatheory using proof assistants

• POPLmark Challenge for mechanizing System F<:

3

Techniques for Facilitating Mechanization

• Representing binders – de Bruijn indexes– locally named/nameless representation

• free parameters and bound variables– nominal representation– higher-order abstract syntax

• Quantifying variables– exists-fresh/for-all quantification– cofinite quantification

• eliminates renaming lemmas

4

Structural Lemmas• Due to the use of typing contexts

• Examples

• Often used without proofs in pencil-and-paper proofs• Must be proved in mechanized proofs• The whole development becomes more complex.

5

Entailments vs Hypothetical Proofs

• Entailment relations – syntactic representations of hypothetical proofs– display only hypotheses and conclusion– hide internal structures

• Hypothetical proofs– no structural lemmas necessary– suitable for mechanized proofs

6

Eliminating Typing Contexts• Use the locally nameless/named representation

– bound variables: with binders– free parameters: without binders

• Convert bindings in typing contexts to annotations of free parameters

7

System F>: with Typing Contexts• Definitions

• Judgments

• Type safety

8

System F>: without Typing Contexts

• Definitions– annotate every type parameter with its supertype– annotate every term parameter with its type

• Judgments

9

Unbound Type Variables in Annotations?

• Examples

• Local closure

• Substitutions (propagated into annotations)

) Source of all serious complications

10

No Unbound Type Variables in Annotations

1. Local closure

2. Substitutions(no propagation)

3. Rules

– Cf. Parameter substitution

11

Simpler Lemmas• With typing contexts

– In the proof, we need to show:

• Without typing contexts

12

No Need for Unusual Tricks• With typing contexts (renaming lemma)

– need to show:

– strengthening followed by weakening???• No, because weakening itself requires

renaming.• Without typing contexts: no such complication

13

Type Safety

14

If Unbound Type Variables in Annotations

• Need two lemmas:

• Impossible to prove

15

Equivalence between the Two Systems

• The proof is far from straightforward:

• What is your view?

1. You need to prove the equivalence.

2. You don't need to prove the equivalence.

16

Coq Developments for POPLmark (1A and 2A)

• Representing binders– locally named/nameless

• Quantifying variables– exists-fresh, cofinite

• Consistent programming style

17

Analysis of the Complexity

• Eliminating typing contexts is more effective than the cofinite quantification.

18

Related Work: PTSs with Explicit Contexts (Geuvers et al '10)

• The key idea is the same:– distinguish between parameters and variables– annotate every parameter with its type

• Variable substitutions are not propagated into annotations of parameters.

• Main theorem: correspondence between the two type

systems

• Substantiates our work, and vice versa

19

Conclusion• Three guidelines when eliminating typing contexts

1. all annotations of parameters are locally closed

2. do not propagate variable substitutions into annotations of parameters

3. typing rules generate parameters with locally closed annotations

• A case study confirms the validity of the guidelines– System F extended with linear types

(Mazurak et al '10)• Simple, yet as effective as cofinite quantification!

http://pl.postech.ac.kr/poplmark/

Thank you.

21

Operational Semantics

22

23

24

Equivalence between the Two Systems

top related