• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
        • Deftreeops
          • Deftreeops-implementation
            • Deftreeops-event-generation
            • Deftreeops-info
            • Deftreeops-process-inputs-and-gen-everything
            • Deftreeops-fn
            • Deftreeops-table
            • Deftreeops-input-processing
              • Deftreeops-process-inputs
              • Deftreeops-process-grammar
                • Deftreeops-process-print
                • Deftreeops-process-prefix
                • *deftreeops-allowed-options*
              • Deftreeops-macro-definition
            • Deftreeops-show-event
            • Deftreeops-show-info
          • Defdefparse
          • Defgrammar
          • Tree-utilities
          • Notation
          • Grammar-parser
          • Meta-circular-validation
          • Parsing-primitives-defresult
          • Parsing-primitives-seq
          • Operations
          • Examples
          • Differences-with-paper
          • Constructor-utilities
          • Grammar-printer
          • Parsing-tools
        • Vwsim
        • Isar
        • Wp-gen
        • Dimacs-reader
        • Pfcs
        • Legacy-defrstobj
        • Proof-checker-array
        • Soft
        • C
        • Farray
        • Rp-rewriter
        • 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
    • Deftreeops-input-processing

    Deftreeops-process-grammar

    Process the *grammar* input.

    Signature
    (deftreeops-process-grammar grammar call wrld) 
      → 
    (mv erp redundantp grammar rules)
    Arguments
    call — Guard (pseudo-event-formp call).
    wrld — Guard (plist-worldp wrld).
    Returns
    redundantp — Type (booleanp redundantp).
    grammar — Type (common-lisp::symbolp grammar).
    rules — Type (rulelistp rules).

    If the redundantp result is t, the grammar and rules results are irrelevant.

    Definitions and Theorems

    Function: deftreeops-process-grammar

    (defun deftreeops-process-grammar (grammar call wrld)
     (declare (xargs :guard (and (pseudo-event-formp call)
                                 (plist-worldp wrld))))
     (let ((__function__ 'deftreeops-process-grammar))
      (declare (ignorable __function__))
      (b*
       (((reterr) nil nil nil)
        ((unless (constant-namep grammar wrld))
         (reterr
          (msg "The *GRAMMAR* input ~x0 must be the name of a constant."
               grammar)))
        (info (deftreeops-table-lookup grammar wrld))
        ((when info)
         (if (equal call
                    (deftreeops-table-value->call info))
             (retok t nil nil)
          (reterr
           (msg
            "DEFTREEOPS has been already called on ~x0, ~
                            but the previous call ~x1 differs ~
                            from the new call ~x2, ~
                            which is therefore not redundant."
            grammar
            (deftreeops-table-value->call info)
            call))))
        (rules (constant-value grammar wrld))
        ((unless (and (rulelistp rules) (consp rules)))
         (reterr
          (msg
           "The *GRAMMAR* input is the name of a constant, ~
                          but its value ~x0 is not a non-empty ABNF grammar."
           rules)))
        ((unless (rulelist-wfp rules))
         (reterr
          (msg
           "The *GRAMMAR* input denotes and ABNF grammar, ~
                          but the grammar is not well-formed
                          (see :DOC ABNF::WELL-FORMEDNESS).")))
        ((unless (rulelist-closedp rules))
         (reterr
          (msg
           "The *GRAMMAR* input denotes an ABNF grammar, ~
                          but the grammar is not closed
                          (see :DOC ABNF::CLOSURE)."))))
       (retok nil grammar rules))))

    Theorem: booleanp-of-deftreeops-process-grammar.redundantp

    (defthm booleanp-of-deftreeops-process-grammar.redundantp
      (b* (((mv acl2::?erp ?redundantp ?grammar ?rules)
            (deftreeops-process-grammar grammar call wrld)))
        (booleanp redundantp))
      :rule-classes :rewrite)

    Theorem: symbolp-of-deftreeops-process-grammar.grammar

    (defthm symbolp-of-deftreeops-process-grammar.grammar
      (b* (((mv acl2::?erp ?redundantp ?grammar ?rules)
            (deftreeops-process-grammar grammar call wrld)))
        (common-lisp::symbolp grammar))
      :rule-classes :rewrite)

    Theorem: rulelistp-of-deftreeops-process-grammar.rules

    (defthm rulelistp-of-deftreeops-process-grammar.rules
      (b* (((mv acl2::?erp ?redundantp ?grammar ?rules)
            (deftreeops-process-grammar grammar call wrld)))
        (rulelistp rules))
      :rule-classes :rewrite)