Skip to main content
Erschienen in: Journal of Automated Reasoning 3/2020

17.12.2018

Limited Second-Order Functionality in a First-Order Setting

verfasst von: Matt Kaufmann, J Strother Moore

Erschienen in: Journal of Automated Reasoning | Ausgabe 3/2020

Einloggen

Aktivieren Sie unsere intelligente Suche, um passende Fachinhalte oder Patente zu finden.

search-config
loading …

Abstract

We describe how we have defined in ACL2 a weak version of the Common Lisp functional apply, which takes a function and list of actuals and applies the function to the actuals. Our version, called apply$, does not operate on functions but on ordinary objects—symbols and lists representing lambda expressions—some of which are interpreted as functions. We define a syntactic notion of “tameness” to identify the interpretable objects. This makes our apply$ weaker than a true second-order functional but we believe apply$ is powerful enough for many uses in ACL2. To maintain soundness and the conservativity of our Definitional Principle we require that certain hypotheses, called “warrants”, be present in any theorem relying on the behavior of apply$ on non-primitives. Within these constraints we can define “functionals” such as sum and foldr which map tame “functions” over lists and accumulate the results. This allows the ACL2 user to avoid defining specialized recursive functions for each such application. We can prove and use general-purpose lemmas about these “functionals.” We describe the formalization, explain how we keep the Definitional Principle conservative, show examples of useful functions using apply$ and theorems about them, sketch the proof that there is a model of any extension of the system using the new primitives, discuss issues arising in making these functions executable, and show some preliminary performance results.

Sie haben noch keine Lizenz? Dann Informieren Sie sich jetzt über unsere Produkte:

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!

Fußnoten
1
See [19] for a description of the logic and system. For installation instructions and many other resources, see the ACL2 home page [20]. Extensive web-based documentation is available there. In this paper we sometimes refer to documentation by writing “see :DOC \(\textit{x}\),” which means “go to the ACL2 home page [20], click on The User’s Manuals link, then click on the ACL2+Books Manual link and type \(\textit{x}\) into the Jump to box.”
 
2
Optional declare forms may be placed before \(\beta \) but we ignore this for the moment.
 
3
We use “apply$” instead of “apply” because the latter is the corresponding Common Lisp primitive which is a true functional. Apply$ and apply are equal on “tame” “guard verified” function symbols when the actuals satisfy the “guard” of the function. See Sect. 11.
 
4
Formally the symbol F is just obtained from the ASCII code for ‘F’, which is 70, by (intern (coerce (list (code-char 70)) ’string) “ACL2”). The function named f is nowhere to be found!
 
5
This could be fixed by complicating our notion of “Expected Behavior” by making it return a list of values but since the vast majority of ACL2 functions return one value we settled for this simple form and await user complaints.
 
6
Since apply$ (and every other ACL2 function) is total, problematic uses like (apply$ ’RUSSELL ’(RUSSELL)) are legal terms and thus have some semantic values, but we will not specify what they are.
 
7
Because apply$ interprets a LAMBDA object by evaluating the body with ev$ we have to impose restrictions on how ev$ is used to enforce the restrictions on how “functions” are used.
 
8
This syntactic rejection of russell can be skirted by defining it to be (defun russell (fn x) (not (apply$ fn (list x x)))). The first formal of the revised russell is classified as a “function.” (Russell ’EQUAL ’EQUAL) behaves as expected because the supplied “functional” argument, ’EQUAL, is a tame function. But (russell ’RUSSELL ’RUSSELL) does not, because the “functional” argument, ’RUSSELL, is not a tame function.
 
