the girard reynolds isomorphism
play

The Girard-Reynolds Isomorphism Philip Wadler, University of - PowerPoint PPT Presentation

The Girard-Reynolds Isomorphism Philip Wadler, University of Edinburgh wadler@inf.ed.ac.uk Coincidences Curry-Howard Hindley-Milner Girard-Reynolds John Reynolds (1974) Jean-Yves Girard (1972) John Reynolds (1983) Types, Abstraction and


  1. The Girard-Reynolds Isomorphism Philip Wadler, University of Edinburgh wadler@inf.ed.ac.uk

  2. Coincidences Curry-Howard Hindley-Milner Girard-Reynolds

  3. John Reynolds (1974)

  4. Jean-Yves Girard (1972)

  5. John Reynolds (1983) Types, Abstraction and Parametric Polymorphism Once upon a time, there was a university with a peculiar tenure policy. All faculty were tenured, and could only be dismissed for moral turpitude. What was peculiar was the definition of moral turpitude: making a false statement in class. Needless to say, the university did not teach computer science. However, it had a renowned department of mathematics. One semester, there was such a large enrollment in complex variables that two sections were scheduled. In one section, Professor Descartes announced that a complex number was an ordered pair of reals, and that two complex numbers were equal when their corresponding components were equal. He went on to explain how to convert reals into complex numbers, what “i” was, how to add, multiply, and conjugate complex numbers, and how to find their magnitude.

  6. John Reynolds (1983), continued In the other section, Professor Bessel announced that a complex number was an ordered pair of reals the first of which was nonnegative, and that two complex numbers were equal if their first components were equal and either the first components were zero or the second components differed by a multiple of 2. He then told an entirely different story about converting reals, “i”, addition, multiplication, conjugation, and magnitude. Then, after their first classes, an unfortunate mistake in the registrar’s office caused the two sections to be interchanged. Despite this, neither Descartes nor Bessel ever committed moral turpitude, even though each was judged by the other’s definitions. The reason was that they both had an intuitive understanding of type. Having defined complex numbers and the primitive operations upon them, thereafter they spoke at a level of abstraction that encompassed both of their definitions. The moral of this fable is that: Type structure is a syntactic discipline for enforcing levels of abstraction .

  7. A tale of Two Theorems Girard’s Representation Theorem Every function that can be proved total in second-order Peano arithmetic can be represented in second-order lambda calculus. projection : proofs → terms Reynolds’s Abstraction Theorem Terms in second-order lambda calculus take related arguments to related results, for a suitable notion of logical relation. embedding : terms → proofs

  8. A tale of Two Theorems Girard’s Representation Theorem Every function that can be proved total in second-order Peano arithmetic can be represented in second-order lambda calculus. projection : proofs → terms Reynolds’s Abstraction Theorem Terms in second-order lambda calculus take related arguments to related results, for a suitable notion of logical relation. embedding : terms → proofs

  9. The Curry-Howard homeomorphism LC'90

  10. The Curry-Howard Isomorphism ∀ ⊃ ∧ ∨ F Π → × + ⊥ The Girard-Reynolds Isomorphism ∀ ∀ 2 ∀ 1 → ∀ →

  11. The Curry-Howard Isomorphism ∀ ⊃ ∧ ∨ F Π → × + ⊥ The Girard-Reynolds Isomorphism ∀ ∀ 2 ∀ 1 → ∀ → Rather than enriching the type systems to match logic, we impoverish logic to match the type structure. — Daniel Leivant

  12. Part I The Girard Projection — from Logic to Lambda

  13. Naturals A sort and two operations s N → N , z N N , Define operations by equations (+) N → N → N ( s m ) + n = s ( m + n ) z + n = n

  14. Induction Naturals satisfy induction N ≡ { n N | ∀X N . ( ∀ m N . m ∈ X → s m ∈ X ) → z ∈ X → n ∈ X } Three theorems ∀ n N . n ∈ N → s n ∈ N z ∈ N ∀ m N . ∀ n N . m ∈ N → n ∈ N → m + n ∈ N

  15. Girard projection — from predicates to types N ≡ { n N | ∀X N . ( ∀ m N . m ∈ X → s m ∈ X ) → z ∈ X → n ∈ X } ↓ N ≡ ∀ X. ( X → X ) → ( X → X )

  16. Girard projection — from proofs to terms ∀ n N . n ∈ N → s n ∈ N ↓ s N → N ≡ λn N . Λ X. λs X → X . λz X . s ( n X s z ) z ∈ N ↓ z N ≡ Λ X. λs X → X . λz X . z ∀ m N . ∀ n N . m ∈ N → n ∈ N → m + n ∈ N ↓ (+) N → N → N ≡ λm N . λn N . m N s n

  17. A s ≡ ∀ m N . m ∈ X → s m ∈ X A z ≡ z ∈ X [ n ∈ N ] n β ∀X N . A s → A z → n ∈ X ∀ -E [ A s ] s A s → A z → n ∈ X → -E [ A s ] s [ A z ] z A z → n ∈ X ∀ 1 -E → -E n ∈ X → s n ∈ X n ∈ X → -E s n ∈ X → -I z A z → s n ∈ X → -I s A s → A z → s n ∈ X ∀ -I ∀X N . A s → A z → s n ∈ X β s n ∈ N → -I n n ∈ N → s n ∈ N ∀ 1 -I ∀ n N . n ∈ N → s n ∈ N

  18. [ n N ] ∀ -E ( n X ) ( X → X ) → X → X [ s X → X ] → -E ( n X s ) X → X [ z X ] → -E [ s X → X ] ( n X s z ) X → -E ( s ( n X s z )) X → -I z ( λz X . s ( n X s z )) X → X → -I s ( λs X → X . λz X . s ( n X s z )) ( X → X ) → X → X ∀ -I (Λ X. λs X → X . λz X . s ( n X s z )) N → -I n ( λn N . Λ X. λs X → X . λz X . s ( n X s z )) N → N

  19. Part II The Reynolds Embedding — from Lambda to Logic

  20. The Reynolds embedding — from types to predicates N ≡ ∀ X. ( X → X ) → ( X → X ) ↓ N ∗ ≡ { n N | ∀ X. ∀X X . ∀ s X → X . ( ∀ m X . m ∈ X → s m ∈ X ) → ∀ z X . z ∈ X → n X s z ∈ X }

  21. The Reynolds embedding — from terms to proofs s N → N ↓ ∀ n N . n ∈ N ∗ → s n ∈ N ∗ z N ↓ z ∈ N ∗ (+) N → N → N ↓ ∀ m N . ∀ n N . m ∈ N ∗ → n ∈ N ∗ → m + n ∈ N ∗

  22. Doubling — from predicates to predicates N ∗ ≡ { n N | ∀ X. ∀X X . ∀ s X → X . ( ∀ m X . m ∈ X → s m ∈ X ) → ∀ z X . z ∈ X → n X s z ∈ X } ↓ N ∗‡ ≡ { ( n N , n ′ N ) | ∀ X. ∀ X ′ . ∀X X × X ′ . ∀ s X → X . ∀ s ′ X ′ → X ′ . ( ∀ m X . ∀ m ′ X ′ . ( m, m ′ ) ∈ X → ( s m, s ′ m ′ ) ∈ X ) → ∀ z X . ∀ z ′ X ′ . ( z, z ′ ) ∈ X → ( n X s z, n ′ X ′ s ′ z ′ ) ∈ X }

  23. Doubling — from proofs to proofs ∀ n N . n ∈ N ∗ → s n ∈ N ∗ ↓ ∀ n N , n ′ N . ( n, n ′ ) ∈ N ∗‡ → ( s n, s n ′ ) ∈ N ∗‡ z ∈ N ∗ ↓ ( z , z ) ∈ N ∗‡ ∀ m N . ∀ n N . m ∈ N ∗ → n ∈ N ∗ → m + n ∈ N ∗ ↓ ∀ m N , m ′ N . ∀ n N , n ′ N . ( m, m ′ ) ∈ N ∗‡ → ( n, n ′ ) ∈ N ∗‡ → ( m + n, m ′ + n ′ ) ∈ N ∗‡

  24. The Abstraction Theorem — Reynolds then doubling s N → N ↓ ∀ n N , n ′ N . ( n, n ′ ) ∈ N ∗‡ → ( s n, s n ′ ) ∈ N ∗‡ z N ↓ ( z , z ) ∈ N ∗‡ (+) N → N → N ↓ ∀ m N , m ′ N . ∀ n N , n ′ N . ( m, m ′ ) ∈ N ∗‡ → ( n, n ′ ) ∈ N ∗‡ → ( m + n, m ′ + n ′ ) ∈ N ∗‡

  25. Parametricity and weak parametricity Halving lemma (binary implies unary) ∀ n N , n ′ N . ( n, n ′ ) ∈ N ∗‡ → n ∈ N ∗ Extensiveness ∀ n N , n ′ N . ( n, n ′ ) ∈ N ∗‡ → n = n ′ Parametricity ∀ n N . ( n, n ) ∈ N ∗‡ Weak parametricity (unary implies binary) ∀ n N . n ∈ N ∗ → ( n, n ) ∈ N ∗‡

  26. Part III The Girard-Reynolds Isomorphism

  27. Girard followed by Reynolds N ≡ { n N | ∀X N . ( ∀ m N . m ∈ X → s m ∈ X ) → z ∈ X → n ∈ X } ↓ N ◦ ≡ N ≡ ∀ X. ( X → X ) → ( X → X ) ↓ N ◦∗ ≡ N ∗ ≡ { n N | ∀ X. ∀X X . ∀ s X → X . ( ∀ m X . m ∈ X → s m ∈ X ) → ∀ z X . z ∈ X → n X s z ∈ X }

  28. Girard-Reynolds isomorphism Induction implies unary parametricity ∀ n. n ∈ N → n ∈ N ∗ Binary parametricity is equivalent to induction ∀ n, n ′ . ( n, n ′ ) ∈ N ∗‡ ↔ n = n ′ ∧ n ∈ N Weak parametricity holds iff Girard followed by Reynolds is an isomorphism ( ∀ n. n ∈ N ∗ → ( n, n ) ∈ N ∗‡ ) ↔ ( ∀ n. n ∈ N ∗ ↔ n ∈ N)

  29. Part IV Conclusion

  30. Related work Girard 1972 Reynolds 1974, 1983 B¨ ohm and Beararducci 1985 Leivant 1990 Krivine and Parigot 1990 Mairson 1991 Plotkin and Abadi 1993 Hasegawa 1994 Takeuti 1998

  31. Related work: Models Moggi 1986 Breazu-Tannen and Coquand 1988 Freyd 1989 Hyland, Robinson, and Rosolini 1990 Rummelhoff 2003 Møgelberg 2004

  32. Conclusion The Girard-Reynolds type system is the basis for generics in Java 1.5.

  33. Conclusion The Girard-Reynolds type system is the basis for generics in Java 1.5. Girard and Reynolds will be remembered long after Java is forgotten.

  34. Part V Details

  35. Second-order lambda calculus (F2) Type variables X, Y , Z Types A, B, C ::= X | A → B | ∀ X. B Individual variables x, y, z x A Terms s, t, u ::= λx A . u | | s t | Λ X. u | s A

  36. Second-order lambda calculus (F2) [ x A ] · s A → B t A · · → -E u B ( s t ) B → -I x ( λx A . u ) A → B u B s ∀ X. B ∀ -I X does not escape ∀ -E (Λ X. u ) ∀ X. B ( s A ) B [ A/X ]

  37. Second-order propositional logic (P2) Predicate variables X , Y , Z t C ∈ A C Propositions A , B , C ::= | A → B ∀X C . B | ∀ x C . B | | ∀ X. B X C Predicates A , B , C ::= { x C | A } | Hypothesis labels x , y , z Proofs s , t , u

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