• 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
      • 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
        • Aleobft
          • Aleobft-static
          • Aleobft-stake2
          • Aleobft-dynamic
            • Correctness
            • Definition
              • Initialization
              • Transitions
                • Transitions-receive-certificate
                • Transitions-create-certificate
                • Dags
                • Transitions-advance-round
                • Events-next
                • Events-possiblep
                • Event-next
                • Elections
                • Transitions-commit-anchors
                • Transitions-store-certificate
                • Event-possiblep
                • Anchors
                • Blockchains
                  • Extend-blockchain
                  • Calculate-blockchain
                    • Transactions-from-certificates
                  • Transitions-timer-expires
                • States
                • Events
            • Aleobft-stake
            • Aleobft-proposals
            • Library-extensions
          • Leo
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Blockchains

    Calculate-blockchain

    Calculate a blockchain from a sequence of anchors and a DAG.

    Signature
    (calculate-blockchain anchors dag) → blockchain
    Arguments
    anchors — Guard (certificate-listp anchors).
    dag — Guard (certificate-setp dag).
    Returns
    blockchain — Type (block-listp blockchain).

    We call extend-blockchain starting with the empty blockchain and no committed certificates. We only returns the blockchain, discarding the committed certificate set.

    The blockchain calculated from a sequence of anchors in a backward-closed subset of an unequivocal DAG is the same in the superset. This is based on the analogous property of extend-blockchain.

    The blockchains calculated from a sequence of anchors in two backward-closed, individually and mutually unequivocal DAGs are the same in the two DAGs. This is based on the analogous property of extend-blockchain.

    Definitions and Theorems

    Function: calculate-blockchain

    (defun calculate-blockchain (anchors dag)
      (declare (xargs :guard (and (certificate-listp anchors)
                                  (certificate-setp dag))))
      (let ((__function__ 'calculate-blockchain))
        (declare (ignorable __function__))
        (b* (((mv blockchain &)
              (extend-blockchain anchors dag nil nil)))
          blockchain)))

    Theorem: block-listp-of-calculate-blockchain

    (defthm block-listp-of-calculate-blockchain
      (b* ((blockchain (calculate-blockchain anchors dag)))
        (block-listp blockchain))
      :rule-classes :rewrite)

    Theorem: len-of-calculate-blockchain

    (defthm len-of-calculate-blockchain
      (b* ((?blockchain (calculate-blockchain anchors dag)))
        (equal (len blockchain) (len anchors))))

    Theorem: calculate-blockchain-of-nil

    (defthm calculate-blockchain-of-nil
      (equal (calculate-blockchain nil dag)
             nil))

    Theorem: nthcdr-of-calculate-blockchain

    (defthm nthcdr-of-calculate-blockchain
      (implies (<= n (len anchors))
               (equal (nthcdr n (calculate-blockchain anchors dag))
                      (calculate-blockchain (nthcdr n anchors)
                                            dag))))

    Theorem: calculate-blockchain-of-unequivocal-superdag

    (defthm calculate-blockchain-of-unequivocal-superdag
      (implies (and (certificate-setp dag0)
                    (certificate-setp dag)
                    (subset dag0 dag)
                    (certificate-set-unequivocalp dag)
                    (dag-closedp dag0)
                    (set::list-in anchors dag0))
               (equal (calculate-blockchain anchors dag)
                      (calculate-blockchain anchors dag0))))

    Theorem: calculate-blockchain-of-unequivocal-dags

    (defthm calculate-blockchain-of-unequivocal-dags
      (implies (and (certificate-setp dag1)
                    (certificate-setp dag2)
                    (certificate-sets-unequivocalp dag1 dag2)
                    (certificate-set-unequivocalp dag1)
                    (certificate-set-unequivocalp dag2)
                    (dag-closedp dag1)
                    (dag-closedp dag2)
                    (set::list-in anchors dag1)
                    (set::list-in anchors dag2))
               (equal (calculate-blockchain anchors dag1)
                      (calculate-blockchain anchors dag2))))