skip to main content
research-article
Free Access

Generating collection transformations from proofs

Published:04 January 2021Publication History
Skip Abstract Section

Abstract

Nested relations, built up from atomic types via product and set types, form a rich data model. Over the last decades the nested relational calculus, NRC, has emerged as a standard language for defining transformations on nested collections. NRC is a strongly-typed functional language which allows building up transformations using tupling and projections, a singleton-former, and a map operation that lifts transformations on tuples to transformations on sets.

In this work we describe an alternative declarative method of describing transformations in logic. A formula with distinguished inputs and outputs gives an implicit definition if one can prove that for each input there is only one output that satisfies it. Our main result shows that one can synthesize transformations from proofs that a formula provides an implicit definition, where the proof is in an intuitionistic calculus that captures a natural style of reasoning about nested collections. Our polynomial time synthesis procedure is based on an analog of Craig's interpolation lemma, starting with a provable containment between terms representing nested collections and generating an NRC expression that interpolates between them.

We further show that NRC expressions that implement an implicit definition can be found when there is a classical proof of functionality, not just when there is an intuitionistic one. That is, whenever a formula implicitly defines a transformation, there is an NRC expression that implements it.

References

  1. Serge Abiteboul and Catriel Beeri. 1995. The Power of Languages for the Manipulation of Complex Values. VLDB J. 4, 4 ( 1995 ), 727-794.Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Serge Abiteboul and Nicole Bidoit. 1986. Non First Normal Form Relations: An Algebra Allowing Data Restructuring. J. Comput. Syst. Sci. 33, 3 ( 1986 ), 361-393.Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Foto Afrati and Rada Chirkova. 2019. Answering Queries Using Views. Morgan & Claypool Publishers.Google ScholarGoogle Scholar
  4. H. Andréka, J. X. Madarász, and I. Németi. 2008. Definability of New Universes in Many-sorted logic. ( 2008 ). manuscript available at old.renyi.hu/pub/algebraic-logic/kurzus10/amn-defi.pdf.Google ScholarGoogle Scholar
  5. Michael Benedikt, Balden Ten Cate, Julien Leblay, and Efthymia Tsamoura. 2016. Generating plans from proofs: the interpolation-based approach to query reformulation. Morgan Claypool.Google ScholarGoogle Scholar
  6. Michael Benedikt and Christoph Koch. 2009. From XQuery to Relational Logics. ACM TODS 34, 4 ( 2009 ), 25 : 1-25 : 48.Google ScholarGoogle Scholar
  7. E. W. Beth. 1953. On Padoa's Method in the Theory of Definitions. Indagationes Mathematicae 15 ( 1953 ), 330-339.Google ScholarGoogle Scholar
  8. Mikolaj Bojanczyk, Laure Daviaud, and Shankara Narayanan Krishna. 2018. Regular and First-Order List Functions. In LICS.Google ScholarGoogle Scholar
  9. Peter Buneman, Shamim A. Naqvi, Val Tannen, and Limsoon Wong. 1995. Principles of Programming with Complex Objects and Collection Types. Theor. Comput. Sci. 149, 1 ( 1995 ), 3-48.Google ScholarGoogle Scholar
  10. James Cheney, Sam Lindley, and Philip Wadler. 2014. Query shredding: eficient relational evaluation of queries over nested multisets. In SIGMOD.Google ScholarGoogle Scholar
  11. Thomas Colcombet and Christof Löding. 2007. Transforming structures by set interpretations. Logical Methods in Computer Science 3, 2 ( 2007 ).Google ScholarGoogle Scholar
  12. Ezra Cooper. 2009. The Script-Writer's Dream: How to Write Great SQL in Your Own Language, and Be Sure It Will Succeed. In DBPL.Google ScholarGoogle Scholar
  13. Coq. 2020. The Coq Proof Assistant. ( 2020 ). coq.inria.fr.Google ScholarGoogle Scholar
  14. William Craig. 1957. Three Uses of the Herbrand-Gentzen Theorem in Relating Model Theory and Proof Theory. Journal of Symbolic Logic 22, 3 ( 1957 ), 269-285.Google ScholarGoogle ScholarCross RefCross Ref
  15. Melvin Fitting. 1996. First-order Logic and Automated Theorem Proving. Springer.Google ScholarGoogle Scholar
  16. R. O. Gandy. 1974. Set-theoretic functions for elementary syntax. In Proceedings of Symposia in Pure Mathematics, 13, Part II, Thomas Jech (Ed.). American Mathematical Society, 103-126.Google ScholarGoogle ScholarCross RefCross Ref
  17. Jeremy Gibbons. 2016. Comprehending Ringads-For Phil Wadler, on the Occasion of his 60th Birthday. In A List of Successes That Can Change the World-Essays Dedicated to Philip Wadler on the Occasion of His 60th Birthday.Google ScholarGoogle Scholar
  18. Jeremy Gibbons, Fritz Henglein, Ralf Hinze, and Nicolas Wu. 2018. Relational algebra by way of adjunctions. PACMPL 2, ICFP ( 2018 ).Google ScholarGoogle Scholar
  19. Torsten Grust, Jan Rittinger, and Tom Schreiber. 2010. Avalanche-Safe LINQ Compilation. PVLDB 3, 1-2 ( 2010 ), 162--172.Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Alon Y. Halevy. 2001. Answering queries using views: A survey. VLDB Journal 10, 4 ( 2001 ), 270-294.Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Kryštof Hoder, Laura Kovács, and Andrei Voronkov. 2010. Interpolation and Symbol Elimination in Vampire.Google ScholarGoogle Scholar
  22. Wilfrid Hodges. 1993. Model Theory. Cambridge University Press.Google ScholarGoogle Scholar
  23. Wilfrid Hodges, I.M. Hodkinson, and Dugald Macpherson. 1990. Omega-categoricity, relative categoricity and coordinatisation. Annals of Pure and Applied Logic 46, 2 ( 1990 ), 169-199.Google ScholarGoogle ScholarCross RefCross Ref
  24. Qinheping Hu and Loris D'Antoni. 2017. Automatic Program Inversion Using Symbolic Transducers. In PLDI.Google ScholarGoogle Scholar
  25. Bart Jacobs. 2001. Categorical Logic and Type Theory. Elsevier.Google ScholarGoogle Scholar
  26. R. B. Jensen. 1972. The fine structure of the constructible hierarchy, with a section by Jack Silver. Annals of Mathematical Logic 4 ( 1972 ), 229-308.Google ScholarGoogle Scholar
  27. Christoph Koch. 2006. On the Complexity of Non-recursive XQuery and Functional Query Languages on Complex Values. ACM TODS 31, 4 ( 2006 ), 1215-1256.Google ScholarGoogle Scholar
  28. Christoph Koch, Daniel Lupei, and Val Tannen. 2016. Incremental View Maintenance For Collection Programming. In PODS.Google ScholarGoogle Scholar
  29. Phokion G. Kolaitis. 1990. Implicit Definability on Finite Structures and Unambiguous Computations. In LICS.Google ScholarGoogle Scholar
  30. Maurizio Lenzerini. 2002. Data Integration: A Theoretical Perspective. In PODS.Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. M. Makkai. 1964. On a generalization of a theorem of E. W. Beth. Acta Mathematica Academiae Scientiarum Hungaricae 15 ( 1964 ), 227-235.Google ScholarGoogle Scholar
  32. K.L. McMillan. 2003. Interpolation and SAT-Based Model Checking. In CAV.Google ScholarGoogle Scholar
  33. Erik Meijer, Brian Beckman, and Gavin Bierman. 2006. LINQ: Reconciling Object, Relations and XML in the. NET Framework. In SIGMOD.Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Sergey Melnik, Andrey Gubarev, Jing Jing Long, Geofrey Romer, Shiva Shivakumar, Matt Tolton, and Theo Vassilakis. 2010. Dremel: Interactive Analysis of Web-Scale Datasets. PVLDB 3, 1-2 ( 2010 ), 330-339.Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Andrzej Mostowski. 1949. An undecidable arithmetical statement. Fundamenta Mathematicae 36, 1 ( 1949 ), 143-164.Google ScholarGoogle Scholar
  36. Alan Nash, Luc Segoufin, and Victor Vianu. 2010. Views and queries: Determinacy and rewriting. ACM TODS 35, 3 ( 2010 ).Google ScholarGoogle Scholar
  37. Martin Otto. 2000. An interpolation theorem. Bulletin of Symbolic Logic 6, 4 ( 2000 ), 447-462.Google ScholarGoogle Scholar
  38. Jan Paredaens and Dirk Van Gucht. 1992. Converting Nested Algebra Expressions into Flat Algebra Expressions. ACM TODS 17, 1 ( 1992 ), 65-93.Google ScholarGoogle Scholar
  39. Vladimir Yu. Sazonov. 1985. Collection principle and existential quantifier. Vychislitel'nye sistemy 107 ( 1985 ), 30-39.Google ScholarGoogle Scholar
  40. Luc Segoufin and Victor Vianu. 2005. Views and queries: determinacy and rewriting. In PODS.Google ScholarGoogle Scholar
  41. Saurabh Srivastava, Sumit Gulwani, Swarat Chaudhuri, and Jefrey S. Foster. 2011. Path-Based Inductive Synthesis for Program Inversion. In PLDI.Google ScholarGoogle Scholar
  42. Dan Suciu. 1995. Parallel Programming Languages for Collections. Ph.D. Dissertation. Univ. Pennsylvania.Google ScholarGoogle Scholar
  43. David Toman and Grant Weddell. 2011. Fundamentals of Physical Design and Query Compilation. Morgan Claypool.Google ScholarGoogle Scholar
  44. Alexander Ulrich. 2019. Query Flattening and the Nested Data Parallelism Paradigm. Ph.D. Dissertation. University of Tübingen, Germany. https://publikationen.uni-tuebingen.de/xmlui/handle/10900/87698/Google ScholarGoogle Scholar
  45. Jan Van den Bussche. 2001. Simulation of the Nested Relational Algebra by the Flat Relational Algebra, with an Application to the Complexity of Evaluating Powerset Algebra Expressions. Theoretical Computer Science 254, 1-2 ( 2001 ), 363-377.Google ScholarGoogle Scholar
  46. Limsoon Wong. 1994. Querying Nested Collections. Ph.D. Dissertation. Univ. Pennsylvania.Google ScholarGoogle Scholar
  47. Limsoon Wong. 1996. Normal Forms and Conservative Extension Properties for Query Languages over Collection Types. J. Comput. Syst. Sci. 52, 3 ( 1996 ), 495-505.Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Generating collection transformations from proofs

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      • Published in

        cover image Proceedings of the ACM on Programming Languages
        Proceedings of the ACM on Programming Languages  Volume 5, Issue POPL
        January 2021
        1789 pages
        EISSN:2475-1421
        DOI:10.1145/3445980
        Issue’s Table of Contents

        Copyright © 2021 Owner/Author

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 4 January 2021
        Published in pacmpl Volume 5, Issue POPL

        Permissions

        Request permissions about this article.

        Request Permissions

        Check for updates

        Qualifiers

        • research-article

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!