• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
        • Isar
        • Kestrel-utilities
          • Omaps
          • Directed-untranslate
          • Include-book-paths
          • Ubi
          • Numbered-names
          • Digits-any-base
          • Context-message-pair
          • With-auto-termination
          • Make-termination-theorem
          • Theorems-about-true-list-lists
          • Checkpoint-list
          • Sublis-expr+
          • Integers-from-to
          • Prove$
          • Defthm<w
          • System-utilities-non-built-in
            • Pseudo-event-formp
            • Pseudo-event-form-listp
            • Directed-untranslate
            • Irrelevant-formals-info
            • Numbered-names
            • Context-message-pair
            • Prove$
            • Minimize-ruler-extenders
              • Paired-names
              • Orelse
              • Fresh-name-in-world-with-$s
              • Encapsulate-report-errors
              • On-failure
              • Chk-irrelevant-formals-ok
              • Named-formulas
              • Pseudo-event-landmarkp
              • All-program-fns
              • All-logic-fns
              • Trans-eval-error-triple
              • Trans-eval-state
              • Pseudo-tests-and-callsp
              • User-interface
              • Pseudo-command-landmarkp
              • Pseudo-tests-and-calls-listp
              • Pseudo-command-formp
              • Orelse*
              • Identity-macro
            • Integer-range-fix
            • Minimize-ruler-extenders
              • Add-const-to-untranslate-preprocess
              • Unsigned-byte-fix
              • Signed-byte-fix
              • Defthmr
              • Paired-names
              • Unsigned-byte-list-fix
              • Signed-byte-list-fix
              • Show-books
              • Skip-in-book
              • Typed-tuplep
              • List-utilities
              • Checkpoint-list-pretty
              • Defunt
              • Keyword-value-list-to-alist
              • Magic-macroexpand
              • Top-command-number-fn
              • Bits-as-digits-in-base-2
              • Show-checkpoint-list
              • Ubyte11s-as-digits-in-base-2048
              • Named-formulas
              • Bytes-as-digits-in-base-256
              • String-utilities
              • Make-keyword-value-list-from-keys-and-value
              • Defmacroq
              • Integer-range-listp
              • Apply-fn-if-known
              • Trans-eval-error-triple
              • Checkpoint-info-list
              • Previous-subsumer-hints
              • Fms!-lst
              • Zp-listp
              • Trans-eval-state
              • Injections
              • Doublets-to-alist
              • Theorems-about-osets
              • Typed-list-utilities
              • Book-runes-alist
              • User-interface
              • Bits/ubyte11s-digit-grouping
              • Bits/bytes-digit-grouping
              • Message-utilities
              • Subsetp-eq-linear
              • Oset-utilities
              • Strict-merge-sort-<
              • Miscellaneous-enumerations
              • Maybe-unquote
              • Thm<w
              • Defthmd<w
              • Io-utilities
            • Set
            • Soft
            • C
            • Bv
            • Imp-language
            • Event-macros
            • Java
            • Bitcoin
            • Ethereum
            • Yul
            • Zcash
            • ACL2-programming-language
            • Prime-fields
            • Json
            • Syntheto
            • File-io-light
            • Cryptography
            • Number-theory
            • Lists-light
            • Axe
            • Builtins
            • Solidity
            • Helpers
            • Htclient
            • Typed-lists-light
            • Arithmetic-light
          • X86isa
          • Axe
          • Execloader
        • Math
        • Testing-utilities
      • Kestrel-utilities
      • System-utilities-non-built-in

      Minimize-ruler-extenders

      Minimize the ruler-extenders necessary to admit a definition.

      Minimize-ruler-extenders is really two utilities. The first, which we call MIN_NEW below, admits a proposed defun or defund form by declaring a minimal set of ruler-extenders. This MIN_NEW utility uses proof to eliminate ruler-extenders as completely as possible, while still permitting the termination proof to succeed. The second utility, which we call MIN_OLD below, is applied to a function symbol that already has a recursive (but not mutually recursive) definition. Here are examples that illustrate each of these two respective utilities.

      ; MIN_NEW (to admit a proposed definition):
      (minimize-ruler-extenders
       (defun foo (x)
         (car (if (endp x)
                  x
                (cons (foo (cdr x))
                      (evens (if (consp (cdr x))
                                 (foo (cddr x))
                               nil)))))))
      
      ; MIN_OLD (to compute minimal ruler-extenders for an existing definition):
      (defun bar (x)
        (declare (xargs :ruler-extenders :all))
        (mod (if (consp x)
                 (* (bar (car x))
                    (if (consp (cdr x))
                        (ifix (cadr x))
                      17))
               3)
             23))
      (minimize-ruler-extenders bar) ; returns (MOD)

      In the first (MIN_NEW) example above, a minimal set of ruler-extenders — in fact, THE minimal set — is the set {car}. So the definition that is actually submitted, successfully, to ACL2 is obtained by making that explicit:

      ACL2 !>:pe foo
       L         2:x(MINIMIZE-RULER-EXTENDERS (DEFUN FOO # ...))
                    \
      >L             (DEFUN FOO (X)
                            (DECLARE (XARGS :RULER-EXTENDERS (CAR)))
                            (CAR (IF (ENDP X)
                                     X
                                     (CONS (FOO (CDR X))
                                           (EVENS (IF (CONSP (CDR X))
                                                      (FOO (CDDR X))
                                                      NIL))))))
      ACL2 !>

      The input form for the MIN_NEW utility should be a call of defun or defund that defines a function symbol that is not already defined. If that form specifies :ruler-extenders lst, then ACL2 will look for a minimal subsequence of lst that can serve as the ruler-extenders. Otherwise, ACL2 will start by additing an xargs declaration, :ruler-extenders lst, where lst contains every plausible ruler-extender, and then will try to find a minimal subsequence of lst.

      Now we turn to the MIN_OLD utility. This utility is applied to a function symbol F that already has a (singly) recursive definition. It returns a subset of the ruler-extenders R of F that is minimal in the following sense: it provides the same induction-machine as R. (The ``induction-machine'' is an ACL2 data structure representing the scheme used when doing induction based on the recursion in F.)