• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
      • Legacy-defrstobj
      • 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
            • Xeq-declon-declon
            • Gen-param-thms
            • Gen-from-params
            • 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
              • Gen-declon-thm
              • Xeq-expr-unary
              • Gen-stmt-thm
              • Xeq-stmt-return
              • Xeq-stmt-expr
              • Xeq-block-item-declon
              • 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
        • Proof-checker-array
        • Soft
        • Farray
        • Rp-rewriter
        • Instant-runoff-voting
        • Imp-language
        • Sidekick
        • Ethereum
        • Leftist-trees
        • Java
        • Riscv
        • Taspi
        • Bitcoin
        • Zcash
        • Des
        • X86isa
        • Sha-2
        • Yul
        • Proof-checker-itp13
        • Regex
        • ACL2-programming-language
        • Json
        • Jfkr
        • Equational
        • Cryptography
        • Axe
        • Poseidon
        • Where-do-i-place-my-book
        • Aleo
        • Bigmems
        • Builtins
        • Execloader
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Community
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Proof-generation

    Gen-init-scope-thm

    Generate a theorem about the initial scope of a function.

    Signature
    (gen-init-scope-thm params args 
                        parargs arg-types const-new thm-index) 
     
      → 
    (mv thm-event thm-name updated-thm-index)
    Arguments
    params — Guard (c::param-declon-listp params).
    args — Guard (symbol-listp args).
    parargs — A term.
    arg-types — Guard (true-listp arg-types).
    const-new — Guard (symbolp const-new).
    thm-index — Guard (posp thm-index).
    Returns
    thm-event — Type (pseudo-event-formp thm-event).
    thm-name — Type (symbolp thm-name).
    updated-thm-index — Type (posp updated-thm-index).

    The args, parargs, and arg-types inputs are the corresponding outputs of gen-from-params.

    The theorem says that, given values of certain types for the arguments, c::init-scope applied to the list of parameter declarations and to the list of parameter values yields an omap (which we express as an omap::update nest) that associates parameter name and argument value.

    Definitions and Theorems

    Function: gen-init-scope-thm

    (defun gen-init-scope-thm
           (params args
                   parargs arg-types const-new thm-index)
     (declare (xargs :guard (and (c::param-declon-listp params)
                                 (symbol-listp args)
                                 (true-listp arg-types)
                                 (symbolp const-new)
                                 (posp thm-index))))
     (let ((__function__ 'gen-init-scope-thm))
      (declare (ignorable __function__))
      (b*
       ((formula
         (cons
          'implies
          (cons
           (cons 'and arg-types)
           (cons
                (cons 'equal
                      (cons (cons 'c::init-scope
                                  (cons (cons 'quote (cons params 'nil))
                                        (cons (cons 'list args) 'nil)))
                            (cons parargs 'nil)))
                'nil))))
        (hints
         '(("Goal"
            :in-theory '(omap::assoc-when-emptyp
                             (:e omap::emptyp)
                             omap::assoc-of-update c::init-scope
                             c::not-flexible-array-member-p-when-ucharp
                             c::not-flexible-array-member-p-when-scharp
                             c::not-flexible-array-member-p-when-ushortp
                             c::not-flexible-array-member-p-when-sshortp
                             c::not-flexible-array-member-p-when-uintp
                             c::not-flexible-array-member-p-when-sintp
                             c::not-flexible-array-member-p-when-ulongp
                             c::not-flexible-array-member-p-when-slongp
                             c::not-flexible-array-member-p-when-ullongp
                             c::not-flexible-array-member-p-when-sllongp
                             c::remove-flexible-array-member-when-absent
                             c::ucharp-alt-def c::scharp-alt-def
                             c::ushortp-alt-def c::sshortp-alt-def
                             c::uintp-alt-def c::sintp-alt-def
                             c::ulongp-alt-def c::slongp-alt-def
                             c::ullongp-alt-def c::sllongp-alt-def
                             c::type-of-value-when-ucharp
                             c::type-of-value-when-scharp
                             c::type-of-value-when-ushortp
                             c::type-of-value-when-sshortp
                             c::type-of-value-when-uintp
                             c::type-of-value-when-sintp
                             c::type-of-value-when-ulongp
                             c::type-of-value-when-slongp
                             c::type-of-value-when-ullongp
                             c::type-of-value-when-sllongp
                             c::value-fix-when-valuep
                             c::value-list-fix-of-cons
                             c::type-of-value
                             c::type-array c::type-pointer
                             c::type-struct (:e c::adjust-type)
                             (:e c::apconvert-type)
                             (:e c::ident)
                             (:e c::param-declon-list-fix$inline)
                             (:e c::param-declon-to-ident+tyname)
                             (:e c::tyname-to-type)
                             (:e c::type-uchar)
                             (:e c::type-schar)
                             (:e c::type-ushort)
                             (:e c::type-sshort)
                             (:e c::type-uint)
                             (:e c::type-sint)
                             (:e c::type-ulong)
                             (:e c::type-slong)
                             (:e c::type-ullong)
                             (:e c::type-sllong)
                             (:e c::value-list-fix$inline)
                             mv-nth car-cons cdr-cons (:e <<)
                             lemma1 lemma2))))
        ((mv thm-name thm-index)
         (gen-thm-name const-new thm-index))
        (thm-event
         (cons
          'defruled
          (cons
           thm-name
           (cons
            formula
            (cons
             ':hints
             (cons hints
                   '(:prep-lemmas
                         ((defruled lemma1 (not (c::errorp nil)))
                          (defruled lemma2
                            (not (c::errorp (omap::update key val map)))
                            :enable (c::errorp omap::update)))))))))))
       (mv thm-event thm-name thm-index))))

    Theorem: pseudo-event-formp-of-gen-init-scope-thm.thm-event

    (defthm pseudo-event-formp-of-gen-init-scope-thm.thm-event
      (b* (((mv ?thm-event ?thm-name ?updated-thm-index)
            (gen-init-scope-thm params args
                                parargs arg-types const-new thm-index)))
        (pseudo-event-formp thm-event))
      :rule-classes :rewrite)

    Theorem: symbolp-of-gen-init-scope-thm.thm-name

    (defthm symbolp-of-gen-init-scope-thm.thm-name
      (b* (((mv ?thm-event ?thm-name ?updated-thm-index)
            (gen-init-scope-thm params args
                                parargs arg-types const-new thm-index)))
        (symbolp thm-name))
      :rule-classes :rewrite)

    Theorem: posp-of-gen-init-scope-thm.updated-thm-index

    (defthm posp-of-gen-init-scope-thm.updated-thm-index
      (b* (((mv ?thm-event ?thm-name ?updated-thm-index)
            (gen-init-scope-thm params args
                                parargs arg-types const-new thm-index)))
        (posp updated-thm-index))
      :rule-classes (:rewrite :type-prescription))