• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
        • Acre-internals
          • Regex
          • Match-string-at
          • Matchstatelist-measure
          • Parse-primitive
          • Matches-remove-zero-length
          • Parse-repeatop
          • Parse-repeatbase
          • Matchstatelist-in-bounds
          • Parse-range
          • Parse-charset-set
          • Parse-charset-atom
          • Match-regex-locs
          • Parse-octal-charcode
          • Parse-k-backref
          • Parse-g-backref
          • Matchstatelist-all-have-backref
          • Parse-repeatmod
          • Parse-charset-elem
          • Parse-charset-aux
          • Parse-hex-charcode
          • Parse-charset
          • Matchstatelist-indices-lte
          • Matchstatelist-indices-gte
          • Match-exact
          • Matches-add-backref
          • Matchresult
          • Preproc-legible-aux
          • Maybe-backref
          • Match-charset
          • Undup-equiv
          • Find-substr
          • Maybe-backref-extract-substr
          • Matchstatelist-min-index
          • Matchstate-in-bounds
          • Match-add-backref
          • Undup
            • Backref-alist-in-bounds
            • Backref
            • Matchstate
            • Matchresult->matched-substr
            • Matchresult->captured-substr!
            • Matchresult->captured-substr
            • Maybe-backref-in-bounds
            • Matchmode
            • Backref-extract-substr
            • Charset-range
            • Matchstate-measure
            • Backref-in-bounds
            • Rev-keys
            • Parse-regex
            • Undup-exec
            • Get-charset
            • Regex-concat2
            • Preproc-legible
            • Matchresult-in-bounds
            • Regex-disjunct2
            • Backref-alist
            • Named-captures-bindings
            • Captures-bindings
            • Matchstatelist
            • Charset-char-regex
            • Repeatmod-p
          • Parse-and-match-regex
          • Match-regex
          • Parse
          • Matchresult->matchedp
          • Match
        • Milawa
        • Smtlink
        • Abnf
        • Vwsim
        • Isar
        • Wp-gen
        • Dimacs-reader
        • Pfcs
        • Legacy-defrstobj
        • Proof-checker-array
        • Soft
        • C
        • Farray
        • Rp-rewriter
        • Instant-runoff-voting
        • Imp-language
        • Sidekick
        • Leftist-trees
        • Java
        • Taspi
        • Bitcoin
        • Riscv
        • Des
        • Ethereum
        • X86isa
        • Sha-2
        • Yul
        • Zcash
        • Proof-checker-itp13
        • Regex
        • ACL2-programming-language
        • Json
        • Jfkr
        • Equational
        • Cryptography
        • Poseidon
        • Where-do-i-place-my-book
        • Axe
        • Bigmems
        • Builtins
        • Execloader
        • Aleo
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Acre-internals

    Undup

    Signature
    (undup x) → new-x
    Arguments
    x — Guard (true-listp x).
    Returns
    new-x — Type (true-listp new-x).

    Definitions and Theorems

    Function: undup

    (defun undup (x)
      (declare (xargs :guard (true-listp x)))
      (let ((__function__ 'undup))
        (declare (ignorable __function__))
        (mbe :logic
             (if (atom x)
                 nil
               (cons (car x)
                     (undup (remove-equal (car x) (cdr x)))))
             :exec (undup-exec x nil))))

    Theorem: true-listp-of-undup

    (defthm true-listp-of-undup
      (b* ((new-x (undup x)))
        (true-listp new-x))
      :rule-classes :rewrite)

    Theorem: undup-exec-is-undup

    (defthm undup-exec-is-undup
     (b* ((?new-x (undup-exec x acc)))
      (equal
        new-x
        (revappend (alist-keys acc)
                   (undup (set-difference-equal x (alist-keys acc)))))))

    Theorem: element-list-p-of-undup

    (defthm element-list-p-of-undup
      (implies (acl2::element-list-p x)
               (acl2::element-list-p (undup x)))
      :rule-classes :rewrite)

    Theorem: consp-of-undup

    (defthm consp-of-undup
      (b* ((?new-x (undup x)))
        (iff (consp new-x) (consp x))))

    Theorem: undup-of-remove

    (defthm undup-of-remove
      (equal (remove k (undup x))
             (undup (remove k x))))

    Theorem: undup-of-undup

    (defthm undup-of-undup
      (equal (undup (undup x)) (undup x)))

    Theorem: undup-of-append

    (defthm undup-of-append
      (equal (undup (append x y))
             (append (undup x)
                     (undup (set-difference$ y x)))))

    Theorem: member-of-undup

    (defthm member-of-undup
      (iff (member k (undup x)) (member k x)))

    Theorem: undup-under-set-equiv

    (defthm undup-under-set-equiv
      (set-equiv (undup x) x))

    Theorem: undup-of-set-difference

    (defthm undup-of-set-difference
      (equal (undup (set-difference$ x y))
             (set-difference$ (undup x) y)))

    Theorem: undup-of-list-fix-x

    (defthm undup-of-list-fix-x
      (equal (undup (list-fix x)) (undup x)))

    Theorem: undup-list-equiv-congruence-on-x

    (defthm undup-list-equiv-congruence-on-x
      (implies (list-equiv x x-equiv)
               (equal (undup x) (undup x-equiv)))
      :rule-classes :congruence)