Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Quoting :doc note-7-3: It is now legal for a [rewrite] rule to rewrite of a call of [if]. We thank Eric Smith for pointing us to examples where this can be useful, such as breaking into cases based on the test. One such example is much like the following, where we may have a good reason for leaving my-or disabled in general, but we wish for a call of my-or to expand when it is the test of an if-expression. (defund my-or (x y) (or x y)) (defthm my-or-opener (equal (if (my-or t1 t2) x y) (if t1 x (if t2 x y))) :hints (("Goal" :in-theory (enable my-or)))) ; succeeds (thm (equal (if (my-or a b) u v) (if a u (if b u v)))) Also made a fix to define-sk that more properly checks proposed rewrite rules (especially important after the change above).
- Loading branch information
1 parent
990521c
commit 5dcced5
Showing
7 changed files
with
89 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
; Copyright (C) 2016, Regents of the University of Texas | ||
; Written by Matt Kaufmann | ||
; License: A 3-clause BSD license. See the LICENSE file distributed with ACL2. | ||
|
||
; This book introduces a Boolean-valued version of chk-acceptable-rewrite-rule, | ||
; returning t when the form of the proposed rewrite rule is acceptable. Note | ||
; that it avoids the call chk-rewrite-rule-warnings that is found in | ||
; chk-rewrite-rule-warnings. | ||
|
||
(in-package "ACL2") | ||
|
||
(program) | ||
|
||
(defun acceptable-rewrite-rule-p1 (name lst ens wrld) | ||
|
||
; Based on ACL2 function chk-acceptable-rewrite-rule1. Thus: | ||
|
||
; Each element of lst is a pair, (hyps . concl) and we check that each | ||
; such pair, when interpreted as the term (implies (and . hyps) | ||
; concl), generates a legal :REWRITE rule. | ||
|
||
(cond | ||
((null lst) t) | ||
(t (mv-let | ||
(msg eqv lhs rhs ttree) | ||
(interpret-term-as-rewrite-rule name | ||
(caar lst) ; hyps | ||
(cdar lst) ; concl | ||
ens wrld) | ||
(declare (ignore eqv lhs rhs ttree)) | ||
(and (null msg) | ||
(acceptable-rewrite-rule-p1 name (cdr lst) ens wrld)))))) | ||
|
||
(defun acceptable-rewrite-rule-p (term ens wrld) | ||
|
||
; Based on ACL2 function chk-acceptable-rewrite-rule. | ||
|
||
(acceptable-rewrite-rule-p1 :some-proposed-rewrite-rule | ||
(unprettyify (remove-guard-holders term)) | ||
ens wrld)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters