• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
      • Std/lists
      • Std/alists
      • Obags
      • Std/util
      • Std/strings
      • Std/osets
      • Std/io
      • Std/basic
      • Std/system
        • Fresh-logical-name-with-$s-suffix
        • Irrelevant-formals-info
        • Std/system/function-queries
        • Std/system/term-queries
          • Check-mv-let-call
          • Term-possible-numbers-of-results
          • Check-user-term
          • Check-nary-lambda-call
          • Check-lambda-call
          • All-vars-open
          • Dumb-occur-var-open
          • Check-user-lambda
          • Check-if-call
          • One-way-unify$
            • Check-unary-lambda-call
            • Guard-verified-fnsp
            • All-non-gv-ffn-symbs
            • All-non-gv-exec-ffn-symbs
            • Check-fn-call
            • Guard-verified-exec-fnsp
            • Check-list-call
            • Check-or-call
            • Check-and-call
            • All-program-ffn-symbs
            • Lambda-guard-verified-fnsp
            • All-free/bound-vars
            • Check-mbt$-call
            • If-tree-leaf-terms
            • Check-not-call
            • Check-mbt-call
            • Term-guard-obligation
            • All-pkg-names
            • All-vars-in-untranslated-term
            • Std/system/all-fnnames
            • Lambda-logic-fnsp
            • Lambda-guard-verified-exec-fnsp
            • All-lambdas
            • Lambda-closedp
            • Std/system/all-vars
          • Std/system/term-transformations
          • Std/system/enhanced-utilities
          • Install-not-normalized-event
          • Install-not-normalized-event-lst
          • Std/system/term-function-recognizers
          • Genvar$
          • Std/system/event-name-queries
          • Pseudo-tests-and-call-listp
          • Maybe-pseudo-event-formp
          • Add-suffix-to-fn-or-const
          • Chk-irrelevant-formals-ok
          • Table-alist+
          • Pseudo-tests-and-callp
          • Add-suffix-to-fn-or-const-lst
          • Known-packages+
          • Add-suffix-to-fn-lst
          • Unquote-term
          • Event-landmark-names
          • Add-suffix-lst
          • Std/system/theorem-queries
          • Unquote-term-list
          • Std/system/macro-queries
          • Pseudo-command-landmark-listp
          • Install-not-normalized$
          • Pseudo-event-landmark-listp
          • Known-packages
          • Std/system/partition-rest-and-keyword-args
          • Rune-enabledp
          • Rune-disabledp
          • Included-books
          • Std/system/pseudo-event-formp
          • Std/system/plist-worldp-with-formals
          • Std/system/w
          • Std/system/geprops
          • Std/system/arglistp
          • Std/system/constant-queries
        • Std/typed-lists
        • Std/bitsets
        • Std/testing
        • Std/typed-alists
        • Std/stobjs
      • Community
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Std/system/term-queries

    One-way-unify$

    A logic-mode guard-verified version of one-way-unify.

    Signature
    (one-way-unify$ pat term state) → (mv okp subst)
    Arguments
    pat — Guard (pseudo-termp pat).
    term — Guard (pseudo-termp term).
    Returns
    okp — Type (booleanp okp).
    subst — Type (symbol-pseudoterm-alistp subst).

    The built in one-way-unify matches a term to a pattern, returning a substituion of terms to variables if successful. The first result is a boolean indicating if the matching was successful or not; the second result is the substitution.

    This one-way-unify$ function takes a state as additional argument, which it needs to call magic-ev-fncall on one-way-unify. It also ensures that the first result is a boolean and that, if the first result is t, then the second one is a substitution, i.e. an alist from symbols (variables) to terms.

    Definitions and Theorems

    Function: one-way-unify$

    (defun one-way-unify$ (pat term state)
     (declare (xargs :stobjs (state)))
     (declare (xargs :guard (and (pseudo-termp pat)
                                 (pseudo-termp term))))
     (let ((__function__ 'one-way-unify$))
       (declare (ignorable __function__))
       (b*
        (((mv erp okp+subst)
          (magic-ev-fncall 'one-way-unify
                           (list pat term)
                           state nil t))
         ((when erp)
          (raise "Internal error: ~@0" erp)
          (mv nil nil))
         ((unless (and (true-listp okp+subst)
                       (= (len okp+subst) 2)))
          (raise "Internal error: ONE-WAY-UNIFY returned ~x0."
                 okp+subst)
          (mv nil nil))
         (okp (first okp+subst))
         (subst (second okp+subst))
         ((unless (booleanp okp))
          (raise "Internal error: ONE-WAY-UNIFY's first result is ~x0."
                 okp)
          (mv nil nil))
         ((unless (symbol-pseudoterm-alistp subst))
          (raise "Internal error: ONE-WAY-UNIFY's second result is ~x0."
                 subst)
          (mv nil nil)))
        (mv okp subst))))

    Theorem: booleanp-of-one-way-unify$.okp

    (defthm booleanp-of-one-way-unify$.okp
      (b* (((mv ?okp common-lisp::?subst)
            (one-way-unify$ pat term state)))
        (booleanp okp))
      :rule-classes :rewrite)

    Theorem: symbol-pseudoterm-alistp-of-one-way-unify$.subst

    (defthm symbol-pseudoterm-alistp-of-one-way-unify$.subst
      (b* (((mv ?okp common-lisp::?subst)
            (one-way-unify$ pat term state)))
        (symbol-pseudoterm-alistp subst))
      :rule-classes :rewrite)