• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
        • Isar
        • Kestrel-utilities
        • Set
        • C
          • Syntax-for-tools
          • Atc
          • Transformation-tools
            • Simpadd0
            • Proof-generation
              • Xeq-fundef
              • Xeq-expr-cond
              • Xeq-expr-binary
              • Xeq-block-item-list-cons
              • Xeq-stmt-ifelse
              • Xeq-expr-const
              • Gen-param-thms
              • Gen-from-params
              • Xeq-decl-decl
              • Gout
              • Gen-block-item-list-thm
              • Xeq-stmt-while
              • Xeq-stmt-dowhile
              • Gin
              • Xeq-expr-ident
              • Gen-block-item-thm
                • Xeq-stmt-if
                • Xeq-expr-cast
                • Gen-initer-single-thm
                • Gen-init-scope-thm
                • Gen-expr-thm
                • Xeq-expr-unary
                • Gen-decl-thm
                • Gen-stmt-thm
                • Xeq-stmt-return
                • Xeq-stmt-expr
                • Xeq-block-item-decl
                • Xeq-block-item-stmt
                • Xeq-stmt-compound
                • Xeq-initer-single
                • Gen-thm-name
                • Gin-update
                • Gen-var-assertions
                • Tyspecseq-to-type
                • Xeq-block-item-list-empty
                • Gout-no-thm
                • Irr-gout
              • Split-gso
              • Wrap-fn
              • Constant-propagation
              • Specialize
              • Split-fn
              • Split-fn-when
              • Split-all-gso
              • Copy-fn
              • Variables-in-computation-states
              • Rename
              • Utilities
              • Proof-generation-theorems
              • Input-processing
            • Language
            • Representation
            • Insertion-sort
            • Pack
          • Soft
          • Bv
          • Imp-language
          • Ethereum
          • Event-macros
          • Java
          • Riscv
          • Bitcoin
          • Zcash
          • Yul
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Axe
          • Lists-light
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Proof-generation

    Gen-block-item-thm

    Generate a theorem for the transformation of a block item.

    Signature
    (gen-block-item-thm old new vartys-pre 
                        vartys-post const-new thm-index hints) 
     
      → 
    (mv thm-event thm-name updated-thm-index)
    Arguments
    old — Guard (block-itemp old).
    new — Guard (block-itemp new).
    vartys-pre — Guard (c::ident-type-mapp vartys-pre).
    vartys-post — Guard (c::ident-type-mapp vartys-post).
    const-new — Guard (symbolp const-new).
    thm-index — Guard (posp thm-index).
    hints — Guard (true-listp hints).
    Returns
    thm-event — Type (pseudo-event-formp thm-event).
    thm-name — Type (symbolp thm-name).
    updated-thm-index — Type (posp updated-thm-index).

    Definitions and Theorems

    Function: gen-block-item-thm

    (defun gen-block-item-thm
           (old new vartys-pre
                vartys-post const-new thm-index hints)
     (declare (xargs :guard (and (block-itemp old)
                                 (block-itemp new)
                                 (c::ident-type-mapp vartys-pre)
                                 (c::ident-type-mapp vartys-post)
                                 (symbolp const-new)
                                 (posp thm-index)
                                 (true-listp hints))))
     (declare (xargs :guard (and (block-item-unambp old)
                                 (block-item-annop old)
                                 (block-item-unambp new)
                                 (block-item-annop new))))
     (let ((__function__ 'gen-block-item-thm))
      (declare (ignorable __function__))
      (b*
       ((old (block-item-fix old))
        (new (block-item-fix new))
        ((unless (block-item-formalp old))
         (raise "Internal error: ~x0 is not in the formalized subset."
                old)
         (mv '(_) nil 1))
        ((unless (block-item-formalp new))
         (raise "Internal error: ~x0 is not in the formalized subset."
                new)
         (mv '(_) nil 1))
        (types (block-item-types old))
        ((unless (equal (block-item-types new) types))
         (raise
          "Internal error: ~
                    the types ~x0 of the new block item ~x1 differ from ~
                    the types ~x2 of the old block item ~x3."
          (block-item-types new)
          new types old)
         (mv '(_) nil 1))
        (vars-pre (gen-var-assertions vartys-pre 'compst))
        (vars-post (gen-var-assertions vartys-post 'old-compst))
        ((mv & old-item) (ldm-block-item old))
        ((mv & new-item) (ldm-block-item new))
        ((mv & ctypes)
         (ldm-type-option-set types))
        (formula
         (cons
          'b*
          (cons
           (cons
            (cons 'old-item
                  (cons (cons 'quote (cons old-item 'nil))
                        'nil))
            (cons
              (cons 'new-item
                    (cons (cons 'quote (cons new-item 'nil))
                          'nil))
              '(((mv old-sval old-compst)
                 (c::exec-block-item old-item compst old-fenv limit))
                ((mv new-sval new-compst)
                 (c::exec-block-item new-item compst new-fenv limit)))))
           (cons
            (cons
             'implies
             (cons
              (cons 'and
                    (cons '(> (c::compustate-frames-number compst)
                              0)
                          (append vars-pre
                                  '((not (c::errorp old-sval))))))
              (cons
               (cons
                'and
                (cons
                 '(not (c::errorp new-sval))
                 (cons
                  '(equal old-sval new-sval)
                  (cons
                   '(equal old-compst new-compst)
                   (cons
                    (cons 'in
                          (cons '(c::type-option-of-stmt-value old-sval)
                                (cons (cons 'quote (cons ctypes 'nil))
                                      'nil)))
                    vars-post)))))
               'nil)))
            'nil))))
        ((mv thm-name thm-index)
         (gen-thm-name const-new thm-index))
        (thm-event
         (cons
          'defrule
          (cons
               thm-name
               (cons formula
                     (cons ':rule-classes
                           (cons 'nil
                                 (cons ':hints (cons hints 'nil)))))))))
       (mv thm-event thm-name thm-index))))

    Theorem: pseudo-event-formp-of-gen-block-item-thm.thm-event

    (defthm pseudo-event-formp-of-gen-block-item-thm.thm-event
      (b* (((mv ?thm-event ?thm-name ?updated-thm-index)
            (gen-block-item-thm old new vartys-pre
                                vartys-post const-new thm-index hints)))
        (pseudo-event-formp thm-event))
      :rule-classes :rewrite)

    Theorem: symbolp-of-gen-block-item-thm.thm-name

    (defthm symbolp-of-gen-block-item-thm.thm-name
      (b* (((mv ?thm-event ?thm-name ?updated-thm-index)
            (gen-block-item-thm old new vartys-pre
                                vartys-post const-new thm-index hints)))
        (symbolp thm-name))
      :rule-classes :rewrite)

    Theorem: posp-of-gen-block-item-thm.updated-thm-index

    (defthm posp-of-gen-block-item-thm.updated-thm-index
      (b* (((mv ?thm-event ?thm-name ?updated-thm-index)
            (gen-block-item-thm old new vartys-pre
                                vartys-post const-new thm-index hints)))
        (posp updated-thm-index))
      :rule-classes :rewrite)

    Theorem: gen-block-item-thm-of-block-item-fix-old

    (defthm gen-block-item-thm-of-block-item-fix-old
     (equal (gen-block-item-thm (block-item-fix old)
                                new vartys-pre
                                vartys-post const-new thm-index hints)
            (gen-block-item-thm old new vartys-pre
                                vartys-post const-new thm-index hints)))

    Theorem: gen-block-item-thm-block-item-equiv-congruence-on-old

    (defthm gen-block-item-thm-block-item-equiv-congruence-on-old
     (implies
       (c$::block-item-equiv old old-equiv)
       (equal
            (gen-block-item-thm old new vartys-pre
                                vartys-post const-new thm-index hints)
            (gen-block-item-thm old-equiv new vartys-pre
                                vartys-post const-new thm-index hints)))
     :rule-classes :congruence)

    Theorem: gen-block-item-thm-of-block-item-fix-new

    (defthm gen-block-item-thm-of-block-item-fix-new
     (equal (gen-block-item-thm old (block-item-fix new)
                                vartys-pre
                                vartys-post const-new thm-index hints)
            (gen-block-item-thm old new vartys-pre
                                vartys-post const-new thm-index hints)))

    Theorem: gen-block-item-thm-block-item-equiv-congruence-on-new

    (defthm gen-block-item-thm-block-item-equiv-congruence-on-new
     (implies
       (c$::block-item-equiv new new-equiv)
       (equal
            (gen-block-item-thm old new vartys-pre
                                vartys-post const-new thm-index hints)
            (gen-block-item-thm old new-equiv vartys-pre
                                vartys-post const-new thm-index hints)))
     :rule-classes :congruence)