• 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
        • Poseidon-main-definition
          • Param
            • Param-fix
              • Paramp
              • Make-param
              • Param->prime
              • Param-equiv
              • Param->rate-then-capacity-p
              • Param->partial-first-p
              • Change-param
              • Param->full-rounds-half
              • Param->constants
              • Param->ascending-p
              • Param->partial-rounds
              • Param->mds
              • Param->capacity
              • Param->rate
              • Param->alpha
            • Hashp
            • Absorb1
            • Sponge
            • Hash
            • All-rounds
            • Sponge-validp
            • Squeeze1
            • Sub-words-partial
            • Squeeze
            • Round
            • Partial-rounds
            • Mode
            • Full-rounds
            • Permute
            • Sub-words
            • Add-round-constants
            • Mix-layer
            • Dot-product
            • Absorb
            • Pow-by-alpha
            • Param->size
            • Sub-words-full
            • Param->capacity-then-rate-p
            • Param->partial-last-p
            • Param-additional-theorems
            • Param->rounds
            • Param->descending-p
            • Init-sponge
          • Poseidon-instantiations
        • 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
    • Param

    Param-fix

    Fixing function for param structures.

    Signature
    (param-fix x) → new-x
    Arguments
    x — Guard (paramp x).
    Returns
    new-x — Type (paramp new-x).

    Definitions and Theorems

    Function: param-fix$inline

    (defun param-fix$inline (x)
     (declare (xargs :guard (paramp x)))
     (let ((__function__ 'param-fix))
      (declare (ignorable __function__))
      (mbe
       :logic
       (b*
        ((prime (prime-fix (cdr (std::da-nth 0 x))))
         (rate (acl2::pos-fix (cdr (std::da-nth 1 x))))
         (capacity (acl2::pos-fix (cdr (std::da-nth 2 x))))
         (alpha (ifix (cdr (std::da-nth 3 x))))
         (full-rounds-half (nfix (cdr (std::da-nth 4 x))))
         (partial-rounds (nfix (cdr (std::da-nth 5 x))))
         (constants (cdr (std::da-nth 6 x)))
         (mds (cdr (std::da-nth 7 x)))
         (rate-then-capacity-p (acl2::bool-fix (cdr (std::da-nth 8 x))))
         (ascending-p (acl2::bool-fix (cdr (std::da-nth 9 x))))
         (partial-first-p (acl2::bool-fix (cdr (std::da-nth 10 x)))))
        (let
           ((constants
                 (if (and (fe-list-listp constants prime)
                          (all-len-equal-p constants (+ rate capacity))
                          (equal (len constants)
                                 (+ (* 2 full-rounds-half)
                                    partial-rounds)))
                     constants
                   (repeat (+ (* 2 full-rounds-half)
                              partial-rounds)
                           (repeat (+ rate capacity) 0))))
            (mds (if (and (fe-list-listp mds prime)
                          (all-len-equal-p mds (+ rate capacity))
                          (equal (len mds) (+ rate capacity)))
                     mds
                   (repeat (+ rate capacity)
                           (repeat (+ rate capacity) 0)))))
          (list (cons 'prime prime)
                (cons 'rate rate)
                (cons 'capacity capacity)
                (cons 'alpha alpha)
                (cons 'full-rounds-half
                      full-rounds-half)
                (cons 'partial-rounds partial-rounds)
                (cons 'constants constants)
                (cons 'mds mds)
                (cons 'rate-then-capacity-p
                      rate-then-capacity-p)
                (cons 'ascending-p ascending-p)
                (cons 'partial-first-p
                      partial-first-p))))
       :exec x)))

    Theorem: paramp-of-param-fix

    (defthm paramp-of-param-fix
      (b* ((new-x (param-fix$inline x)))
        (paramp new-x))
      :rule-classes :rewrite)

    Theorem: param-fix-when-paramp

    (defthm param-fix-when-paramp
      (implies (paramp x)
               (equal (param-fix x) x)))

    Function: param-equiv$inline

    (defun param-equiv$inline (acl2::x acl2::y)
      (declare (xargs :guard (and (paramp acl2::x)
                                  (paramp acl2::y))))
      (equal (param-fix acl2::x)
             (param-fix acl2::y)))

    Theorem: param-equiv-is-an-equivalence

    (defthm param-equiv-is-an-equivalence
      (and (booleanp (param-equiv x y))
           (param-equiv x x)
           (implies (param-equiv x y)
                    (param-equiv y x))
           (implies (and (param-equiv x y)
                         (param-equiv y z))
                    (param-equiv x z)))
      :rule-classes (:equivalence))

    Theorem: param-equiv-implies-equal-param-fix-1

    (defthm param-equiv-implies-equal-param-fix-1
      (implies (param-equiv acl2::x x-equiv)
               (equal (param-fix acl2::x)
                      (param-fix x-equiv)))
      :rule-classes (:congruence))

    Theorem: param-fix-under-param-equiv

    (defthm param-fix-under-param-equiv
      (param-equiv (param-fix acl2::x)
                   acl2::x)
      :rule-classes (:rewrite :rewrite-quoted-constant))

    Theorem: equal-of-param-fix-1-forward-to-param-equiv

    (defthm equal-of-param-fix-1-forward-to-param-equiv
      (implies (equal (param-fix acl2::x) acl2::y)
               (param-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: equal-of-param-fix-2-forward-to-param-equiv

    (defthm equal-of-param-fix-2-forward-to-param-equiv
      (implies (equal acl2::x (param-fix acl2::y))
               (param-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: param-equiv-of-param-fix-1-forward

    (defthm param-equiv-of-param-fix-1-forward
      (implies (param-equiv (param-fix acl2::x)
                            acl2::y)
               (param-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: param-equiv-of-param-fix-2-forward

    (defthm param-equiv-of-param-fix-2-forward
      (implies (param-equiv acl2::x (param-fix acl2::y))
               (param-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)