• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
      • Break-rewrite
      • Proof-builder
      • Accumulated-persistence
      • Cgen
        • Defdata
          • Match
          • Sig
            • Register-data-constructor
            • Register-type
            • Defdata-attach
            • Register-user-combinator
          • Test?
          • ACL2s-defaults
          • Prove/cgen
          • Register-type
          • With-timeout
          • Defdata-attach
          • Testing-enabled
          • Defdata-aliasing-enabled
          • Cgen-single-test-timeout
          • Verbosity-level
          • Search-strategy
          • Num-print-counterexamples
          • Cgen-timeout
          • Cgen-local-timeout
          • Num-witnesses
          • Num-trials
          • Num-print-witnesses
          • Test-then-skip-proofs
          • Sampling-method
          • Recursively-fix
          • Num-counterexamples
          • Backtrack-limit
          • Print-cgen-summary
          • Cgen::flush
          • Backtrack-bad-generalizations
          • Use-fixers
          • Thm-no-test
          • Defthmd-no-test
          • Defthm-no-test
        • Forward-chaining-reports
        • Proof-tree
        • Print-gv
        • Dmr
        • With-brr-data
        • Splitter
        • Guard-debug
        • Set-debugger-enable
        • Redo-flat
        • Time-tracker
        • Set-check-invariant-risk
        • Removable-runes
        • Efficiency
        • Explain-near-miss
        • Tail-biting
        • Failed-forcing
        • Sneaky
        • Invariant-risk
        • Failure
        • Measure-debug
        • Dead-events
        • Compare-objects
        • Prettygoals
        • Remove-hyps
        • Type-prescription-debugging
        • Pstack
        • Trace
        • Set-register-invariant-risk
        • Walkabout
        • Disassemble$
        • Nil-goal
        • Cw-gstack
        • Set-guard-msg
        • Find-lemmas
        • Watch
        • Quick-and-dirty-subsumption-replacement-step
        • Profile-all
        • Profile-ACL2
        • Set-print-gv-defaults
        • Minimal-runes
        • Spacewalk
        • Try-gl-concls
        • Near-misses
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
        • Theories
        • Rule-classes
        • Proof-builder
        • Recursion-and-induction
        • Hons-and-memoization
        • Events
        • Parallelism
        • History
        • Programming
        • Operational-semantics
        • Real
        • Start-here
        • Debugging
          • Break-rewrite
          • Proof-builder
          • Accumulated-persistence
          • Cgen
            • Defdata
              • Match
              • Sig
                • Register-data-constructor
                • Register-type
                • Defdata-attach
                • Register-user-combinator
              • Test?
              • ACL2s-defaults
              • Prove/cgen
              • Register-type
              • With-timeout
              • Defdata-attach
              • Testing-enabled
              • Defdata-aliasing-enabled
              • Cgen-single-test-timeout
              • Verbosity-level
              • Search-strategy
              • Num-print-counterexamples
              • Cgen-timeout
              • Cgen-local-timeout
              • Num-witnesses
              • Num-trials
              • Num-print-witnesses
              • Test-then-skip-proofs
              • Sampling-method
              • Recursively-fix
              • Num-counterexamples
              • Backtrack-limit
              • Print-cgen-summary
              • Cgen::flush
              • Backtrack-bad-generalizations
              • Use-fixers
              • Thm-no-test
              • Defthmd-no-test
              • Defthm-no-test
            • Forward-chaining-reports
            • Proof-tree
            • Print-gv
            • Dmr
            • With-brr-data
            • Splitter
            • Guard-debug
            • Set-debugger-enable
            • Redo-flat
            • Time-tracker
            • Set-check-invariant-risk
            • Removable-runes
            • Efficiency
            • Explain-near-miss
            • Tail-biting
            • Failed-forcing
            • Sneaky
            • Invariant-risk
            • Failure
            • Measure-debug
            • Dead-events
            • Compare-objects
            • Prettygoals
            • Remove-hyps
            • Type-prescription-debugging
            • Pstack
            • Trace
            • Set-register-invariant-risk
            • Walkabout
            • Disassemble$
            • Nil-goal
            • Cw-gstack
            • Set-guard-msg
            • Find-lemmas
            • Watch
            • Quick-and-dirty-subsumption-replacement-step
            • Profile-all
            • Profile-ACL2
            • Set-print-gv-defaults
            • Minimal-runes
            • Spacewalk
            • Try-gl-concls
            • Near-misses
          • Miscellaneous
          • Output-controls
          • Macros
          • Interfacing-tools
        • Interfacing-tools
        • Hardware-verification
        • Software-verification
        • Math
        • Testing-utilities
      • Defdata
      • Macro-libraries

      Sig

      Specify type signatures for polymorphic functions

      Examples:

      (sig nthcdr (nat (listof :a)) => (listof :a))
      
      (sig binary-append ((listof :a) (listof :a)) => (listof :a))
      
      (sig nth (nat (listof :a)) => :a 
           :satisfies (< x1 (len x2))) 
      ;; xi corresponds to the ith type appearing in the sig form. For example,
      ;; x1 corresponds to nat and x2 to (listof :a)

      General Form:

      (sig fun-name arg-types => return-type 
           [:satisfies hyp]
           [:hints hints]
           [:gen-rule-classes rule-classes]
           [:rule-classes rule-classes]
           [:verbose t])

      where arg-types is a list of defdata type expressions and return-type is a defdata type expression with the added capability of referring to type variables, which in our syntax are represented using keyword symbols :a, :b, :c, ....

      Note: sig is currently limited to only 12 type variables. Check :pe *allowed-type-vars* to view them. We have never encountered type signatures with more than 3 type variables, so we hope that this is not a limitation in practice. There are several other limitations we impose on sig. If you would like more comprehensive support, contact Pete and Harsh.

      The following keyword arguments are supported by the sig macro:

      • :satisfies -- specify additional dependent type hypotheses.
      • :hints -- ACL2::hints option to the generic type signature.
      • :gen-rule-classes -- ACL2::rule-classes option to the generic type signature.
      • :rule-classes -- ACL2::rule-classes option to the generated theorems.
      • :verbose -- for debugging.