• 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
        • 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
          • Non-empty-true-list-listp
        • 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
  • Instant-runoff-voting

Irv-ballot-p

Recognizer for a well-formed IRV ballot

Signature
(irv-ballot-p xs) → *

Definitions and Theorems

Function: irv-ballot-p

(defun irv-ballot-p (xs)
  (declare (xargs :guard t))
  (let ((__function__ 'irv-ballot-p))
    (declare (ignorable __function__))
    (if (consp xs)
        (b* ((one (car xs)) (rest (cdr xs)))
          (and (nat-listp one)
               one (no-duplicatesp-equal one)
               (irv-ballot-p rest)))
      (equal xs nil))))

Theorem: irv-ballot-p-implies-non-empty-true-list-listp

(defthm irv-ballot-p-implies-non-empty-true-list-listp
  (implies (irv-ballot-p xs)
           (non-empty-true-list-listp xs))
  :rule-classes :forward-chaining)

Theorem: irv-ballot-p-cdr

(defthm irv-ballot-p-cdr
  (implies (irv-ballot-p xs)
           (irv-ballot-p (cdr xs))))

Subtopics

Non-empty-true-list-listp
Similar to true-list-listp, except that if x is non-empty, each element of x must be non-nil.