• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
      • Legacy-defrstobj
      • Proof-checker-array
      • Soft
      • C
      • Farray
      • Rp-rewriter
      • 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
        • 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
    • 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))