• 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
        • Rp-ruleset
        • Defthmrp
        • Rp-rewriter/meta-rules
        • Rp-utilities
          • Defthmrp
          • Show-rules
          • Def-rw-opener-error
          • Valid-sc
          • Set-rp-backchain-limit
          • Fetch-new-theory
          • Ex-from-rp
          • Rp-other-utilities
            • Rule-syntaxp
              • Add-rp-rule
              • Falist-consistent
              • Defthm-lambda
              • Def-rp-thm
            • Rp-equal
            • Preserve-current-theory
            • Set-rw-step-limit
            • Rp-termp
            • Include-fnc
            • Set-rp-backchain-limit-throws-error
            • Defwarrant-rp
            • Create-case-match-macro
          • Rp-rewriter-demo
          • Rp-rewriter/debugging
          • Rp-rewriter/applications
        • 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
        • 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
    • Rp-other-utilities

    Rule-syntaxp

    Syntax check for a 'rule' defined with rp::custom-rewrite-rule. If warning key is set to non-nil, a warning is issued for failures.

    Signature
    (rule-syntaxp rule &key warning) → *

    Definitions and Theorems

    Function: rule-syntaxp-fn

    (defun rule-syntaxp-fn (rule warning)
     (declare (xargs :guard t))
     (let ((__function__ 'rule-syntaxp))
      (declare (ignorable __function__))
      (and
       (or
        (weak-custom-rewrite-rule-p rule)
        (and warning
             (hard-error
                  'rule-syntaxp
                  "ATTENTION! weak-custom-rewrite-rule-p failed! ~p0 ~%"
                  (list (cons #\0 rule)))))
       (if (rp-rule-metap rule)
           (and (symbolp (rp-rule-trig-fnc rule))
                (rp-rule-trig-fnc rule)
                (symbolp (rp-rule-meta-fnc rule))
                (rp-rule-meta-fnc rule))
        (and
         (or
          (not (include-fnc (rp-lhs rule) 'rp))
          (and
           warning
           (cw
            "ATTENTION! (not (include-fnc (rp-lhs rule) 'rp))
        failed! LHS cannot contain an instance of rp. ~%")))
         (or
          (not (include-fnc (rp-lhs rule) 'equals))
          (and
           warning
           (cw
            "ATTENTION! (not (include-fnc (rp-lhs rule) 'equals))
        failed! LHS cannot contain an instance of equals. ~%")))
         (or
          (not (include-fnc-subterms (rp-hyp rule)
                                     'rp))
          (and
           warning
           (cw
            "ATTENTION! (not (include-fnc-subterms (rp-hyp rule) 'rp))
        failed! HYP cannot contain an instance of rp. ~%")))
         (or
          (not (include-fnc-subterms (rp-hyp rule)
                                     'equals))
          (and
           warning
           (cw
            "ATTENTION! (not (include-fnc-subterms (rp-hyp rule) 'equals))
        failed! HYP cannot contain an instance of equals ~%")))
         (or
          (not (include-fnc (rp-rhs rule) 'falist))
          (and
           warning
           (cw
            "ATTENTION! (not (include-fnc (rp-rhs rule) 'falist))
        failed! RHS cannot contain an instance of falist ~%")))
         (or
          (not (include-fnc (rp-rhs rule) 'equals))
          (and
           warning
           (cw
            "ATTENTION! (not (include-fnc (rp-rhs rule) 'equals))
        failed! RHS cannot contain an instance of equals ~%")))
         (or
          (not (include-fnc-subterms (rp-hyp rule)
                                     'falist))
          (and
           warning
           (cw
            "ATTENTION! (not (include-fnc (rp-hyp rule) 'falist))
        failed! HYP cannot contain an instance of falist ~%")))
         (or
          (and
           (or
            (rp-term-listp (rp-hyp rule))
            (and
             warning
             (cw
              "ATTENTION! (rp-term-listp (rp-hyp rule)) failed! Hyp of the ~
        rule does not satisfy rp::rp-termp. ~%")))
           (or
            (rp-termp (rp-lhs rule))
            (and
             warning
             (cw
              "ATTENTION! (rp-termp (rp-lhs rule)) failed! LSH of the ~
        rule does not satisfy rp::rp-termp. ~%")))
           (or
            (rp-termp (rp-rhs rule))
            (and
             warning
             (cw
              "ATTENTION! (rp-termp (rp-rhs rule)) failed! RHS of the ~
        rule does not satisfy rp::rp-termp. ~%")))
           (or
            (consp (rp-lhs rule))
            (and
             warning
             (cw
              "ATTENTION! (consp (rp-lhs rule)) failed! LHS cannot
        be a variable. ~%")))
           (or
            (not (acl2::fquotep (rp-lhs rule)))
            (and
             warning
             (cw
              "ATTENTION! (not (acl2::fquotep (rp-lhs rule))) failed!
        LHS cannot be a quoted value ~%")))
           (or
            (not (include-fnc (rp-lhs rule) 'synp))
            (and
             warning
             (cw
              "ATTENTION! (not (include-fnc (rp-lhs rule) 'synp))
        failed! LHS cannot contain an instance of synp ~%")))
           (not (include-fnc (rp-lhs rule) 'list))
           (not (include-fnc-subterms (rp-hyp rule)
                                      'list))
           (not (include-fnc (rp-rhs rule) 'list)))
          (and
           (equal warning ':err)
           (hard-error
            'rule-syntaxp
            "Read the above messages. Error  is issued for: ~%
     rp-rune: ~p0 ~% rp-hyp: ~p1 ~% rp-lhs: ~p2 ~% rp-rhs ~p3 ~%"
            (list (cons #\0 (rp-rune rule))
                  (cons #\1 (rp-hyp rule))
                  (cons #\2 (rp-lhs rule))
                  (cons #\3 (rp-rhs rule)))))
          (and
           warning
           (cw
            "Read the above messages. Warning in rp::rule-syntaxp is issued for: ~%
     rp-rune: ~p0 ~% rp-hyp: ~p1 ~% rp-lhs: ~p2 ~% rp-rhs ~p3 ~%"
            (rp-rune rule)
            (rp-hyp rule)
            (rp-lhs rule)
            (rp-rhs rule)))))))))