• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
        • Proof-support
        • Abstract-syntax
        • R1cs-subset
        • Semantics
        • Abstract-syntax-operations
        • Indexed-names
        • Well-formedness
          • Definition-list-wfp
          • Definition-wfp
          • Constraint-wfp
            • Constraint-list-wfp
            • System-wfp
          • Concrete-syntax
          • R1cs-bridge
          • Parser-interface
        • 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
    • Well-formedness

    Constraint-wfp

    Check if a constraint is well-formed, with respect to a list of relation definitions.

    Signature
    (constraint-wfp constr defs) → yes/no
    Arguments
    constr — Guard (constraintp constr).
    defs — Guard (definition-listp defs).
    Returns
    yes/no — Type (booleanp yes/no).

    An equality is always well-formed. An application of a named relation to some expressions is well-formed iff the relation is defined in the list of defined relations and the number of argument expressions is the same as the number of formal parameters.

    Definitions and Theorems

    Function: constraint-wfp

    (defun constraint-wfp (constr defs)
     (declare (xargs :guard (and (constraintp constr)
                                 (definition-listp defs))))
     (let ((__function__ 'constraint-wfp))
      (declare (ignorable __function__))
      (constraint-case constr :equal t :relation
                       (b* ((def? (lookup-definition constr.name defs)))
                         (and (definitionp def?)
                              (= (len constr.args)
                                 (len (definition->para def?))))))))

    Theorem: booleanp-of-constraint-wfp

    (defthm booleanp-of-constraint-wfp
      (b* ((yes/no (constraint-wfp constr defs)))
        (booleanp yes/no))
      :rule-classes :rewrite)

    Theorem: constraint-wfp-of-constraint-fix-constr

    (defthm constraint-wfp-of-constraint-fix-constr
      (equal (constraint-wfp (constraint-fix constr)
                             defs)
             (constraint-wfp constr defs)))

    Theorem: constraint-wfp-constraint-equiv-congruence-on-constr

    (defthm constraint-wfp-constraint-equiv-congruence-on-constr
      (implies (constraint-equiv constr constr-equiv)
               (equal (constraint-wfp constr defs)
                      (constraint-wfp constr-equiv defs)))
      :rule-classes :congruence)

    Theorem: constraint-wfp-of-definition-list-fix-defs

    (defthm constraint-wfp-of-definition-list-fix-defs
      (equal (constraint-wfp constr (definition-list-fix defs))
             (constraint-wfp constr defs)))

    Theorem: constraint-wfp-definition-list-equiv-congruence-on-defs

    (defthm constraint-wfp-definition-list-equiv-congruence-on-defs
      (implies (definition-list-equiv defs defs-equiv)
               (equal (constraint-wfp constr defs)
                      (constraint-wfp constr defs-equiv)))
      :rule-classes :congruence)