• 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
          • Aleobft-stake
            • Correctness
            • Definition
              • Initialization
              • Transitions
                • Transitions-create
                • Dags
                • Transitions-receive
                  • Receive-next
                    • Receive-possiblep
                  • Transitions-store
                  • Transitions-advance
                  • Elections
                  • Event-next
                  • Transitions-commit
                  • Event-possiblep
                  • Events-possiblep
                  • Events-next
                  • Blockchains
                  • Transitions-timeout
                  • Anchors
                • States
                • Events
            • 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
    • Transitions-receive

    Receive-next

    New system state resulting from a receive event.

    Signature
    (receive-next msg systate) → new-systate
    Arguments
    msg — Guard (messagep msg).
    systate — Guard (system-statep systate).
    Returns
    new-systate — Type (system-statep new-systate).

    The certificate is added to the buffer of the destination validator. Recall that receive-possiblep requires the destination address to be of a correct validator.

    The message is removed from the network.

    Definitions and Theorems

    Function: receive-next

    (defun receive-next (msg systate)
      (declare (xargs :guard (and (messagep msg)
                                  (system-statep systate))))
      (declare (xargs :guard (receive-possiblep msg systate)))
      (let ((__function__ 'receive-next))
        (declare (ignorable __function__))
        (b* (((certificate cert)
              (message->certificate msg))
             (dest (message->destination msg))
             ((validator-state vstate)
              (get-validator-state dest systate))
             (new-buffer (insert cert vstate.buffer))
             (new-vstate (change-validator-state vstate
                                                 :buffer new-buffer))
             (systate (update-validator-state dest new-vstate systate))
             (network (get-network-state systate))
             (new-network (delete (message-fix msg) network))
             (systate (update-network-state new-network systate)))
          systate)))

    Theorem: system-statep-of-receive-next

    (defthm system-statep-of-receive-next
      (b* ((new-systate (receive-next msg systate)))
        (system-statep new-systate))
      :rule-classes :rewrite)

    Theorem: correct-addresses-of-receive-next

    (defthm correct-addresses-of-receive-next
      (implies (receive-possiblep msg systate)
               (b* ((?new-systate (receive-next msg systate)))
                 (equal (correct-addresses new-systate)
                        (correct-addresses systate)))))

    Theorem: validator-state->round-of-receive-next

    (defthm validator-state->round-of-receive-next
     (implies
      (receive-possiblep msg systate)
      (b* ((?new-systate (receive-next msg systate)))
       (equal
          (validator-state->round (get-validator-state val new-systate))
          (validator-state->round (get-validator-state val systate))))))

    Theorem: validator-state->dag-of-receive-next

    (defthm validator-state->dag-of-receive-next
     (implies
      (receive-possiblep msg systate)
      (b* ((?new-systate (receive-next msg systate)))
       (equal
            (validator-state->dag (get-validator-state val new-systate))
            (validator-state->dag (get-validator-state val systate))))))

    Theorem: validator-state->buffer-of-receive-next

    (defthm validator-state->buffer-of-receive-next
     (implies
      (and (in val (correct-addresses systate))
           (receive-possiblep msg systate))
      (b* ((?new-systate (receive-next msg systate)))
       (equal
        (validator-state->buffer (get-validator-state val new-systate))
        (if
         (equal val (message->destination msg))
         (insert
            (message->certificate msg)
            (validator-state->buffer (get-validator-state val systate)))
         (validator-state->buffer
              (get-validator-state val systate)))))))

    Theorem: validator-state->endorsed-of-receive-next

    (defthm validator-state->endorsed-of-receive-next
      (implies (receive-possiblep msg systate)
               (b* ((?new-systate (receive-next msg systate)))
                 (equal (validator-state->endorsed
                             (get-validator-state val new-systate))
                        (validator-state->endorsed
                             (get-validator-state val systate))))))

    Theorem: validator-state->last-of-receive-next

    (defthm validator-state->last-of-receive-next
     (implies
      (receive-possiblep msg systate)
      (b* ((?new-systate (receive-next msg systate)))
       (equal
           (validator-state->last (get-validator-state val new-systate))
           (validator-state->last (get-validator-state val systate))))))

    Theorem: validator-state->blockchain-of-receive-next

    (defthm validator-state->blockchain-of-receive-next
      (implies (receive-possiblep msg systate)
               (b* ((?new-systate (receive-next msg systate)))
                 (equal (validator-state->blockchain
                             (get-validator-state val new-systate))
                        (validator-state->blockchain
                             (get-validator-state val systate))))))

    Theorem: validator-state->committed-of-receive-next

    (defthm validator-state->committed-of-receive-next
      (implies (receive-possiblep msg systate)
               (b* ((?new-systate (receive-next msg systate)))
                 (equal (validator-state->committed
                             (get-validator-state val new-systate))
                        (validator-state->committed
                             (get-validator-state val systate))))))

    Theorem: validator-state->timer-of-receive-next

    (defthm validator-state->timer-of-receive-next
     (implies
      (receive-possiblep msg systate)
      (b* ((?new-systate (receive-next msg systate)))
       (equal
          (validator-state->timer (get-validator-state val new-systate))
          (validator-state->timer (get-validator-state val systate))))))

    Theorem: get-network-state-of-receive-next

    (defthm get-network-state-of-receive-next
      (b* ((?new-systate (receive-next msg systate)))
        (equal (get-network-state new-systate)
               (delete (message-fix msg)
                       (get-network-state systate)))))

    Theorem: receive-next-of-message-fix-msg

    (defthm receive-next-of-message-fix-msg
      (equal (receive-next (message-fix msg) systate)
             (receive-next msg systate)))

    Theorem: receive-next-message-equiv-congruence-on-msg

    (defthm receive-next-message-equiv-congruence-on-msg
      (implies (message-equiv msg msg-equiv)
               (equal (receive-next msg systate)
                      (receive-next msg-equiv systate)))
      :rule-classes :congruence)

    Theorem: receive-next-of-system-state-fix-systate

    (defthm receive-next-of-system-state-fix-systate
      (equal (receive-next msg (system-state-fix systate))
             (receive-next msg systate)))

    Theorem: receive-next-system-state-equiv-congruence-on-systate

    (defthm receive-next-system-state-equiv-congruence-on-systate
      (implies (system-state-equiv systate systate-equiv)
               (equal (receive-next msg systate)
                      (receive-next msg systate-equiv)))
      :rule-classes :congruence)