1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755
|
; RP-REWRITER
; Note: The license below is based on the template at:
; http://opensource.org/licenses/BSD-3-Clause
; Copyright (C) 2019, Regents of the University of Texas
; All rights reserved.
; Copyright (C) 2022 Intel Corporation
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are
; met:
; o Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; o Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution.
; o Neither the name of the copyright holders nor the names of its
; contributors may be used to endorse or promote products derived
; from this software without specific prior written permission.
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
; HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
; Original Author(s):
; Mertcan Temel <mert@utexas.edu>
(in-package "RP")
(include-Book "proof-functions")
(include-Book "eval-functions-lemmas")
(local (include-book "aux-function-lemmas"))
(local
(in-theory (enable falist-consistent)))
(defthm eval-and-all-append
(equal (eval-and-all (append x y) a)
(and (eval-and-all x a)
(eval-and-all y a)))
:hints (("Goal"
:in-theory (e/d (eval-and-all
append) ()))))
#|(encapsulate
nil
(local
(defthm flag-for-not-include-rp-of-beta-reduce-term
(implies (and (not (include-fnc-subterms vals 'rp))
#|(symbol-listp keys)||#
(if arg
(not (include-fnc-subterms term 'rp))
(not (include-fnc term 'rp))))
(if arg
(not (include-fnc-subterms (acl2::beta-reduce-term arg term keys vals)
'rp))
(not (include-fnc (acl2::beta-reduce-term arg term keys vals)
'rp))))))
(defthm not-include-rp-of-beta-reduce-term-arg=nil
(implies (and (not (include-fnc-subterms vals 'rp))
#|(symbol-listp keys)||#
(not (include-fnc term 'rp)))
(not (include-fnc (acl2::beta-reduce-term nil term keys vals)
'rp)))
:hints (("Goal"
:use ((:instance flag-for-not-include-rp-of-beta-reduce-term
(arg nil)))
:in-theory (e/d () ()))))
(defthm not-include-rp-of-beta-reduce-term-expr
(implies (and (is-lambda term)
(not (include-fnc term 'rp)))
(not (include-fnc (beta-reduce-lambda-expr term) 'rp)))
:hints (("Goal"
:use ((:instance not-include-rp-of-beta-reduce-term-arg=nil
(term (CAR (CDR (CDR (CAR TERM)))))
(keys (CAR (CDR (CAR TERM))))
(vals (CDR TERM))))
:in-theory (e/d (beta-reduce-lambda-expr
is-lambda)
(acl2::beta-reduce-term
not-include-rp-of-beta-reduce-term-arg=nil)))))
)||#
(defthm-valid-sc
(defthmd not-include-rp-means-valid-sc
(implies (and (not (include-fnc term 'rp))
(or (not (include-fnc term 'equals 2))
(not (include-fnc term 'equals))))
(and (valid-sc term a)))
:flag valid-sc)
(defthmd not-include-rp-means-valid-sc-lst
(implies (and (not (include-fnc-subterms subterms 'rp))
(or (not (include-fnc-subterms subterms 'equals 2))
(not (include-fnc-subterms subterms 'equals))))
(and (valid-sc-subterms subterms a)))
:flag valid-sc-subterms)
:hints (("Goal"
:in-theory (e/d (is-rp
valid-sc-nt) ()))))
(defthm-valid-sc-nt
(defthmd not-include-rp-means-valid-sc-nt
(implies (and (not (include-fnc term 'rp))
(or (not (include-fnc term 'equals 2))
(not (include-fnc term 'equals))))
(and (valid-sc-nt term a)))
:flag valid-sc-nt)
(defthmd not-include-rp-means-valid-sc-nt-subterms
(implies (and (not (include-fnc-subterms subterms 'rp))
(or (not (include-fnc-subterms subterms 'equals 2))
(not (include-fnc-subterms subterms 'equals))))
(and (valid-sc-nt-subterms subterms a)))
:flag valid-sc-nt-subterms)
:hints (("Goal"
:in-theory (e/d (is-rp
valid-sc-nt) ()))))
(defthm valid-sc-ex-from-rp
(implies (valid-sc term a)
(valid-sc (ex-from-rp term) a))
:hints (("Goal"
:induct (ex-from-rp term)
:in-theory (e/d (ex-from-rp is-rp) ()))))
(defthm valid-sc-ex-from-rp-2
(implies (EVAL-AND-ALL (CONTEXT-FROM-RP TERM NIL)
A)
(equal (valid-sc (ex-from-rp term) a)
(valid-sc term a)))
:hints (("Goal"
:induct (ex-from-rp term)
:in-theory (e/d (CONTEXT-FROM-RP
ex-from-rp
is-rp) ()))))
(defthm valid-sc-nil
(and (VALID-SC NIL A)
(VALID-SC-BINDINGS NIL A))
:hints (("Goal"
:in-theory (e/d (valid-sc
valid-sc-bindings) ()))))
(encapsulate
nil
(defthm extract-from-rp-pseudo-term-listp
(implies (rp-termp term)
(rp-termp (ex-from-rp TERM)))
:hints (("Goal"
:induct (ex-from-rp TERM)
:in-theory (enable is-rp ex-from-rp))))
(defthm extract-from-synp-pseudo-term-listp
(implies (rp-termp term)
(rp-termp (ex-from-synp TERM)))
:hints (("Goal"
:in-theory (enable is-synp extract-from-synp)))
:rule-classes :forward-chaining)
(local
(defthmd pseudo-termp-lemma2
(implies (rp-termp term)
(not (equal term nil)))))
(local
(defthm stupid-lemma1
(implies (and (rp-termp term)
(should-term-be-in-cons term term2))
(and (ex-from-synp (ex-from-rp (cadr term)))))
:instructions
((:in-theory (e/d (should-term-be-in-cons)
(ex-from-synp)))
(:use (:instance pseudo-termp-lemma2
(term (ex-from-synp (ex-from-rp (cadr term))))))
:promote (:demote 1)
(:dv 1 1)
(:rewrite pseudo-termp-extract-from-synp)
(:change-goal nil t)
(:rewrite extract-from-rp-pseudo-term-listp)
(:change-goal nil t)
(:change-goal nil t)
:expand :s-prop (:demote 2)
(:dive 1)
:s :top
:promote :prove
:top :s)))
(local
(defthm stupid-lemma2
(implies (and (rp-termp term)
(should-term-be-in-cons term term2))
(and (ex-from-synp (ex-from-rp (caddr term)))))
:instructions
((:in-theory (e/d (should-term-be-in-cons)
(ex-from-synp)))
(:use (:instance pseudo-termp-lemma2
(term (ex-from-synp (ex-from-rp (caddr term))))))
:promote (:demote 1)
(:dv 1 1)
(:rewrite pseudo-termp-extract-from-synp)
(:change-goal nil t)
(:rewrite extract-from-rp-pseudo-term-listp)
(:change-goal nil t)
(:change-goal nil t)
:expand :s-prop (:demote 2)
(:dive 1)
:s :top
:promote :prove
:top :s)))
(defthm psuedo-termp2-and-ex-form-synp&rp
(implies (and (rp-termp term)
(should-term-be-in-cons term term2))
(and (ex-from-synp (ex-from-rp (cadr term)))
(ex-from-synp (ex-from-rp (caddr term)))))
:hints (("goal"
:use ((:instance stupid-lemma2)
(:instance stupid-lemma1))
:in-theory (e/d (stupid-lemma2 stupid-lemma1)
(ex-from-synp)))))
(defthm is-if-rp-termp
(implies (and (rp-termp term)
(is-if term))
(and (rp-termp (cadr term))
(rp-termp (caddr term))
(rp-termp (cadddr term))))
:hints (("Goal" :in-theory (enable is-if)))))
(defthm rp-termp-implies-subterms
(implies (and (consp term)
(not (quotep term))
(rp-termp term))
(rp-term-listp (cdr term))))
(defthm valid-sc-subterms-append
(equal (valid-sc-subterms (append x y) a)
(and (valid-sc-subterms x a)
(valid-sc-subterms y a)))
:hints (("Goal"
:in-theory (e/d (valid-sc
append) ()))))
(defthm valid-rulep-implies-valid-sc
(implies (and (valid-rulep rule)
(eval-and-all-nt (rp-hyp rule) a))
(valid-sc-nt (rp-rhs rule) a))
:hints (("Goal"
:use (:instance valid-rulep-sk-necc)
:in-theory (e/d (valid-rulep
not-include-rp-means-valid-sc
not-include-rp-means-valid-sc-nt)
(valid-sc
rp-rhs
rp-hyp
valid-sc-nt
VALID-RULEP-SK
valid-rulep-sk-necc
rule-syntaxp)))))
(defthm-ext-side-conditions
(defthm not-include-rp-EXT-SIDE-CONDITIONS
(implies (NOT (INCLUDE-FNC TERM 'RP))
(equal (EXT-SIDE-CONDITIONS TERM context)
nil))
:flag ext-side-conditions)
(defthm not-include-rp-EXT-SIDE-CONDITIONS-subterms
(implies (NOT (INCLUDE-FNC-SUBTERMS subterms 'RP))
(equal (ext-side-conditions-subterms subterms context)
nil))
:flag ext-side-conditions-subterms)
:hints (("Goal"
:in-theory (e/d (is-rp
ext-side-conditions-subterms
ext-side-conditions)
(EXTRACT-FROM-RP-WITH-CONTEXT)))))
(encapsulate
nil
(defthm not-include-synp
(implies (not (include-fnc term 'synp))
(not (is-synp term)))
:hints (("Goal" :in-theory (enable is-synp))))
(defthm not-include-rp
(implies (not (include-fnc term 'rp))
(not (is-rp term)))
:hints (("Goal" :in-theory (enable is-rp))))
(defthm not-include-ex-from-rp
(implies (not (include-fnc term fnc))
(not (include-fnc (ex-from-rp term) fnc)))
:hints (("Goal"
:in-theory (enable ex-from-rp)
:induct (ex-from-rp term))))
(defthm ex-from-rp-put-term-in-cons
(equal (ex-from-rp (put-term-in-cons term))
(put-term-in-cons term))
:hints (("Goal" :in-theory (enable put-term-in-cons ex-from-rp))))
(defthm quotep-term-with-ex-from-rp
(implies (quotep term)
(quotep (EX-FROM-RP TERM)))
:hints (("Goal" :in-theory (enable ex-from-rp))))
(defthm quotep-term-with-ex-from-synp
(implies (quotep term)
(quotep (EX-FROM-synp TERM)))
:hints (("Goal" :in-theory (enable ex-from-synp))))
(defthm ex-from-synp-put-term-in-cons
(equal (ex-from-synp (put-term-in-cons term))
(put-term-in-cons term))
:hints (("Goal" :in-theory (enable put-term-in-cons ex-from-synp
is-synp))))
(defthm should-term-be-in-cons-lemma2
(implies (should-term-be-in-cons lhs1 term1)
(and (not (should-term-be-in-cons t2 lhs1))
(not (should-term-be-in-cons term1 t3))))
:hints (("Goal" :in-theory (enable should-term-be-in-cons))))
(defthm should-term-be-in-cons-lemma3
(not (should-term-be-in-cons lhs (PUT-TERM-IN-CONS TERM)))
:hints (("Goal" :in-theory (enable put-term-in-cons
should-term-be-in-cons))))
(defthm car-put-term-in-cons
(equal (car (put-term-in-cons term))
'cons)
:hints (("Goal" :in-theory (enable put-term-in-cons))))
(defthmd should-term-be-in-cons-lemma4
(implies (should-term-be-in-cons lhs term)
(equal (car lhs)
'cons))
:hints (("Goal" :in-theory (enable should-term-be-in-cons))))
(defthm is-synp-put-term-cons
(NOT (IS-SYNP (PUT-TERM-IN-CONS term)))
:hints (("Goal" :in-theory (enable put-term-in-cons is-synp))))
(defthm ex-from-rp-cons-cons
(equal (ex-from-rp (cons 'cons x))
(cons 'cons x))
:hints (("Goal" :in-theory (enable ex-from-rp
is-rp))))
(defthm ex-from-rp-put-term-cons
(equal (EX-FROM-RP (PUT-TERM-IN-CONS term))
(put-term-in-cons term))
:hints (("Goal" :in-theory (enable put-term-in-cons
is-rp
ex-from-rp))))
(defthm RP-TERM-LISTP-CDR-PUT-TERM-IN-CONS
(RP-TERM-LISTP (CDR (PUT-TERM-IN-CONS term)))
:hints (("Goal" :in-theory (enable PUT-TERM-IN-CONS)))))
#|(encapsulate
nil
(local
(defthm lemma1
(implies (subtermp-lst x z)
(subtermp-lst x (cons y z)))))
(defthm subtermp-lst-of-the-same
(subtermp-lst x x)))||#
;; (defthm subtermp-ex-from-rp
;; (subtermp (ex-from-rp term) term)
;; :hints (("Goal" :in-theory (enable is-rp ex-from-rp)
;; :induct (ex-from-rp term))))
;; (defthm subtermp-of-the-same
;; (subtermp term term))
(encapsulate
nil
(local
(defthm subsetp-lemma
(implies (subsetp x y)
(subsetp x (cons s y)))))
(defthm context-from-subsetp
(subsetp context (context-from-rp term context) )
:hints (("Goal" :in-theory (enable context-from-rp)
:induct (context-from-rp term context)))))
(encapsulate
nil
(local
(defthm lemma1
(implies
(valid-rulesp lst)
(RULE-LIST-SYNTAXP lst))
:hints (("Goal"
:in-theory (e/d (rule-list-syntaxp)
(valid-rulep-sk
rule-syntaxp))))))
(local
(defthm lemma2
(IMPLIES (AND (VALID-RULES-LIST-LISTP alist))
(RULE-LIST-LIST-SYNTAXP alist))
:hints (("Goal"
:in-theory (e/d () (rule-syntaxp
valid-rulep-sk))))))
(defthm valid-rules-alistp-implies-RULES-ALISTP
(implies (valid-rules-alistp rules-alist)
(rules-alistp rules-alist))
:otf-flg t
:hints (("Goal"
:in-theory (e/d (valid-rules-alistp
RULE-LIST-LIST-SYNTAXP
VALID-RULES-LIST-LISTP
valid-rulesp
rules-alistp
valid-rulep)
(valid-rulep-sk
rule-syntaxp))))))
(defthm VALID-RULESP-implies-RULE-LIST-SYNTAXP
(implies (valid-rulesp rules)
(rule-list-syntaxp rules))
:hints (("Goal"
:in-theory (e/d (valid-rulesp
rule-list-syntaxp)
((:definition falist-consistent)
(:definition rp-termp)
rule-syntaxp
(:definition subsetp-equal))))))
#|(defthm valid-sc-and-is-if
(implies (and (is-if term)
(valid-sc term a))
(and (valid-sc (cadr term) a)
(if (rp-evlt (cadr term) a)
(valid-sc (caddr term) a)
(valid-sc (cadddr term) a))))
:rule-classes :forward-chaining
:hints (("Goal"
:expand (valid-sc term a)
:in-theory (e/d (is-if)
(valid-sc)))))|#
(defthm valid-rules-subsetp
(implies (and (valid-rulesp rules)
(true-listp subrules)
(subsetp subrules rules))
(valid-rulesp subrules))
:hints (("Goal"
:in-theory (disable valid-rulep))))
(defthm-ex-from-rp-all2
(defthm valid-sc-ex-from-rp-all2
(valid-sc (ex-from-rp-all2 term) a)
:flag ex-from-rp-all2)
(defthm valid-sc-subterms-ex-from-rp-all2-lst
(valid-sc-subterms (ex-from-rp-all2-lst lst) a)
:flag ex-from-rp-all2-lst)
:hints (("Goal"
:do-not-induct t
:expand (VALID-SC (CONS (CAR TERM)
(EX-FROM-RP-ALL2-LST (CDR TERM)))
A)
:in-theory (e/d (
EX-FROM-RP-ALL2
is-rp-loose
IS-EQUALS
is-rp
is-if
;;rp-termp-ex-from-rp-all2-lemma
ex-from-rp-all2-lst
)
(ex-from-rp
;;FALIST-CONSISTENT
RP-TERMP-EX-FROM-RP
RP-TERMP-CONS-CAR-TERM-SUBTERMS
)))))
(encapsulate
nil
(local
(defthm rp-evl-of-beta-reduce-lambda-expr-lemma
(implies (AND (ACL2::LAMBDA-EXPR-P acl2::TERM)
(PSEUDO-TERMP acl2::TERM))
(equal (rp-evl (acl2::beta-reduce-lambda-expr acl2::term) acl2::a1)
(rp-evl acl2::term acl2::a1)))
:hints (("Goal"
:use ((:functional-instance
acl2::beta-eval-to-beta-reduce-lambda-expr
(acl2::beta-eval rp-evl)
(acl2::beta-eval-list rp-evl-lst)))
:in-theory (e/d (is-lambda
rp-evl-of-fncall-args)
(acl2::beta-eval-to-beta-reduce-lambda-expr
))))))
(defthm rp-evl-of-beta-reduce-lambda-expr
(implies (AND (rp-termp term)
(is-lambda term))
(equal (rp-evl (acl2::beta-reduce-lambda-expr term) a)
(rp-evl term a)))
:hints (("Goal"
:in-theory (e/d (is-lambda) ()))))
#|(defthm rp-termp-of-beta-reduce-lambda-expr
(implies (and (rp-termp term)
(is-lambda term))
(rp-termp (acl2::beta-reduce-lambda-expr term))))||#
#|(defthm ALL-FALIST-CONSISTENT-of-beta-reduce-lambda-expr
(implies (and (rp-termp term)
(all-falist-consistent term)
(is-lambda term))
(all-falist-consistent (acl2::beta-reduce-lambda-expr term))))||#
#|(defthm rp-syntaxp-of-beta-reduce-lambda-expr
(implies (and (rp-termp term)
(rp-syntaxp term)
(is-lambda term))
(rp-syntaxp (acl2::beta-reduce-lambda-expr term))))||#)
#|(defthm valid-sc-caddr-term
(implies (and (valid-sc term a)
(not (equal (car term) 'if))
(not (equal (car term) 'quote))
(consp term)
(consp (cdr term))
(consp (cddr term)))
(VALID-SC (CADDR TERM) A))
:hints (("Goal"
:expand ((VALID-SC TERM A))
:in-theory (e/d (valid-sc
is-if
is-rp)
()))))||#
#|(defthm valid-sc-cadr-ex-from-rp
(IMPLIES (AND
(CONSP (EX-FROM-RP TERM))
(Not (EQUAL (CAR (EX-FROM-RP TERM)) 'if))
(Not (EQUAL (CAR (EX-FROM-RP TERM)) 'quote))
(CONSP (CDR (EX-FROM-RP TERM)))
(VALID-SC TERM A))
(VALID-SC (CADR (EX-FROM-RP TERM)) A))
:hints (("Goal"
:in-theory (e/d (ex-from-rp
is-if
is-rp) ()))))||#
(defthm valid-sc-ex-from-falist
(implies (valid-sc x a)
(valid-sc (ex-from-falist x) a))
:rule-classes :rewrite
:hints (("Goal"
:expand (ex-from-falist x)
:in-theory (e/d (is-rp
is-if) ()))))
(defthm valid-sc-ex-from-falist-replace
(implies (rp-termp x)
(equal (valid-sc (ex-from-falist x) a)
(valid-sc x a)))
:rule-classes :rewrite
:hints (("Goal"
:expand (ex-from-falist x)
:in-theory (e/d (is-rp
is-if) ()))))
(defthm rp-evl-of-ex-from-falist
(equal (rp-evl (ex-from-falist x) a)
(rp-evl x a))
:hints (("Goal"
:Expand (ex-from-falist x)
:in-theory (e/d () ()))))
(defthm eval-and-all-nt-is-eval-and-all
(implies (not (include-fnc-subterms lst 'list))
(equal (eval-and-all-nt lst a)
(eval-and-all lst a))))
(defthm EVAL-AND-ALL-NT-of-context-from-rp
(implies (and (not (include-fnc-subterms context 'list))
(not (include-fnc term 'list)))
(equal (EVAL-AND-ALL-NT (CONTEXT-FROM-RP TERM context) A)
(EVAL-AND-ALL (CONTEXT-FROM-RP TERM context) A)))
:hints (("Goal"
:induct (CONTEXT-FROM-RP TERM context)
:in-theory (e/d (context-from-rp
eval-and-all-nt-is-eval-and-all
is-rp
rp-evl-of-fncall-args)
()))))
(defthm-valid-sc
(defthm valid-sc-nt-is-valid-sc
(implies (not (include-fnc term 'list))
(equal (valid-sc-nt term a)
(valid-sc term a)))
:flag valid-sc)
(defthm valid-sc-nt-subterms-valid-sc-subterms
(implies (not (include-fnc-subterms subterms 'list))
(equal (valid-sc-nt-subterms subterms a)
(valid-sc-subterms subterms a)))
:flag valid-sc-subterms)
:hints (("Goal"
:expand (VALID-SC-NT TERM A)
:in-theory (e/d (EVAL-AND-ALL-NT-of-context-from-rp) ()))))
(defthm rp-evl-of-trans-list-lemma
(equal (rp-evl (trans-list lst) a)
(rp-evl-lst lst a))
:hints (("Goal"
:do-not-induct t
:induct (trans-list lst)
:in-theory (e/d () ()))))
(local
(defun two-cdr-induct (x y)
(if (or (atom x)
(atom y))
nil
(acons (car x)
(car y)
(two-cdr-induct (cdr x) (cdr y))))))
(local
(defthm rp-evl-of-trans-list-lemma-3
(implies (and (not (consp x))
(not (rp-evl-lst y a)))
(not (rp-evl-lst y a)))))
(defthm rp-evl-of-trans-list-lemma-2
(implies (equal (rp-evl-lst x a1)
(rp-evl-lst y a2))
(equal (equal (rp-evl-lst x a1)
(rp-evl-lst y a2))
t))
:otf-flg t
:hints (("goal"
:do-not-induct t
:induct (two-cdr-induct x y)
:in-theory (e/d () ()))))
(defthm consp-of-RP-EVL-OF-TRANS-LIST
(equal (CONSP (rp-evl-lst lst A))
(consp lst))
:hints (("Goal"
:use ((:instance RP-EVL-LST-OF-ATOM
(ACL2::X-LST lst)
(ACL2::a a)))
:in-theory (e/d ()
(RP-EVL-LST-OF-ATOM)))))
(defthm RP-EVL-OF-TRANS-LIST-nil
(equal (rp-evl-lst nil A)
nil)
:hints (("Goal"
:in-theory (e/d () ()))))
(defthm rp-evlt-of-trans-list-lemma
(equal (rp-evlt (trans-list lst) a)
(rp-evlt-lst lst a))
:hints (("goal" :do-not-induct t
:induct (trans-list lst)
:in-theory (e/d nil nil))))
(defthm valid-sc-of-trans-list-lemma
(implies (valid-sc-subterms lst a)
(valid-sc (trans-list lst) a))
:hints (("goal" :do-not-induct t
:induct (trans-list lst)
:in-theory (e/d (valid-sc is-if is-equals is-rp)
()))))
(defthm rp-state-preservedp-implies-valid-rp-statep
(implies (and ;;(rp-statep rp-state)
(valid-rp-statep rp-state)
(rp-state-preservedp rp-state new-rp-state))
(valid-rp-statep new-rp-state))
:hints (("Goal"
:do-not-induct t
:use ((:instance RP-STATE-PRESERVEDP-SK-necc
(key (valid-rp-statep-witness NEW-RP-STATE))
(OLD-RP-STATE rp-state))
(:instance valid-rp-statep-necc
(key (valid-rp-statep-witness NEW-RP-STATE))))
:expand (valid-rp-statep new-rp-state)
:in-theory (e/d (rp-state-preservedp)
(RP-STATE-PRESERVEDP-SK
VALID-RP-STATEP
VALID-RULESP
RP-STATE-PRESERVEDP-SK
VALID-RP-STATE-SYNTAXP-AUX
valid-rp-statep
(:DEFINITION NOT)
(:TYPE-PRESCRIPTION VALID-RP-STATEP)
(:TYPE-PRESCRIPTION VALID-RULESP)
RP-STATEP)))))
(defthm valid-sc-subterms-of-rev
(equal (valid-sc-subterms (rev x) a)
(valid-sc-subterms x a))
:hints (("Goal"
:in-theory (e/d (rev) ()))))
(defthm eval-and-all-of-rev
(equal (eval-and-all (rev x) a)
(eval-and-all x a))
:hints (("Goal"
:in-theory (e/d (rev) ()))))
|