• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
      • Std/lists
      • Std/alists
      • Obags
      • Std/util
      • Std/strings
      • Std/io
      • Std/osets
        • Omaps
        • All-by-membership
        • In
        • Defset
        • Primitives
        • Subset
        • Mergesort
          • Halve-list
          • Mergesort-exec
          • Intersect
          • Union
          • Pick-a-point-subset-strategy
          • Delete
          • Difference
          • Cardinality
          • Set
          • Double-containment
          • Intersectp
        • Std/system
        • Std/basic
        • Std/typed-lists
        • Std/bitsets
        • Std/testing
        • Std/typed-alists
        • Std/stobjs
        • Std-extensions
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Testing-utilities
      • Math
    • Mergesort

    Mergesort-exec

    The implementation of mergesort.

    Definitions and Theorems

    Function: mergesort-exec

    (defun mergesort-exec (x)
           (declare (xargs :guard t))
           (cond ((atom x) nil)
                 ((atom (cdr x))
                  (mbe :logic (insert (car x) nil)
                       :exec (list (car x))))
                 (t (mv-let (part1 part2)
                            (halve-list x)
                            (fast-union (mergesort-exec part1)
                                        (mergesort-exec part2)
                                        nil)))))