• 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
      • Instant-runoff-voting
      • Imp-language
      • Sidekick
      • Leftist-trees
      • Java
      • Taspi
      • Bitcoin
      • Riscv
      • Des
      • Ethereum
      • X86isa
        • Program-execution
          • Dynamic-instrumentation
          • Initialize-x86-state
          • Binary-file-load-fn
          • Read-channel-into-memory
          • Setting-up-page-tables
          • Read-channel-into-byte-list
          • Init-zero-page
          • Linux-load
          • Read-file-into-memory
          • Read-file-into-byte-list
          • Init-sys-view
          • Load-elf-sections
          • Chars-to-c-str
          • String-to-c-str
          • Pack-u64
          • Pack-u32
          • Concrete-simulation-examples
            • Fibonacci32-cosim
            • Fibonacci-cosim
            • Factorial-cosim
              • X86isa-one-fact-cosim
              • Run-x86isa-fact
              • Check-fact-output
                • Fact
              • Nop-cosim
              • Datacopy-cosim
            • Gdt-entry
          • Sdm-instruction-set-summary
          • Tlb
          • Running-linux
          • Introduction
          • Asmtest
          • X86isa-build-instructions
          • Publications
          • Contributors
          • Machine
          • Implemented-opcodes
          • To-do
          • Proof-utilities
          • Peripherals
          • Model-validation
          • Modelcalls
          • Concrete-simulation-examples
            • Fibonacci32-cosim
            • Fibonacci-cosim
            • Factorial-cosim
              • X86isa-one-fact-cosim
              • Run-x86isa-fact
              • Check-fact-output
                • Fact
              • Nop-cosim
              • Datacopy-cosim
            • Utils
            • Debugging-code-proofs
          • 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
      • Factorial-cosim

      Check-fact-output

      Signature
      (check-fact-output input halt-address x86) → *
      Arguments
      x86 — Output x86 State.

      Definitions and Theorems

      Function: check-fact-output

      (defun check-fact-output (input halt-address x86)
       (declare (xargs :stobjs (x86)))
       (declare (type (unsigned-byte 50) input)
                (type (signed-byte 48) halt-address))
       (let ((__function__ 'check-fact-output))
        (declare (ignorable __function__))
        (cond
         ((or
            (fault x86)
            (not (equal (ms x86)
                        (cons (cons 'x86-fetch-decode-execute-halt
                                    (cons ':rip (cons halt-address 'nil)))
                              'nil))))
          (cw "~|(ms x86) = ~x0 (fault x86) = ~x1~%"
              (ms x86)
              (fault x86)))
         (t
          (let ((expected (fact input)))
           (cond
            ((and (< input 13)
                  (equal (rgfi *rax* x86) expected))
             (prog2$
                (cw "~|(x86isa-fact ~x0) was correctly computed as ~x1.~%"
                    input expected)
                t))
            (t
             (prog2$
              (cw
               "~|(x86isa-fact ~x0) = ~x1, but rax is ~x2,~% ~
                    but that's okay: that's what the program does for input ~x0.~%"
               input expected (rgfi *rax* x86))
              t))))))))