skip to main content
10.1145/3018882.3018886acmconferencesArticle/Chapter ViewAbstractPublication PagespepmConference Proceedingsconference-collections
research-article

Verification of code generators via higher-order model checking

Authors:
Takashi Suwa
University of Tokyo, Japan
,
Takeshi Tsukada
University of Tokyo, Japan
,
Naoki Kobayashi
University of Tokyo, Japan
,
Atsushi Igarashi
Kyoto University, Japan
Authors Info & Claims
Published: 02 January 2017 Publication History

Abstract

Dynamic code generation is useful for optimizing code with respect to information available only at run-time. Writing a code generator is, however, difficult and error prone. We consider a simple language for writing code generators and propose an automated method for verifying code generators. Our method is based on higher-order model checking, and can check that a given code generator can generate only closed, well-typed programs. Compared with typed multi-stage programming languages, our approach is less conservative on the typability of generated programs (i.e., can accept valid code generators that would be rejected by typical multi-stage languages) and can check a wider range of properties of code generators. We have implemented the proposed method and confirmed its effectiveness through experiments.

References

[1]
M. Berger and L. Tratt. Program logics for homogeneous generative run-time meta-programming. Logical Methods in Computer Science, 11(1), 2015.
[2]
C. H. Broadbent and N. Kobayashi. Saturation-based model checking of higher-order recursion schemes. In Proceedings of CSL 2013, volume 23 of LIPIcs, pages 129–148, 2013.
[3]
C. Calcagno, E. Moggi, and T. Sheard. Closed types for a safe imperative MetaML. J. Funct. Program., 13(3):545–571, May 2003.
[4]
C. Calcagno, W. Taha, L. Huang, and X. Leroy. Implementing multistage languages using ASTs, gensym, and reflection. In International Conference on Generative Programming and Component Engineering, pages 57–76, 2003.
[5]
C. Chen and H. Xi. Meta-programming through typeful code representation. In Proc. of ICFP, pages 275–286, 2003.
[6]
W. Choi, B. Aktemur, K. Yi, and M. Tatsuta. Static analysis of multistaged programs via unstaging translation. In ACM SIGPLAN/SIGACT Symposium on Principles of Programming Languages, pages 81–92, Jan. 2011.
[7]
B. Cook, A. Gotsman, A. Podelski, A. Rybalchenko, and M. Y. Vardi. Proving that programs eventually do something good. In Proc. of POPL, pages 265–276. ACM Press, 2007.
[8]
R. Davies. A temporal-logic approach to binding-time analysis. In IEEE Symposium on Logic in Computer Science (LICS’96), pages 184–195, July 1996.
[9]
R. Davies. A temporal-logic approach to binding-time analysis. In Proceedings, 11th Annual IEEE Symposium on Logic in Computer Science, New Brunswick, New Jersey, USA, July 27-30, 1996, pages 184–195. IEEE Computer Society, 1996.
[10]
R. Davies and F. Pfenning. A modal analysis of staged computation. JACM, 48(3):555–604, 2001.
[11]
S. Fogarty, E. Pasalic, J. Siek, and W. Taha. Concoqtion: Indexed types now! In Proc.Proceedings of Workshop on Partial Evaluation and Program Manipulation (PEPM2007), pages 112–121, 2007.
[12]
A. Igarashi and N. Kobayashi. Resource usage analysis. ACM Trans. Prog. Lang. Syst., 27(2):264–313, 2005.
[13]
I.-S. Kim, K. Yi, and C. Calcagno. A polymorphic modal type system for lisp-like multi-staged languages. In ACM SIGPLAN/SIGACT Symposium on Principles of Programming Languages (POPL’06), pages 257–269, Jan. 2006.
[14]
N. Kobayashi. Types and higher-order recursion schemes for verification of higher-order programs. In Proc. of POPL, pages 416–428. ACM Press, 2009.
[15]
N. Kobayashi. Model checking higher-order programs. Journal of the ACM, 60(3), 2013.
[16]
N. Kobayashi and A. Igarashi. Model checking higher-order programs with recursive types. In Proceedings of ESOP 2013, volume 7792 of LNCS. Springer, 2013.
[17]
N. Kobayashi, R. Sato, and H. Unno. Predicate abstraction and CEGAR for higher-order model checking. In Proc. of PLDI, pages 222– 233. ACM Press, 2011.
[18]
N. Kobayashi, N. Tabuchi, and H. Unno. Higher-order multiparameter tree transducers and recursion schemes for program verification. In Proc. of POPL, pages 495–508. ACM Press, 2010.
[19]
Y. Minamide. Static approximation of dynamically generated WWW pages. In Proc.International Conference on World Wide Web, pages 432–441, 2005.
[20]
A. Nanevski and F. Pfenning. Staged computation with names and necessity. J. Funct. Program., 15(5):893–939, 2005.
[21]
C.-H. L. Ong. On model-checking trees generated by higher-order recursion schemes. In LICS 2006, pages 81–90. IEEE Computer Society Press, 2006.
[22]
C.-H. L. Ong and S. Ramsay. Verifying higher-order programs with pattern-matching algebraic data types. In Proc. of POPL, pages 587– 598. ACM Press, 2011.
[23]
S. Ramsay, R. Neatherway, and C.-H. L. Ong. An abstraction refinement approach to higher-order model checking. In Proceedings of POPL 2014, 2014.
[24]
J. Rehof and P. Urzyczyn. Finite combinatory logic with intersection types. In Typed Lambda Calculi and Applications - 10th International Conference, TLCA 2011, Novi Sad, Serbia, June 1-3, 2011. Proceedings, volume 6690, pages 169–183. Springer, 2011.
[25]
R. Sato, H. Unno, and N. Kobayashi. Towards a scalable software model checker for higher-order programs. In Proceedings of PEPM 2013, pages 53–62. ACM Press, 2013.
[26]
T. Sheard and N. Linger. Programming in Ωmega. In Central European Functional Programming School, Second Summer School, CEFP 2007, pages 158–227, 2007.
[27]
M. Shields, T. Sheard, and S. L. Peyton Jones. Dynamic typing as staged type inference. In Proc.ACM SIGPLAN/SIGACT Symposium on Principles of Programming Languages (POPL’98), pages 289–302, 1998.
[28]
W. Taha. A sound reduction semantics for untyped CBN multistage computation. Or, the theory of MetaML is non-trivial. In Proc.Proceedings of Workshop on Partial Evaluation and Program Manipulation (PEPM2000), 2000.
[29]
W. Taha, Z. E.-A. Benaissa, and T. Sheard. Multi-stage programming: Axiomatization and type-safety.
[30]
In Proc.25th International Colloquium on Automata, Languages and Programming (ICALP’98), volume 1443 of LNCS, pages 918–929, Aalborg, Denmark, July 1998.
[31]
[32]
W. Taha and M. F. Nielsen. Environment classifiers. In ACM SIGPLAN/SIGACT Symposium on Principles of Programming Languages (POPL’03), pages 26–37, 2003.
[33]
W. Taha and T. Sheard. Multi-stage programming with explicit annotations. In Proceedings of Workshop on Partial Evaluation and Program Manipulation (PEPM’97), pages 203–217, Amsterdam, Netherlands, 1997.
[34]
T. Tsukada and A. Igarashi. A logical foundation for environment classifiers. Logical Methods in Computer Science, 6(4:8):1–43, Dec. 2010.
[35]
H. Unno, N. Tabuchi, and N. Kobayashi. Verification of treeprocessing programs via higher-order model checking. In Proceedings of APLAS 2010, volume 6461 of LNCS, pages 312–327. Springer, 2010.
[36]
Y. Yuse and A. Igarashi. A modal type system for multi-level generating extensions with persistent code. In Proc.8th ACM SIGPLAN Symposium on Principles and Practice of Declarative Programming (PPDP’06), pages 201–212, Venice, Italy, July 2006.

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
PEPM 2017: Proceedings of the 2017 ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation
January 2017
124 pages
ISBN:9781450347211
DOI:10.1145/3018882
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from Permissions@acm.org

