• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
        • Z3-installation
        • Smt-hint
        • Tutorial
        • Status
        • Developer
          • Verified
          • Trusted
            • Translation-datatypes
            • Smt-run
            • Smt-prove
            • Smt-write
            • Smt-trusted-cp
            • Z3-py
              • Smt-translator
              • Smt-translate-fty
              • Smt-names
              • Smt-recover-types
              • Smt-pretty-print
                • Smt-header
                • Smt-translate-abstract-sort
        • Abnf
        • 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
    • Z3-py

    Smt-pretty-print

    Pretty printer for SMT formula. Currently only change line every 160 characters.

    Definitions and Theorems

    Function: flatten-paragraph

    (defun flatten-paragraph (p)
      (declare (xargs :guard (paragraphp p)))
      (let ((acl2::__function__ 'flatten-paragraph))
        (declare (ignorable acl2::__function__))
        (b* ((p (paragraph-fix p))
             ((if (null p)) p)
             ((if (atom p)) (list p))
             ((cons first rest) p))
          (append (flatten-paragraph first)
                  (flatten-paragraph rest)))))

    Theorem: word-listp-of-flatten-paragraph

    (defthm word-listp-of-flatten-paragraph
      (b* ((fp (flatten-paragraph p)))
        (word-listp fp))
      :rule-classes :rewrite)

    Function: pretty-print-recur

    (defun pretty-print-recur (thm wlimit acc)
      (declare (xargs :guard (and (word-listp thm)
                                  (natp wlimit)
                                  (natp acc))))
      (let ((acl2::__function__ 'pretty-print-recur))
        (declare (ignorable acl2::__function__))
        (b* ((thm (word-list-fix thm))
             (wlimit (nfix wlimit))
             ((unless (consp thm)) nil)
             ((cons first rest) thm)
             ((if (<= wlimit acc))
              (cons first
                    (cons '#\Newline
                          (pretty-print-recur rest wlimit 0)))))
          (cons first
                (pretty-print-recur rest wlimit (1+ acc))))))

    Theorem: word-listp-of-pretty-print-recur

    (defthm word-listp-of-pretty-print-recur
      (b* ((pretty-thm (pretty-print-recur thm wlimit acc)))
        (word-listp pretty-thm))
      :rule-classes :rewrite)

    Function: pretty-print-theorem

    (defun pretty-print-theorem (thm wlimit)
      (declare (xargs :guard (and (paragraphp thm) (natp wlimit))))
      (declare (xargs :guard (>= wlimit 76)))
      (let ((acl2::__function__ 'pretty-print-theorem))
        (declare (ignorable acl2::__function__))
        (b* ((thm (paragraph-fix thm))
             (fthm (flatten-paragraph thm)))
          (pretty-print-recur fthm wlimit 0))))

    Theorem: word-listp-of-pretty-print-theorem

    (defthm word-listp-of-pretty-print-theorem
      (b* ((pretty-thm (pretty-print-theorem thm wlimit)))
        (word-listp pretty-thm))
      :rule-classes :rewrite)