• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Debugging
    • Projects
      • Apt
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Legacy-defrstobj
      • Prime-field-constraint-systems
      • Proof-checker-array
      • Soft
      • Rp-rewriter
      • Farray
      • Instant-runoff-voting
        • Fairness-criteria
          • Eliminate-candidates
          • Sum-nats
          • Eliminate-other-candidates
          • Clone-p
          • Last-place
            • All-head-to-head-competition-loser-p
            • Non-maj-ind-hint
            • Find-condorcet-loser
            • Last-place-elim-ind-hint
          • Candidate-with-least-nth-place-votes
          • Eliminate-candidate
          • First-choice-of-majority-p
          • Candidate-ids
          • Irv
          • Create-nth-choice-count-alist
          • Irv-alt
          • Irv-ballot-p
          • Majority
          • Number-of-candidates
          • List-elements-equal
          • Number-of-voters
        • Imp-language
        • Sidekick
        • Leftist-trees
        • Taspi
        • Bitcoin
        • Des
        • Ethereum
        • Sha-2
        • Yul
        • Zcash
        • Proof-checker-itp13
        • Bigmem
        • Regex
        • ACL2-programming-language
        • Java
        • C
        • Jfkr
        • X86isa
        • Equational
        • Cryptography
        • Where-do-i-place-my-book
        • Json
        • Built-ins
        • Execloader
        • Solidity
        • Paco
        • Concurrent-programs
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Testing-utilities
      • Math
    • Fairness-criteria

    Last-place

    Index of the last-place vote in xs

    Signature
    (last-place xs) → lp
    Arguments
    xs — Guard (irv-ballot-p xs).
    Returns
    lp — Type (natp lp).

    Definitions and Theorems

    Theorem: posp-number-of-candidates

    (defthm posp-number-of-candidates
            (implies (and (irv-ballot-p xs) (consp xs))
                     (posp (number-of-candidates xs))))

    Function: last-place

    (defun last-place (xs)
           (declare (xargs :guard (irv-ballot-p xs)))
           (let ((__function__ 'last-place))
                (declare (ignorable __function__))
                (if (and (irv-ballot-p xs) (consp xs))
                    (1- (number-of-candidates xs))
                    0)))

    Theorem: natp-of-last-place

    (defthm natp-of-last-place
            (b* ((lp (last-place xs))) (natp lp))
            :rule-classes :type-prescription)

    Theorem: last-place-after-eliminate-candidate

    (defthm last-place-after-eliminate-candidate
            (implies (and (irv-ballot-p xs)
                          (< 1 (number-of-candidates xs)))
                     (equal (last-place (eliminate-candidate id xs))
                            (if (member-equal id (candidate-ids xs))
                                (1- (last-place xs))
                                (last-place xs)))))

    Theorem: last-place-of-cdr-xs

    (defthm last-place-of-cdr-xs
            (implies (irv-ballot-p xs)
                     (<= (last-place (cdr xs))
                         (last-place xs)))
            :rule-classes (:linear :rewrite))