Skip to main content
Top
Published in: Journal of Automated Reasoning 7/2020

01-08-2020

ICE-Based Refinement Type Discovery for Higher-Order Functional Programs

Authors: Adrien Champion, Tomoya Chiba, Naoki Kobayashi, Ryosuke Sato

Published in: Journal of Automated Reasoning | Issue 7/2020

Log in

Activate our intelligent search to find suitable subject content or patents.

search-config
loading …

Abstract

We propose a method for automatically finding refinement types of higher-order function programs. Our method is an extension of the Ice framework of Garg et al. for finding invariants. In addition to the usual positive and negative samples in machine learning, their Ice framework uses implication constraints, which consist of pairs (xy) such that if x satisfies an invariant, so does y. From these constraints, Ice infers inductive invariants effectively. We observe that the implication constraints in the original Ice framework are not suitable for finding invariants of recursive functions with multiple function calls. We thus generalize the implication constraints to those of the form \((\{x_1,\dots ,x_k\}, y)\), which means that if all of \(x_1,\dots ,x_k\) satisfy an invariant, so does y. We extend their algorithms for inferring likely invariants from samples, verifying the inferred invariants, and generating new samples. We have implemented our method and confirmed its effectiveness through experiments.

Dont have a licence yet? Then find out more about our products and how to get one now:

Springer Professional "Wirtschaft+Technik"

Online-Abonnement

Mit Springer Professional "Wirtschaft+Technik" erhalten Sie Zugriff auf:

  • über 102.000 Bücher
  • über 537 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Maschinenbau + Werkstoffe
  • Versicherung + Risiko

Jetzt Wissensvorsprung sichern!

Springer Professional "Wirtschaft"

Online-Abonnement

Mit Springer Professional "Wirtschaft" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 340 Zeitschriften

aus folgenden Fachgebieten:

  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Versicherung + Risiko




Jetzt Wissensvorsprung sichern!

Springer Professional "Technik"

Online-Abonnement

Mit Springer Professional "Technik" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 390 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Maschinenbau + Werkstoffe




 

Jetzt Wissensvorsprung sichern!

Appendix
Available only for authorised users
Footnotes
1
We discuss how to extract these verification conditions in Sect. 2.
 
4
The revision of Z3 in all the experiments is the latest at the time of writing: 5bc4c98 .
 
6
This is consistent with the OCaml results: 151 sat results, 9 unsat from programs RType cannot verify, and 2 unsat from unsafe programs.
 
7
Since the totality of \(f_{\rho }\) is undecidable in general, this check is necessarily heuristic. The check is omitted in the current implementation reported in Sect. 5.3. The implementation is thus unsound, although the unsoundness did not show up in the reported experiments.
 
8
Such as the use of conditional “check-sat” in the check https://​rise4fun.​com/​Z3/​cXot4.
 
10
This evaluation uses HoIce 1.8.1.
 