Sponsors

In-Cooperation

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 02 January 2017

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. code generation
  2. higher-order model checking
  3. verification

Qualifiers

  • Research-article

Conference

POPL '17
Sponsor:

Acceptance Rates

Overall Acceptance Rate 66 of 120 submissions, 55%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • 0
    Total Citations
  • 158
    Total Downloads
  • Downloads (Last 12 months)1
  • Downloads (Last 6 weeks)0
Reflects downloads up to 16 Jan 2025

Other Metrics

Citations

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media

Get Access

Get Access

Login options

References

References

[1]
M. Berger and L. Tratt. Program logics for homogeneous generative run-time meta-programming. Logical Methods in Computer Science, 11(1), 2015.
[2]
C. H. Broadbent and N. Kobayashi. Saturation-based model checking of higher-order recursion schemes. In Proceedings of CSL 2013, volume 23 of LIPIcs, pages 129–148, 2013.
[3]
C. Calcagno, E. Moggi, and T. Sheard. Closed types for a safe imperative MetaML. J. Funct. Program., 13(3):545–571, May 2003.
[4]
C. Calcagno, W. Taha, L. Huang, and X. Leroy. Implementing multistage languages using ASTs, gensym, and reflection. In International Conference on Generative Programming and Component Engineering, pages 57–76, 2003.
[5]
C. Chen and H. Xi. Meta-programming through typeful code representation. In Proc. of ICFP, pages 275–286, 2003.
[6]
W. Choi, B. Aktemur, K. Yi, and M. Tatsuta. Static analysis of multistaged programs via unstaging translation. In ACM SIGPLAN/SIGACT Symposium on Principles of Programming Languages, pages 81–92, Jan. 2011.
[7]
B. Cook, A. Gotsman, A. Podelski, A. Rybalchenko, and M. Y. Vardi. Proving that programs eventually do something good. In Proc. of POPL, pages 265–276. ACM Press, 2007.
[8]
R. Davies. A temporal-logic approach to binding-time analysis. In IEEE Symposium on Logic in Computer Science (LICS’96), pages 184–195, July 1996.
[9]
R. Davies. A temporal-logic approach to binding-time analysis. In Proceedings, 11th Annual IEEE Symposium on Logic in Computer Science, New Brunswick, New Jersey, USA, July 27-30, 1996, pages 184–195. IEEE Computer Society, 1996.
[10]
R. Davies and F. Pfenning. A modal analysis of staged computation. JACM, 48(3):555–604, 2001.
[11]
S. Fogarty, E. Pasalic, J. Siek, and W. Taha. Concoqtion: Indexed types now! In Proc.Proceedings of Workshop on Partial Evaluation and Program Manipulation (PEPM2007), pages 112–121, 2007.
[12]
A. Igarashi and N. Kobayashi. Resource usage analysis. ACM Trans. Prog. Lang. Syst., 27(2):264–313, 2005.
[13]
I.-S. Kim, K. Yi, and C. Calcagno. A polymorphic modal type system for lisp-like multi-staged languages. In ACM SIGPLAN/SIGACT Symposium on Principles of Programming Languages (POPL’06), pages 257–269, Jan. 2006.
[14]
N. Kobayashi. Types and higher-order recursion schemes for verification of higher-order programs. In Proc. of POPL, pages 416–428. ACM Press, 2009.
[15]
N. Kobayashi. Model checking higher-order programs. Journal of the ACM, 60(3), 2013.
[16]
N. Kobayashi and A. Igarashi. Model checking higher-order programs with recursive types. In Proceedings of ESOP 2013, volume 7792 of LNCS. Springer, 2013.
[17]
N. Kobayashi, R. Sato, and H. Unno. Predicate abstraction and CEGAR for higher-order model checking. In Proc. of PLDI, pages 222– 233. ACM Press, 2011.
[18]
N. Kobayashi, N. Tabuchi, and H. Unno. Higher-order multiparameter tree transducers and recursion schemes for program verification. In Proc. of POPL, pages 495–508. ACM Press, 2010.
[19]
Y. Minamide. Static approximation of dynamically generated WWW pages. In Proc.International Conference on World Wide Web, pages 432–441, 2005.
[20]
A. Nanevski and F. Pfenning. Staged computation with names and necessity. J. Funct. Program., 15(5):893–939, 2005.
[21]
C.-H. L. Ong. On model-checking trees generated by higher-order recursion schemes. In LICS 2006, pages 81–90. IEEE Computer Society Press, 2006.
[22]
C.-H. L. Ong and S. Ramsay. Verifying higher-order programs with pattern-matching algebraic data types. In Proc. of POPL, pages 587– 598. ACM Press, 2011.
[23]
S. Ramsay, R. Neatherway, and C.-H. L. Ong. An abstraction refinement approach to higher-order model checking. In Proceedings of POPL 2014, 2014.
[24]
J. Rehof and P. Urzyczyn. Finite combinatory logic with intersection types. In Typed Lambda Calculi and Applications - 10th International Conference, TLCA 2011, Novi Sad, Serbia, June 1-3, 2011. Proceedings, volume 6690, pages 169–183. Springer, 2011.
[25]
R. Sato, H. Unno, and N. Kobayashi. Towards a scalable software model checker for higher-order programs. In Proceedings of PEPM 2013, pages 53–62. ACM Press, 2013.
[26]
T. Sheard and N. Linger. Programming in Ωmega. In Central European Functional Programming School, Second Summer School, CEFP 2007, pages 158–227, 2007.
[27]
M. Shields, T. Sheard, and S. L. Peyton Jones. Dynamic typing as staged type inference. In Proc.ACM SIGPLAN/SIGACT Symposium on Principles of Programming Languages (POPL’98), pages 289–302, 1998.
[28]
W. Taha. A sound reduction semantics for untyped CBN multistage computation. Or, the theory of MetaML is non-trivial. In Proc.Proceedings of Workshop on Partial Evaluation and Program Manipulation (PEPM2000), 2000.
[29]
W. Taha, Z. E.-A. Benaissa, and T. Sheard. Multi-stage programming: Axiomatization and type-safety.
[30]
In Proc.25th International Colloquium on Automata, Languages and Programming (ICALP’98), volume 1443 of LNCS, pages 918–929, Aalborg, Denmark, July 1998.
[31]
[32]
W. Taha and M. F. Nielsen. Environment classifiers. In ACM SIGPLAN/SIGACT Symposium on Principles of Programming Languages (POPL’03), pages 26–37, 2003.
[33]
W. Taha and T. Sheard. Multi-stage programming with explicit annotations. In Proceedings of Workshop on Partial Evaluation and Program Manipulation (PEPM’97), pages 203–217, Amsterdam, Netherlands, 1997.
[34]
T. Tsukada and A. Igarashi. A logical foundation for environment classifiers. Logical Methods in Computer Science, 6(4:8):1–43, Dec. 2010.
[35]
H. Unno, N. Tabuchi, and N. Kobayashi. Verification of treeprocessing programs via higher-order model checking. In Proceedings of APLAS 2010, volume 6461 of LNCS, pages 312–327. Springer, 2010.
[36]
Y. Yuse and A. Igarashi. A modal type system for multi-level generating extensions with persistent code. In Proc.8th ACM SIGPLAN Symposium on Principles and Practice of Declarative Programming (PPDP’06), pages 201–212, Venice, Italy, July 2006.