9
An ACL2 “book” is a file of formal definitions and theorems. Many books contain extensive comments and documentation. Thousands of books contributed by the user community are available via GitHub. A standard way of installing ACL2 from GitHub sources will download the community books so they are available as the subdirectory books/ of your local ACL2 directory. The top of the GitHub directory for ACL2 is https://​urldefense.​proofpoint.​com/​v2/​url?​u=​https-3A_​_​github.​com_​acl2_​acl2&​d=​DwIBAg&​c=​vh6FgFnduejNhPPD​0fl_​yRaSfZy8CWbWnIf4​XJhSqx8&​r=​r2aSgYn6PHMQXXme​BiKsnvfFG9T9U5fm​dQ67xEVmgo0&​m=​vRrFUnX1Q3Fr5E71​n8Ud63k_​ILtVVBNdQNbV_​UAOm4E&​s=​NrpdCC6fmnRh_​I8oVVLD24qw6YEla​OcVQiS7xqUk3eg&​e=​. The *.lisp files at the top level of that directory are copies of the ACL2 source files from the ACL2 home page [20]. A particular book may be found by clicking your way down the directory hierarchy. For example, to find books/projects/apply-model/apply.lisp start on the GitHub page above and select books, then projects, etc. If the GitHub books were installed with your ACL2 system you can execute an include-book form to load the book into your session. For example, (include-book “projects/apply-model/apply” :dir :system) will load your local copy of projects/apply-model/apply.lisp. Once a book is loaded into your ACL2 session you may inspect definitions, e.g., with (pe ’apply$), and otherwise experiment with it.
 
10
Following Common Lisp conventions for dealing with global name conflicts, the archival definition of apply$ in the book books/projects/apply-model/apply.lisp is in its own package (i.e., namespace), “MODAPP” (“model of apply$”). This accomplishes two things. First, it allows the “living” apply$ (which is in the “ACL2” package) to evolve without conflict. Second, it shows that the archival apply$, interesting theorems about it, and example constructions of models of it via “doppelgängers” (described below) making warrants provably valid can all be admitted to ACL2 without relying on any built-in knowledge of the “living” apply$ .
 
11
(Caddr \(\textit{args}\)) is a Common Lisp abbreviation for (car (cdr (cdr\(\textit{args}\)))).
 
12
Functions that satisfy all the requirements imposed by apply$ except for the requirement that they return single values have badges in which this component is NIL. Even though apply$ cannot behave as expected on such symbols, the corresponding multiple-valued function might be used in the definition of a single-valued function and we need to track the argument use of the multiple-valued function to determine whether the single-valued function is acceptable. We could allow apply$ to handle multiple-valued functions by complicating the “Expected Behavior” guideline but we have chosen not to.
 
13
ACL2 imposes additional restrictions on its lambda objects, but the LAMBDA objects we are dealing with here are just objects being used as data by apply$ and ev$.
 
14
These kinds of problems can be partially addressed with macros that introduce the required recursive functions and prove the indicated lemmas about them; for example see :DOC deflist and :DOC defdata. In our opinion this is not as elegant as introducing the scion itself as a function that can be directly named and used.
 
15
Inspection of the script in projects/apply-model/report.lisp reveals that we do not use the macro “+” in the LAMBDA object but use its expansion into a function of two arguments, binary-+, because ev$ cannot handle macros. We similarly abbreviate the LAMBDA objects in T9 and T11 below.
 
16
One might be tempted to allow LAMBDA objects containing free variables whose values are determined by the lexical environment. But then apply$ would not be definable as a function. Consider (apply$ ’(LAMBDA (X) PARAMS) ’(1)). The arguments to apply$ are constants, so if apply$ is a function, the value must be a constant regardless of the lexical environment.
 
17
The reader should be aware that our various example definition files are not always compatible. For example, we may define a scion named sum in one file and place its :FN formal as the first formal, and then in another example file define sum so that its :FN formal is the second one.
 
18
Actually, if a G1 function, g, is ancestrally dependent on badge or the tamep functions, we do introduce its doppelgänger, \({{{\texttt {\textit{g!}}}}}\), that instead calls doppelgängers. To see an example of this, look at ok-fnp in books/projects/apply-model/ex2/user-defs.lisp and its doppelgänger, ok-fnp! in books/projects/apply-model/ex2/doppelgängers.lisp.
 
