• 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-initer-single-thm

    Generate a theorem for the transformation of a single initializer.

    Signature
    (gen-initer-single-thm old new vartys const-new thm-index hints) 
      → 
    (mv thm-event thm-name updated-thm-index)
    Arguments
    old — Guard (initerp old).
    new — Guard (initerp new).
    vartys — Guard (c::ident-type-mapp vartys).
    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-initer-single-thm

    (defun gen-initer-single-thm
           (old new vartys const-new thm-index hints)
     (declare (xargs :guard (and (initerp old)
                                 (initerp new)
                                 (c::ident-type-mapp vartys)
                                 (symbolp const-new)
                                 (posp thm-index)
                                 (true-listp hints))))
     (declare (xargs :guard (and (initer-case old :single)
                                 (initer-case new :single)
                                 (initer-unambp old)
                                 (initer-annop old)
                                 (initer-unambp new)
                                 (initer-annop new))))
     (let ((__function__ 'gen-initer-single-thm))
      (declare (ignorable __function__))
      (b*
       ((old (initer-fix old))
        (new (initer-fix new))
        ((unless (initer-formalp old))
         (raise "Internal error: ~x0 is not in the formalized subset."
                old)
         (mv '(_) nil 1))
        ((unless (initer-formalp new))
         (raise "Internal error: ~x0 is not in the formalized subset."
                new)
         (mv '(_) nil 1))
        (type (initer-type old))
        ((unless (equal (initer-type new) type))
         (raise
          "Internal error: ~
                    the type ~x0 of the new initializer ~x1 differs from ~
                    the type ~x2 of the old initializer ~x3."
          (initer-type new)
          new type old)
         (mv '(_) nil 1))
        (vars-pre (gen-var-assertions vartys 'compst))
        (vars-post (gen-var-assertions vartys 'old-compst))
        ((unless (type-formalp type))
         (raise "Internal error: initializer ~x0 has type ~x1."
                old type)
         (mv '(_) nil 1))
        ((mv & old-initer) (ldm-initer old))
        ((mv & new-initer) (ldm-initer new))
        ((mv & ctype) (ldm-type type))
        (formula
         (cons
          'b*
          (cons
           (cons
            (cons 'old-initer
                  (cons (cons 'quote (cons old-initer 'nil))
                        'nil))
            (cons
                (cons 'new-initer
                      (cons (cons 'quote (cons new-initer 'nil))
                            'nil))
                '(((mv old-ival old-compst)
                   (c::exec-initer old-initer compst old-fenv limit))
                  ((mv new-ival new-compst)
                   (c::exec-initer new-initer compst new-fenv limit)))))
           (cons
            (cons
             'implies
             (cons
              (cons 'and
                    (cons '(> (c::compustate-frames-number compst)
                              0)
                          (append vars-pre
                                  '((not (c::errorp old-ival))))))
              (cons
               (cons
                'and
                (cons
                 '(not (c::errorp new-ival))
                 (cons
                  '(equal old-ival new-ival)
                  (cons
                   '(equal old-compst new-compst)
                   (cons
                    (cons
                     'equal
                     (cons
                       '(c::init-type-of-init-value old-ival)
                       (cons (cons 'c::init-type-single
                                   (cons (cons 'quote (cons ctype 'nil))
                                         '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-initer-single-thm.thm-event

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

    Theorem: symbolp-of-gen-initer-single-thm.thm-name

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

    Theorem: posp-of-gen-initer-single-thm.updated-thm-index

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

    Theorem: gen-initer-single-thm-of-initer-fix-old

    (defthm gen-initer-single-thm-of-initer-fix-old
     (equal
          (gen-initer-single-thm (initer-fix old)
                                 new vartys const-new thm-index hints)
          (gen-initer-single-thm old
                                 new vartys const-new thm-index hints)))

    Theorem: gen-initer-single-thm-initer-equiv-congruence-on-old

    (defthm gen-initer-single-thm-initer-equiv-congruence-on-old
     (implies
      (c$::initer-equiv old old-equiv)
      (equal
          (gen-initer-single-thm old
                                 new vartys const-new thm-index hints)
          (gen-initer-single-thm old-equiv
                                 new vartys const-new thm-index hints)))
     :rule-classes :congruence)

    Theorem: gen-initer-single-thm-of-initer-fix-new

    (defthm gen-initer-single-thm-of-initer-fix-new
     (equal
          (gen-initer-single-thm old (initer-fix new)
                                 vartys const-new thm-index hints)
          (gen-initer-single-thm old
                                 new vartys const-new thm-index hints)))

    Theorem: gen-initer-single-thm-initer-equiv-congruence-on-new

    (defthm gen-initer-single-thm-initer-equiv-congruence-on-new
     (implies
       (c$::initer-equiv new new-equiv)
       (equal
            (gen-initer-single-thm old
                                   new vartys const-new thm-index hints)
            (gen-initer-single-thm old new-equiv
                                   vartys const-new thm-index hints)))
     :rule-classes :congruence)