Literature
1.
go back to reference Arora, S., Barak, B.: Computational Complexity—A Modern Approach. Cambridge University Press, Cambridge (2009)CrossRef Arora, S., Barak, B.: Computational Complexity—A Modern Approach. Cambridge University Press, Cambridge (2009)CrossRef
2.
go back to reference Barrett, C.W., Sebastiani, R., Seshia, S.A., Tinelli, C.: In: Biere, A., Heule, M., Van Maaren, H., Walsh, T. (eds.) Handbook of Satisfiability. Frontiers in Artificial Intelligence and Applications, vol. 185, pp. 825–885. IOS Press, Amsterdam (2009). https://doi.org/10.3233/978-1-58603-929-5-825 Barrett, C.W., Sebastiani, R., Seshia, S.A., Tinelli, C.: In: Biere, A., Heule, M., Van Maaren, H., Walsh, T. (eds.) Handbook of Satisfiability. Frontiers in Artificial Intelligence and Applications, vol. 185, pp. 825–885. IOS Press, Amsterdam (2009). https://​doi.​org/​10.​3233/​978-1-58603-929-5-825
3.
go back to reference Beyer, D.: Competition on software verification—(SV-COMP). In: Flanagan, C., König, B. (eds.) Tools and Algorithms for the Construction and Analysis of Systems—18th International Conference, TACAS 2012, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2012, Tallinn, Estonia, March 24–April 1, 2012. Proceedings, Lecture Notes in Computer Science, vol. 7214, pp. 504–524. Springer, Berlin (2012). https://doi.org/10.1007/978-3-642-28756-5_38 Beyer, D.: Competition on software verification—(SV-COMP). In: Flanagan, C., König, B. (eds.) Tools and Algorithms for the Construction and Analysis of Systems—18th International Conference, TACAS 2012, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2012, Tallinn, Estonia, March 24–April 1, 2012. Proceedings, Lecture Notes in Computer Science, vol. 7214, pp. 504–524. Springer, Berlin (2012). https://​doi.​org/​10.​1007/​978-3-642-28756-5_​38
4.
go back to reference Bjørner, N., Gurfinkel, A., McMillan, K.L., Rybalchenko, A.: Horn clause solvers for program verification. In: Beklemishev, L.D., Blass, A., Dershowitz, N., Finkbeiner, B., Schulte, W. (eds.) Fields of Logic and Computation II—Essays Dedicated to Yuri Gurevich on the Occasion of His 75th Birthday, Lecture Notes in Computer Science, vol. 9300, pp. 24–51. Springer, Berlin (2015). https://doi.org/10.1007/978-3-319-23534-9_2 Bjørner, N., Gurfinkel, A., McMillan, K.L., Rybalchenko, A.: Horn clause solvers for program verification. In: Beklemishev, L.D., Blass, A., Dershowitz, N., Finkbeiner, B., Schulte, W. (eds.) Fields of Logic and Computation II—Essays Dedicated to Yuri Gurevich on the Occasion of His 75th Birthday, Lecture Notes in Computer Science, vol. 9300, pp. 24–51. Springer, Berlin (2015). https://​doi.​org/​10.​1007/​978-3-319-23534-9_​2
5.
go back to reference Bradley, A.R.: SAT-based model checking without unrolling. In: Jhala, R., Schmidt, D.A. (eds.) Verification, Model Checking, and Abstract Interpretation—12th International Conference, VMCAI 2011, Austin, TX, USA, January 23–25, 2011. Proceedings, Lecture Notes in Computer Science, vol. 6538, pp. 70–87. Springer, Berlin (2011). https://doi.org/10.1007/978-3-642-18275-4_7 Bradley, A.R.: SAT-based model checking without unrolling. In: Jhala, R., Schmidt, D.A. (eds.) Verification, Model Checking, and Abstract Interpretation—12th International Conference, VMCAI 2011, Austin, TX, USA, January 23–25, 2011. Proceedings, Lecture Notes in Computer Science, vol. 6538, pp. 70–87. Springer, Berlin (2011). https://​doi.​org/​10.​1007/​978-3-642-18275-4_​7
6.
go back to reference Champion, A., Chiba, T., Kobayashi, N., Sato, R.: Ice-based refinement type discovery for higher-order functional programs. In: Tools and Algorithms for the Construction and Analysis of Systems—24th International Conference, TACAS 2018, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2018, Thessaloniki, Greece, April 14–20, 2018, Proceedings, Part I, pp. 365–384 (2018). https://doi.org/10.1007/978-3-319-89960-2_20 Champion, A., Chiba, T., Kobayashi, N., Sato, R.: Ice-based refinement type discovery for higher-order functional programs. In: Tools and Algorithms for the Construction and Analysis of Systems—24th International Conference, TACAS 2018, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2018, Thessaloniki, Greece, April 14–20, 2018, Proceedings, Part I, pp. 365–384 (2018). https://​doi.​org/​10.​1007/​978-3-319-89960-2_​20
7.
go back to reference Champion, A., Kobayashi, N., Sato, R.: Hoice: an ice-based non-linear horn clause solver. In: Ryu, S. (ed.) Programming Languages and Systems—16th Asian Symposium, APLAS 2018, Wellington, New Zealand, December 2–6, 2018, Proceedings, Lecture Notes in Computer Science, vol. 11275, pp. 146–156. Springer, Berlin (2018). https://doi.org/10.1007/978-3-030-02768-1_8 Champion, A., Kobayashi, N., Sato, R.: Hoice: an ice-based non-linear horn clause solver. In: Ryu, S. (ed.) Programming Languages and Systems—16th Asian Symposium, APLAS 2018, Wellington, New Zealand, December 2–6, 2018, Proceedings, Lecture Notes in Computer Science, vol. 11275, pp. 146–156. Springer, Berlin (2018). https://​doi.​org/​10.​1007/​978-3-030-02768-1_​8
11.
go back to reference Fedyukovich, G., Prabhu, S., Madhukar, K., Gupta, A.: Solving constrained horn clauses using syntax and data. In: Bjørner, N., Gurfinkel, A. (eds.) 2018 Formal Methods in Computer Aided Design, FMCAD 2018, Austin, TX, USA, October 30–November 2, 2018, pp. 1–9. IEEE (2018). https://doi.org/10.23919/FMCAD.2018.8603011 Fedyukovich, G., Prabhu, S., Madhukar, K., Gupta, A.: Solving constrained horn clauses using syntax and data. In: Bjørner, N., Gurfinkel, A. (eds.) 2018 Formal Methods in Computer Aided Design, FMCAD 2018, Austin, TX, USA, October 30–November 2, 2018, pp. 1–9. IEEE (2018). https://​doi.​org/​10.​23919/​FMCAD.​2018.​8603011
15.
go back to reference Hoder, K., Bjørner, N.: Generalized property directed reachability. In: Cimatti, A., Sebastiani, R. (eds.) Theory and Applications of Satisfiability Testing—SAT 2012—15th International Conference, Trento, Italy, June 17–20, 2012. Proceedings, Lecture Notes in Computer Science, vol. 7317, pp. 157–171. Springer, Berlin (2012). https://doi.org/10.1007/978-3-642-31612-8_13 Hoder, K., Bjørner, N.: Generalized property directed reachability. In: Cimatti, A., Sebastiani, R. (eds.) Theory and Applications of Satisfiability Testing—SAT 2012—15th International Conference, Trento, Italy, June 17–20, 2012. Proceedings, Lecture Notes in Computer Science, vol. 7317, pp. 157–171. Springer, Berlin (2012). https://​doi.​org/​10.​1007/​978-3-642-31612-8_​13
16.
go back to reference Hojjat, H., Konecný, F., Garnier, F., Iosif, R., Kuncak, V., Rümmer, P.: A verification toolkit for numerical transition systems—tool paper. In: Giannakopoulou, D., Méry, D. (eds.) FM 2012: Formal Methods—18th International Symposium, Paris, France, August 27–31, 2012. Proceedings, Lecture Notes in Computer Science, vol. 7436, pp. 247–251. Springer, Berlin (2012). https://doi.org/10.1007/978-3-642-32759-9_21 Hojjat, H., Konecný, F., Garnier, F., Iosif, R., Kuncak, V., Rümmer, P.: A verification toolkit for numerical transition systems—tool paper. In: Giannakopoulou, D., Méry, D. (eds.) FM 2012: Formal Methods—18th International Symposium, Paris, France, August 27–31, 2012. Proceedings, Lecture Notes in Computer Science, vol. 7436, pp. 247–251. Springer, Berlin (2012). https://​doi.​org/​10.​1007/​978-3-642-32759-9_​21
20.
go back to reference Kuwahara, T., Terauchi, T., Unno, H., Kobayashi, N.: Automatic termination verification for higher-order functional programs. In: Proceedings of ESOP 2014, LNCS, vol. 8410, pp. 392–411. Springer, Berlin (2014) Kuwahara, T., Terauchi, T., Unno, H., Kobayashi, N.: Automatic termination verification for higher-order functional programs. In: Proceedings of ESOP 2014, LNCS, vol. 8410, pp. 392–411. Springer, Berlin (2014)
21.
go back to reference McMillan, K., Rybalchenko, A.: Computing relational fixed points using interpolation. Technical report (2013) McMillan, K., Rybalchenko, A.: Computing relational fixed points using interpolation. Technical report (2013)
25.
go back to reference Sato, R., Iwayama, N., Kobayashi, N.: Combining higher-order model checking with refinement type inference. In: Proceedings of the 2019 ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation, pp. 47–53. ACM (2019) Sato, R., Iwayama, N., Kobayashi, N.: Combining higher-order model checking with refinement type inference. In: Proceedings of the 2019 ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation, pp. 47–53. ACM (2019)
35.
go back to reference Zhu, H., Magill, S., Jagannathan, S.: A data-driven CHC solver. In: Foster, J.S., Grossman, D. (eds.) Proceedings of the 39th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2018, Philadelphia, PA, USA, June 18–22, 2018, pp. 707–721. ACM (2018). https://doi.org/10.1145/3192366.3192416 Zhu, H., Magill, S., Jagannathan, S.: A data-driven CHC solver. In: Foster, J.S., Grossman, D. (eds.) Proceedings of the 39th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2018, Philadelphia, PA, USA, June 18–22, 2018, pp. 707–721. ACM (2018). https://​doi.​org/​10.​1145/​3192366.​3192416
Metadata
Title
ICE-Based Refinement Type Discovery for Higher-Order Functional Programs
Authors
Adrien Champion
Tomoya Chiba
Naoki Kobayashi
Ryosuke Sato
Publication date
01-08-2020
Publisher
Springer Netherlands
Published in
Journal of Automated Reasoning / Issue 7/2020
Print ISSN: 0168-7433
Electronic ISSN: 1573-0670
DOI
https://doi.org/10.1007/s10817-020-09571-y

Other articles of this Issue 7/2020

Journal of Automated Reasoning 7/2020 Go to the issue

Premium Partner