19
For G1 functions with doppelgängers, i.e., those dependent on badge, tamep, etc, it calls the doppelgänger.
 
20
Indeed, except for a relatively small amount of Common Lisp boot-strapping code, ACL2 is written in itself.
 
21
In future work, we may explore the use of conditional rewrite rules instead.
 
Literatur
1.
Zurück zum Zitat Andrews, P.B., Brown, C.E.: TPS: a hybrid automatic-interactive system for developing proofs. J. Appl. Log. 4(4), 367–395 (2006)MathSciNetCrossRef Andrews, P.B., Brown, C.E.: TPS: a hybrid automatic-interactive system for developing proofs. J. Appl. Log. 4(4), 367–395 (2006)MathSciNetCrossRef
2.
Zurück zum Zitat Beeson, M.: Otter-lambda, a theorem-prover with untyped lambda-unification. In: Sutcliffe, G., Schulz, S., Tammet, T. (eds.) Proceedings of the ESFOR Workshop at IJCAR 2004 (2004) Beeson, M.: Otter-lambda, a theorem-prover with untyped lambda-unification. In: Sutcliffe, G., Schulz, S., Tammet, T. (eds.) Proceedings of the ESFOR Workshop at IJCAR 2004 (2004)
3.
Zurück zum Zitat Benzmüller, C., Sultana, N., Paulson, L.C., Theiß, F.: The higher-order prover LEO-II. J. Autom. Reason. 55(4), 389–404 (2015)MathSciNetCrossRef Benzmüller, C., Sultana, N., Paulson, L.C., Theiß, F.: The higher-order prover LEO-II. J. Autom. Reason. 55(4), 389–404 (2015)MathSciNetCrossRef
4.
Zurück zum Zitat Bertot, Y., Castran, P.: Interactive Theorem Proving and Program Development: Coq’Art: The Calculus of Inductive Constructions, 1st edn. Springer, Berlin (2010) Bertot, Y., Castran, P.: Interactive Theorem Proving and Program Development: Coq’Art: The Calculus of Inductive Constructions, 1st edn. Springer, Berlin (2010)
5.
Zurück zum Zitat Blanchette, J.C., Kaliszyk, C., Paulson, L.C., Urban, J.: Hammering towards QED. J. Formaliz. Reason. 9(1), 101–148 (2016)MathSciNetMATH Blanchette, J.C., Kaliszyk, C., Paulson, L.C., Urban, J.: Hammering towards QED. J. Formaliz. Reason. 9(1), 101–148 (2016)MathSciNetMATH
6.
Zurück zum Zitat Boyer, R., Moore, J.S.: The addition of bounded quantification and partial functions to a computational logic and its theorem prover. J. Autom. Reason. 4(2), 117–172 (1988)MathSciNetCrossRef Boyer, R., Moore, J.S.: The addition of bounded quantification and partial functions to a computational logic and its theorem prover. J. Autom. Reason. 4(2), 117–172 (1988)MathSciNetCrossRef
7.
Zurück zum Zitat Boyer, R.S., Moore, J.S.: A Computational Logic Handbook, 2nd edn. Academic Press, New York (1997)MATH Boyer, R.S., Moore, J.S.: A Computational Logic Handbook, 2nd edn. Academic Press, New York (1997)MATH
8.
Zurück zum Zitat Boyer, R.S., Goldschlag, D.M., Kaufmann, M., Moore, J.S.: Functional instantiation in first-order logic. In: Lifschitz, V. (ed.) Artificial Intelligence and Mathematical Theory of Computation: Papers in Honor of John McCarthy, pp. 7–26. Academic Press, London (1991)CrossRef Boyer, R.S., Goldschlag, D.M., Kaufmann, M., Moore, J.S.: Functional instantiation in first-order logic. In: Lifschitz, V. (ed.) Artificial Intelligence and Mathematical Theory of Computation: Papers in Honor of John McCarthy, pp. 7–26. Academic Press, London (1991)CrossRef
9.
Zurück zum Zitat Brock, B., Kaufmann, M., Moore, J.S.: Rewriting with equivalence relations in ACL2. J. Autom. Reason. 40(4), 293–306 (2008)MathSciNetCrossRef Brock, B., Kaufmann, M., Moore, J.S.: Rewriting with equivalence relations in ACL2. J. Autom. Reason. 40(4), 293–306 (2008)MathSciNetCrossRef
10.
Zurück zum Zitat Brown, C.E.: Satallax: an automatic higher-order prover. In: Automated Reasoning: 6th International Joint Conference, IJCAR 2012, Manchester, UK, 26–29 June 2012. Proceedings, pp. 111–117 (2012) Brown, C.E.: Satallax: an automatic higher-order prover. In: Automated Reasoning: 6th International Joint Conference, IJCAR 2012, Manchester, UK, 26–29 June 2012. Proceedings, pp. 111–117 (2012)
11.
Zurück zum Zitat Chamarthi, H., Dillinger, P.C., Manolios, P.: Data definitions in the ACL2 sedan. In: ACL2 ’14, pp. 27–48. EPTCS (2014)CrossRef Chamarthi, H., Dillinger, P.C., Manolios, P.: Data definitions in the ACL2 sedan. In: ACL2 ’14, pp. 27–48. EPTCS (2014)CrossRef
12.
Zurück zum Zitat Goel, S., Hunt, W.A., Kaufmann, M.: Simulation and formal verification of x86 machine-code programs that make system calls. In: Claessen, K., Kuncak, V. (eds.) FMCAD’14: Proceedings of the 14th Conference on Formal Methods in Computer-Aided Design, pp. 91–98. EPFL, Switzerland (2014) Goel, S., Hunt, W.A., Kaufmann, M.: Simulation and formal verification of x86 machine-code programs that make system calls. In: Claessen, K., Kuncak, V. (eds.) FMCAD’14: Proceedings of the 14th Conference on Formal Methods in Computer-Aided Design, pp. 91–98. EPFL, Switzerland (2014)
13.
Zurück zum Zitat Goel, S.: Formal verification of application and system programs based on a validated x86 ISA model. Ph.D. thesis, University of Texas at Austin (2016) Goel, S.: Formal verification of application and system programs based on a validated x86 ISA model. Ph.D. thesis, University of Texas at Austin (2016)
15.
Zurück zum Zitat Gordon, M.J.C., Melham, T.F. (eds.): Introduction to HOL: A Theorem Proving Environment for Higher Order Logic. Cambridge University Press, New York (1993)MATH Gordon, M.J.C., Melham, T.F. (eds.): Introduction to HOL: A Theorem Proving Environment for Higher Order Logic. Cambridge University Press, New York (1993)MATH
16.
Zurück zum Zitat Greve, D., Kaufmann, M., Manolios, P., Moore, J.S., Ray, S., Ruiz-Reina, J.L., Sumners, R., Vroon, D., Wilding, M.: Efficient execution in an automated reasoning environment. J. Funct. Program. 18(01), 15–46 (2008)CrossRef Greve, D., Kaufmann, M., Manolios, P., Moore, J.S., Ray, S., Ruiz-Reina, J.L., Sumners, R., Vroon, D., Wilding, M.: Efficient execution in an automated reasoning environment. J. Funct. Program. 18(01), 15–46 (2008)CrossRef
17.
Zurück zum Zitat Hunt Jr., W.A., Kaufmann, M., Moore, J.S., Slobodova, A.: Industrial hardware and software verification with ACL2. In: Gardner, P., O’Hearn, P., Gordon, M., Morrisett, G., Schneider, F.B. (eds.) Verified Trustworthy Software Systems. Philosophical Transactions A, vol. 374. Royal Society Publishing (2017). https://doi.org/10.1098/rsta.2015.0399 CrossRef Hunt Jr., W.A., Kaufmann, M., Moore, J.S., Slobodova, A.: Industrial hardware and software verification with ACL2. In: Gardner, P., O’Hearn, P., Gordon, M., Morrisett, G., Schneider, F.B. (eds.) Verified Trustworthy Software Systems. Philosophical Transactions A, vol. 374. Royal Society Publishing (2017). https://​doi.​org/​10.​1098/​rsta.​2015.​0399 CrossRef
19.
Zurück zum Zitat Kaufmann, M., Manolios, P., Moore, J.S.: Computer-Aided Reasoning: An Approach. Kluwer Academic Press, Boston (2000)CrossRef Kaufmann, M., Manolios, P., Moore, J.S.: Computer-Aided Reasoning: An Approach. Kluwer Academic Press, Boston (2000)CrossRef
22.
Zurück zum Zitat Kunčar, O.: Correctness of Isabelle’s cyclicity checker: implementability of overloading in proof assistants. In: Proceedings of the 2015 Conference on Certified Programs and Proofs, CPP ’15, pp. 85–94, New York, NY, USA. ACM (2015) Kunčar, O.: Correctness of Isabelle’s cyclicity checker: implementability of overloading in proof assistants. In: Proceedings of the 2015 Conference on Certified Programs and Proofs, CPP ’15, pp. 85–94, New York, NY, USA. ACM (2015)
23.
Zurück zum Zitat McCarthy, J.: Recursive functions of symbolic expressions and their computation by machine (part I). CACM 3(4), 184–195 (1960)CrossRef McCarthy, J.: Recursive functions of symbolic expressions and their computation by machine (part I). CACM 3(4), 184–195 (1960)CrossRef
25.
Zurück zum Zitat Meng, J., Paulson, L.C.: Translating higher-order clauses to first-order clauses. J. Autom. Reason. 40(1), 35–60 (2008)MathSciNetCrossRef Meng, J., Paulson, L.C.: Translating higher-order clauses to first-order clauses. J. Autom. Reason. 40(1), 35–60 (2008)MathSciNetCrossRef
27.
Zurück zum Zitat Paulson, L.C.: ML for the Working Programmer. Cambridge University Press, New York (1991)MATH Paulson, L.C.: ML for the Working Programmer. Cambridge University Press, New York (1991)MATH
28.
Zurück zum Zitat Paulson, L.C.: Isabelle: A Generic Theorem Prover. LNCS 828. Springer, Berlin (1994)CrossRef Paulson, L.C.: Isabelle: A Generic Theorem Prover. LNCS 828. Springer, Berlin (1994)CrossRef
30.
Zurück zum Zitat Reynolds, J.C.: Definitional interpreters for higher-order programming languages. High. Order Symbol. Comput. 11(4), 363–397 (1998)CrossRef Reynolds, J.C.: Definitional interpreters for higher-order programming languages. High. Order Symbol. Comput. 11(4), 363–397 (1998)CrossRef
31.
Zurück zum Zitat Steele Jr., G.L.: Common Lisp the Language, 2nd edn. Digital Press, Burlington (1990)MATH Steele Jr., G.L.: Common Lisp the Language, 2nd edn. Digital Press, Burlington (1990)MATH
Metadaten
Titel
Limited Second-Order Functionality in a First-Order Setting
verfasst von
Matt Kaufmann
J Strother Moore
Publikationsdatum
17.12.2018
Verlag
Springer Netherlands
Erschienen in
Journal of Automated Reasoning / Ausgabe 3/2020
Print ISSN: 0168-7433
Elektronische ISSN: 1573-0670
DOI
https://doi.org/10.1007/s10817-018-09505-9

Weitere Artikel der Ausgabe 3/2020

Journal of Automated Reasoning 3/2020 Zur Ausgabe