0

I'm having some trouble with acl2, trying to prove the following:

(thm (implies (acl2-numberp x) (equal (* -2 x) (* 2 (- x)))))

which results in:

ACL2 !>(thm (implies (acl2-numberp x) (equal (* -2 x) (* 2 (- x)))))

*1 (the initial Goal, a key checkpoint) is pushed for proof by induction.

No induction schemes are suggested by *1. Consequently, the proof
attempt has failed.

Summary
Form: ( THM ...)
Rules: NIL
Time: 0.01 seconds (prove: 0.00, print: 0.00, other: 0.00)
Prover steps counted: 63

---
The key checkpoint goal, below, may help you to debug this failure.
See :DOC failure and see :DOC set-checkpoint-summary-limit.
---

*** Key checkpoint at the top level: ***

Goal
(IMPLIES (ACL2-NUMBERP X)
(EQUAL (* -2 X) (* 2 (- X))))

ACL2 Error in ( THM ...): See :DOC failure.

******** FAILED ********

However, when I try:

(thm (implies (acl2-numberp x) (equal (* -1 x) (* 1 (- x)))))

it succeeds easily. Does anyone know why this is happening and how to fix it?

1 Answers1

0

Often people expect ACL2 to be able to reason about everything "out of the box." In practice, those of us who use ACL2 will often include relevant libraries. In this example, I'd use the "arithmetic/top" library.

ACL2 !>(include-book "arithmetic/top" :dir :system)

Summary
Form:  ( INCLUDE-BOOK "arithmetic/top" ...)
<snip>
ACL2 !>(thm (implies (acl2-numberp x) (equal (* -2 x) (* 2 (- x)))))

Q.E.D.

Summary
Form:  ( THM ...)
Rules: ((:EXECUTABLE-COUNTERPART IF)
        (:REWRITE FUNCTIONAL-COMMUTATIVITY-OF-MINUS-*-LEFT)
        (:REWRITE FUNCTIONAL-COMMUTATIVITY-OF-MINUS-*-RIGHT))
Time:  0.00 seconds (prove: 0.00, print: 0.00, other: 0.00)
Prover steps counted:  23

Proof succeeded.
ACL2 !>

To answer your question as to "why", it's because ACL2 has builtin rules for canonicalizing the "(* -1 ..)" but not the "(* -2 ...)"

interestedparty333
  • 2,386
  • 1
  • 21
  • 35