• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
      • Theories
      • Rule-classes
      • Proof-builder
      • Hons-and-memoization
      • Events
      • History
      • Parallelism
      • Programming
      • Start-here
        • Gentle-introduction-to-ACL2-programming
        • ACL2-tutorial
          • Introduction-to-the-theorem-prover
          • Pages Written Especially for the Tours
          • The-method
          • Advanced-features
          • Interesting-applications
          • Tips
          • Alternative-introduction
          • Tidbits
          • Annotated-ACL2-scripts
          • Startup
          • ACL2-as-standalone-program
          • ACL2-sedan
            • Defunc
            • Cgen
            • Ccg
            • Defdata
              • Match
              • Sig
              • Register-data-constructor
              • Register-type
                • Defdata-attach
                • Register-user-combinator
              • ACL2s-user-guide
              • ACL2s-tutorial
              • ACL2s-implementation-notes
              • ACL2s-faq
              • Match
              • ACL2s-intro
              • ACL2s-defaults
              • Definec
              • ACL2s-utilities
              • ACL2s-installation
            • Talks
            • Nqthm-to-ACL2
            • Emacs
          • About-ACL2
        • Real
        • Debugging
        • Miscellaneous
        • Output-controls
        • Macros
        • Interfacing-tools
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Testing-utilities
      • Math
    • Defdata
    • Cgen

    Register-type

    Register a name as a defdata type

    Example

    (defun nth-odd-builtin (n) 
      (if (evenp n)
          (1+ n)
        (- n)))
    
    (register-type odd
                   :predicate oddp 
                   :enumerator nth-odd-builtin)

    Introduction

    A defdata type expression can either be a typename, a quoted constant or a combinator or constructor expression. To serve as a typename, a symbol should either have been defined using the defdata macro, or it should have been registered as a defdata type using the register-type macro.

    As an example, after having registered odd above, we can now use odd to define other defdata types, e.g., a list of odd numbers:

    (defdata odds (listof odd))

    General Form:

    (register-type name
                   :predicate pred
                   :enumerator enum
                   [:enum/acc enum2]
                   [:enum/test tenum]
                   [:enum/test/acc tenum2]
                   [:clique tnames]
                   [:normalized-def nexp]
                   [:prettyified-def pexp]
                   ...)
    Consider the above call of register-type. We expect the following guards to be satisfied.
    • pred is a monadic boolean-valued function.
    • enum, tenum are 1-arity functions that take a natural number and return a value of the right type.
    • enum2, tenum2 are 2-arity functions that take a natural number and a random seed and return (mv value seed).
    • The rest of the options are for experts and are not yet documented.