testing log log program favonia 1 testing map
play

testing log log program favonia 1 Testing map map : . .( ) - PowerPoint PPT Presentation

testing log log program favonia 1 Testing map map : . .( ) list( ) list( ) 2 Testing map map : . .( ) list( ) list( ) * = * = identity function and [0, 1, ,


  1. testing log log program favonia 1

  2. Testing map map : ∀α . ∀β .( α→β ) → list( α ) → list( β ) 2

  3. Testing map map : ∀α . ∀β .( α→β ) → list( α ) → list( β ) α * = β * = ℕ identity function and [0, 1, …, n-1] 2

  4. Testing exists exists : ∀α .( α→ 2) → list( α ) → 2 α * = 2 identity function and all lists 3

  5. Testing pick pick : ∀α . α × α→α α * = 2 (true, false) 4

  6. Theorem [Bernardy et al. ] p : ∀α . (F( α ) →α )×(G( α ) → K) → H( α ) pos pos pos α * = μ F if it exists ρ * : F( α *) →α * catamorphism “roll” 5

  7. Theorem [Bernardy et al. ] p : ∀α . (F( α ) →α )×(G( α ) → K) → H( α ) pos pos pos project embed p : ∀α . P( α ) → H( α ) pos 6

  8. My Problems with Embedding/Projection Type μ F buried under layers of existence theorems. Error-prone: e.g. , wrongly assuming list( α ) ⊆ ℕ ×( ℕ →α ). 7

  9. p : ∀α . P( α ) → H( α ) 8

  10. Logarithmic Conjecture p : ∀α . P( α ) → H( α ) α * = μα .log α P( α ) if it exists 8

  11. Logarithmic Conjecture p : ∀α . P( α ) → H( α ) α * = μα .log α P( α ) if it exists Goal: simple and direct calculation 8

  12. Testing pick pick : ∀α . α × α→α α * = log α ( α × α ) = log α ( α 2 ) = 2 “all locations of α ” “all ways to generate an α -element” 9

  13. log α α = 1 log α K = 0 10

  14. log α α = 1 log α K = 0 log α (A×B) = log α A + log α B log α (A+B) = log α A ∪ log α B A ∪ B ≈ “max(A,B)” can be A+B, ideally more optimized 10

  15. log α α = 1 log α K = 0 log α (A×B) = log α A + log α B log α (A+B) = log α A ∪ log α B A ∪ B ≈ “max(A,B)” can be A+B, ideally more optimized log α (A ∪ B) = log α A ∪ log α B optional 10

  16. log α α = 1 log α K = 0 log α (A×B) = log α A + log α B log α (A+B) = log α A ∪ log α B A ∪ B ≈ “max(A,B)” can be A+B, ideally more optimized log α (A ∪ B) = log α A ∪ log α B optional log α (A → B) = A × log α B “B A ” 10

  17. Testing map map : ∀α . ∀β .( α→β ) → list( α ) → list( β ) 11

  18. Testing map map : ∀α . ∀β .( α→β ) → list( α ) → list( β ) P( α ) = ( α→β ) × list( α ) 11

  19. Testing map map : ∀α . ∀β .( α→β ) → list( α ) → list( β ) P( α ) = ( α→β ) × list( α ) log α P( α ) = log α ( α→β ) + log α list( α ) 11

  20. Testing map map : ∀α . ∀β .( α→β ) → list( α ) → list( β ) P( α ) = ( α→β ) × list( α ) log α P( α ) = log α ( α→β ) + log α list( α ) = α × log α β = α × 0 ≅ 0 11

  21. α Rules of Recursive Logarithm X ≅ P(X) X X log α X ≅ log α P(X) X X 12

  22. α Rules of Recursive Logarithm X ≅ P(X) X X log α X ≅ log α P(X) X X log α ( μ X.P) = μ X ′ .(log α P)[ μ X.P/X] log α X = X ′ 12

  23. Rules of Recursive Logarithm list( α ) = μ X. 1 + α × X log α (list( α )) = μ X ′ . 0 ∪ (1 + X ′ ) ≈ μ X ′ . 1 + X ′ = ℕ log α ( μ X.P) = μ X ′ .(log α P)[ μ X.P/X] log α X = X ′ I will assume 0 ∪ A = A from now on 13

  24. Testing map map : ∀α . ∀β .( α→β ) → list( α ) → list( β ) P( α ) = ( α→β ) × list( α ) log α P( α ) = log α ( α→β ) + log α list( α ) ≈ ℕ ≅ 0 14

  25. Logarithmic Conjecture p : ∀α . P( α ) → H( α ) α * = μα .log α P( α ) if it exists Goal: simple and direct calculation 15

  26. Non-regular Recursion and Change of Bases / Chain Rules N( α ) ≅ 1 + α × N( α × α ) α α 2 α 4 α 8 1 example stolen from Categories of Containers [Abbott et al. ] 16

  27. Non-regular Recursion and Change of Bases / Chain Rules N( α ) ≅ 1 + α × N( α × α ) α α 2 α 4 α 8 1 log α N( α ) ≅ 1 + “log α × α N( α × α )” × log α ( α × α ) N ′ ( α ) ≅ 1 + N ′ ( α × α ) × 2 example stolen from Categories of Containers [Abbott et al. ] 16

  28. α Non-regular Recursion and Change of Bases / Chain Rules P P log α P(Q( α )) = P ′ (Q( α )) × Q ′ ( α ) Q Q 17

  29. α Non-regular Recursion and Change of Bases / Chain Rules P P log α P(Q( α )) = P ′ (Q( α )) × Q ′ ( α ) Q Q Should work for arbitrary P with more equations log α (( α 2 ) 3 ) = 3 × 2 log α ( α 2 × α 2 × α 2 ) = 2 + 2 + 2 17

  30. Non-regular Recursion and Change of Bases / Chain Rules F( α ) ≅ 1 + α + list( α ) × F( α 2 + α 3 ) × list( α ) ( fi nger trees) list( α ) may be optimized to α + α 2 + α 3 + α 4 18

  31. Non-regular Recursion and Change of Bases / Chain Rules F( α ) ≅ 1 + α + list( α ) × F( α 2 + α 3 ) × list( α ) ( fi nger trees) F ′ ( α ) ≅ 1 ∪ ( ℕ + F ′ ( α 2 + α 3 ) × (2 ∪ 3) + ℕ ) list( α ) may be optimized to α + α 2 + α 3 + α 4 18

  32. Corollary of Conjecture p : ∀α . (F( α ) →α )×(G( α ) → K) → H( α ) 19

  33. Corollary of Conjecture p : ∀α . (F( α ) →α )×(G( α ) → K) → H( α ) log α ((F( α ) →α )×(G( α ) → K)) = log α (F( α ) →α ) + log α (G( α ) → K) ) ( 0 F α ≈ ≅ α * ≅ μα .(F( α ) + 0) ≅ μ F 19

  34. Corollary of Conjecture p : ∀α . (F( α ) →α )×(G( α ) → K) → H( α ) log α ((F( α ) →α )×(G( α ) → K)) = log α (F( α ) →α ) + log α (G( α ) → K) ) ( 0 F α ≈ ≅ α * ≅ μα .(F( α ) + 0) ≅ μ F How to plug in ρ *, the catamorphism (“roll”)? 19

  35. Upgraded Logarithmic Conjecture p : ∀α . P( α ) → H( α ) α * = μα .P ′ ( α ) if it exists 20

  36. Upgraded Logarithmic Conjecture p : ∀α . P( α ) → H( α ) α * = μα .P ′ ( α ) if it exists ρ * : P ′ ( α *) → α * catamorphism “roll” 20

  37. Upgraded Logarithmic Conjecture p : ∀α . P( α ) → H( α ) α * = μα .P ′ ( α ) if it exists ρ * : P ′ ( α *) → α * catamorphism “roll” wants: ρ + : something → P( α *) 20

  38. has: ρ * : P ′ ( α *) → α * wants: ρ + : something → P( α *) 21

  39. has: ρ * : P ′ ( α *) → α * wants: ρ + : something → P( α *) ρ * can fi ll in strictly positive positions 21

  40. has: ρ * : P ′ ( α *) → α * wants: ρ + : something → P( α *) ρ * can fi ll in strictly positive positions exists : ∀α .( α→ 2) → list( α ) → 2 21

  41. has: ρ * : P ′ ( α *) → α * wants: ρ + : something → P( α *) ρ * can fi ll in strictly positive positions exists : ∀α .( α→ 2) → list( α ) → 2 something: everything else 21

  42. Killing the Strictly Positive α − = 1 K − = K (A → B) − = A → B − (A×B) − = A − × B − (A ∪ B) − = A − ∪ B − (A+B) − = A − + B − ( μβ .A) − = μβ .A − ρ + : P − ( α *) → P( α *) residual full 22

  43. Corollary of Upgraded Conjecture p : ∀α . (F( α ) →α )×(G( α ) → K) → H( α ) = ((F( α ) →α ) × (G( α ) → K)) − = (F( α ) → 1) × (G( α ) → K) ≅ 1 ρ + (_, g) ≈ ( ρ *, g) with appropriate rules (omitted) ρ + puts ρ * at the right places 23

  44. Problems: Suboptimal Types exists : ∀α .( α→ 2) → list( α ) → 2 α * = ℕ , but α = 2 with id seems better similarly “all”, “toString”, “ fi lter”, etc. 24

  45. Problems: Suboptimal Types exists : ∀α .( α→ 2) → list( α ) → 2 α * = ℕ , but α = 2 with id seems better similarly “all”, “toString”, “ fi lter”, etc. length : ∀α .list( α ) → ℕ α * = ℕ , but α = 1 su ffi ces 24

  46. Problems: Suboptimal Types exists : ∀α .( α→ 2) → list( α ) → 2 α * = ℕ , but α = 2 with id seems better similarly “all”, “toString”, “ fi lter”, etc. length : ∀α .list( α ) → ℕ α * = ℕ , but α = 1 su ffi ces Current: full distinctiveness Next: inspectability 24

  47. Future Work 25

  48. Future Work Conjectures → Theorems 25

  49. Future Work Conjectures → Theorems Greatest fi xed points, etc. 25

  50. Future Work Conjectures → Theorems Greatest fi xed points, etc. Unknown datatypes, not just functions Checker for parts of CMU 15-210 in 2015 General theory under development 25

  51. Some Related Work Testing Polymorphic Properties Jean-Philippe Bernardy, Patrik Jansson, and Koen Claessen Categories of Containers Michael Abbott, Thorsten Altenkirch, and Neil Ghani A semantics for shape C. Barry Jay Species and Functors and Types, Oh My! Brent A. Yorgey 26

  52. Unlike derivatives, logarithms di ff erentiate. credit to Danny Gratzer 27

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