[Paper Review] Data Definitions in the ACL2 Sedan
This paper presents the defdata framework in ACL2s, a formal verification system, enabling intuitive, pedagogically effective specification of data types such as lists, maps, and records through a declarative macro. By maintaining both predicative (predicate-based) and enumerative (enumeration-based) characterizations, the framework supports automated counterexample generation, type-safe function definitions via defunc, and polymorphic reasoning, significantly enhancing automation and usability in formal reasoning—now widely adopted by both students and advanced users.
We present a data definition framework that enables the convenient specification of data types in ACL2s, the ACL2 Sedan. Our primary motivation for developing the data definition framework was pedagogical. We were teaching undergraduate students how to reason about programs using ACL2s and wanted to provide them with an effective method for defining, testing, and reasoning about data types in the context of an untyped theorem prover. Our framework is now routinely used not only for pedagogical purposes, but also by advanced users. Our framework concisely supports common data definition patterns, e.g. list types, map types, and record types. It also provides support for polymorphic functions. A distinguishing feature of our approach is that we maintain both a predicative and an enumerative characterization of data definitions. In this paper we present our data definition framework via a sequence of examples. We give a complete characterization in terms of tau rules of the inclusion/exclusion relations a data definition induces, under suitable restrictions. The data definition framework is a key component of counterexample generation support in ACL2s, but can be independently used in ACL2, and is available as a community book.
Motivation & Objective
- To address the pedagogical challenge of teaching undergraduate students formal reasoning in ACL2, an untyped theorem prover, by providing a structured way to define and reason about data types.
- To reduce class time wasted on low-level type encoding and debugging by replacing ad hoc cons-based type representations with a high-level, user-friendly data definition system.
- To enable automated counterexample generation in ACL2s by maintaining both predicate and enumeration functions for each data type.
- To support advanced reasoning features such as polymorphic functions and type inclusion/exclusion theorems within the ACL2 framework.
- To make the framework widely accessible by releasing it as a community book for use in standard ACL2.
Proposed method
- The defdata macro defines a new data type using a high-level syntax that specifies type combinations (e.g., lists, records, maps), generating a predicate to recognize elements and an enumerator to generate all elements of the type.
- The framework maintains two characterizations: a predicative one (a predicate) and an enumerative one (a function to enumerate all values), which are used together for counterexample generation.
- It integrates with the Cgen library to automatically generate counterexamples by instantiating variables with values that satisfy their data definitions.
- The system uses tau rules to characterize type relations (e.g., inclusion, exclusion) and automatically generates rewrite rules for reasoning about type hierarchies.
- Polymorphic functions are supported via signature events that instantiate generic functions across known types, generating type-specific theorems via functional instantiation.
- All generated events, including theorems and rule classes, are added to ACL2’s Tau-database, ensuring completeness and enabling scalable reasoning.
Experimental results
Research questions
- RQ1How can data types be specified in a way that is both intuitive for beginners and powerful enough for advanced users in an untyped theorem prover like ACL2?
- RQ2How can data definitions be used to enable automated counterexample generation for invalid conjectures in formal verification?
- RQ3What formal characterization of type relations (e.g., inclusion, exclusion) can be derived from data definitions using tau rules?
- RQ4How can polymorphic functions be supported within a framework that maintains both predicate and enumeration semantics?
- RQ5How can such a framework be made reusable and extensible for the broader ACL2 community?
Key findings
- The defdata framework has been successfully used to teach approximately 1,000 undergraduate students at Northeastern University how to model and reason about programs using ACL2s.
- The framework reduces class time spent on type encoding and debugging by providing a high-level, declarative syntax for defining data types.
- Counterexample generation in ACL2s is significantly enhanced by the enumerative characterization of data types, enabling rapid feedback on incorrect conjectures.
- The system automatically generates useful theorems for type reasoning, including inclusion/exclusion relations and composition laws for record accessors and constructors.
- Polymorphic reasoning is supported through signature events that generate type-specific rewrite rules via functional instantiation, with all rules added to the Tau-database for consistency.
- The framework is now used not only pedagogically but also by advanced users and is available as a community book, ensuring broad accessibility and extensibility.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.