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 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121
|
(UNSET-WATERFALL-PARALLELISM)
(ASSIGN SCRIPT-MODE T)
T
(SET-LD-PROMPT T STATE)
T
ACL2 !>>(SET-INHIBITED-SUMMARY-TYPES '(TIME STEPS))
(TIME STEPS)
ACL2 !>>(SET-INHIBIT-OUTPUT-LST '(PROOF-TREE))
(PROOF-TREE)
ACL2 !>>(SET-GUARD-CHECKING NIL)
Masking guard violations but still checking guards except for self-
recursive calls. To avoid guard checking entirely, :SET-GUARD-CHECKING
:NONE. See :DOC set-guard-checking.
ACL2 >>(SET-GAG-MODE NIL)
<state>
ACL2 >>(INCLUDE-BOOK "m1")
Summary
Form: ( INCLUDE-BOOK "m1" ...)
Rules: NIL
(:SYSTEM . "demos/marktoberdorf-08/m1.lisp")
ACL2 >>(INCLUDE-BOOK "compile")
Summary
Form: ( INCLUDE-BOOK "compile" ...)
Rules: NIL
(:SYSTEM . "demos/marktoberdorf-08/compile.lisp")
ACL2 >>(IN-PACKAGE "M1")
"M1"
M1 >>(DEFUN F (N)
(IF (ZP N) 1 (* N (F (- N 1)))))
The admission of F is trivial, using the relation O< (which is known
to be well-founded on the domain recognized by O-P) and the measure
(ACL2-COUNT N). We observe that the type of F is described by the
theorem (AND (INTEGERP (F N)) (< 0 (F N))). We used the :compound-
recognizer rule ACL2::ZP-COMPOUND-RECOGNIZER and primitive type reasoning.
Summary
Form: ( DEFUN F ...)
Rules: ((:COMPOUND-RECOGNIZER ACL2::ZP-COMPOUND-RECOGNIZER)
(:FAKE-RUNE-FOR-TYPE-SET NIL))
F
M1 >>(DEFUN G (N A)
(IF (ZP N) A (G (- N 1) (* N A))))
The admission of G is trivial, using the relation O< (which is known
to be well-founded on the domain recognized by O-P) and the measure
(ACL2-COUNT N). We observe that the type of G is described by the
theorem (OR (ACL2-NUMBERP (G N A)) (EQUAL (G N A) A)). We used primitive
type reasoning.
Summary
Form: ( DEFUN G ...)
Rules: ((:FAKE-RUNE-FOR-TYPE-SET NIL))
G
M1 >>(DEFCONST *G*
'((PUSH 1)
(STORE 1)
(LOAD 0)
(IFLE 10)
(LOAD 0)
(LOAD 1)
(MUL)
(STORE 1)
(LOAD 0)
(PUSH 1)
(SUB)
(STORE 0)
(GOTO -10)
(LOAD 1)
(RETURN)))
Summary
Form: ( DEFCONST *G* ...)
Rules: NIL
*G*
M1 >>(DEFUN G-SCHED-LOOP (N)
(IF (ZP N)
(REPEAT 0 4)
(APPEND (REPEAT 0 11)
(G-SCHED-LOOP (- N 1)))))
The admission of G-SCHED-LOOP is trivial, using the relation O< (which
is known to be well-founded on the domain recognized by O-P) and the
measure (ACL2-COUNT N). We observe that the type of G-SCHED-LOOP is
described by the theorem (TRUE-LISTP (G-SCHED-LOOP N)). We used the
:type-prescription rules BINARY-APPEND, REPEAT and ACL2::TRUE-LISTP-APPEND.
Summary
Form: ( DEFUN G-SCHED-LOOP ...)
Rules: ((:TYPE-PRESCRIPTION BINARY-APPEND)
(:TYPE-PRESCRIPTION REPEAT)
(:TYPE-PRESCRIPTION ACL2::TRUE-LISTP-APPEND))
G-SCHED-LOOP
M1 >>(DEFUN G-SCHED (N)
(APPEND (REPEAT 0 2) (G-SCHED-LOOP N)))
Since G-SCHED is non-recursive, its admission is trivial. We observe
that the type of G-SCHED is described by the theorem
(TRUE-LISTP (G-SCHED N)). We used the :type-prescription rules G-SCHED-LOOP
and ACL2::TRUE-LISTP-APPEND.
Summary
Form: ( DEFUN G-SCHED ...)
Rules: ((:TYPE-PRESCRIPTION G-SCHED-LOOP)
(:TYPE-PRESCRIPTION ACL2::TRUE-LISTP-APPEND))
G-SCHED
M1 >>'(END OF SETUP)
(END OF SETUP)
M1 >>(THM (EQUAL (RUN (REPEAT 0 9)
(MAKE-STATE 4 (LIST N A) STK *G*))
???))
By the :executable-counterpart of REPEAT and the simple :rewrite rule
RUN-OPENER we reduce the conjecture to
Goal'
(EQUAL
(STEP
(STEP
(STEP
(STEP (STEP (STEP (STEP (STEP (STEP (MAKE-STATE 4 (LIST N A)
STK
'((PUSH 1)
(STORE 1)
(LOAD 0)
(IFLE 10)
(LOAD 0)
(LOAD 1)
(MUL)
(STORE 1)
(LOAD 0)
(PUSH 1)
(SUB)
(STORE 0)
(GOTO -10)
(LOAD 1)
(RETURN))))))))))))
???).
This simplifies, using the :compound-recognizer rule
ACL2::NATP-COMPOUND-RECOGNIZER, the :definitions DO-INST, EXECUTE-GOTO,
EXECUTE-LOAD, EXECUTE-MUL, EXECUTE-PUSH, EXECUTE-STORE, EXECUTE-SUB,
NEXT-INST and UPDATE-NTH, the :executable-counterparts of ARG1, BINARY-+,
CONSP, EQUAL, NTH, OPCODE, UNARY-- and ZP and the :rewrite rules CAR-CONS,
CDR-CONS, COMMUTATIVITY-OF-*, COMMUTATIVITY-OF-+, NTH-0-CONS, NTH-ADD1!,
STACKS, STATES, STEP-OPENER and UPDATE-NTH-ADD1!, to
Goal''
(EQUAL (MAKE-STATE 2 (LIST (+ -1 N) (* A N))
STK
'((PUSH 1)
(STORE 1)
(LOAD 0)
(IFLE 10)
(LOAD 0)
(LOAD 1)
(MUL)
(STORE 1)
(LOAD 0)
(PUSH 1)
(SUB)
(STORE 0)
(GOTO -10)
(LOAD 1)
(RETURN)))
???).
Name the formula above *1.
No induction schemes are suggested by *1. Consequently, the proof
attempt has failed.
Summary
Form: ( THM ...)
Rules: ((:COMPOUND-RECOGNIZER ACL2::NATP-COMPOUND-RECOGNIZER)
(:DEFINITION DO-INST)
(:DEFINITION EXECUTE-GOTO)
(:DEFINITION EXECUTE-LOAD)
(:DEFINITION EXECUTE-MUL)
(:DEFINITION EXECUTE-PUSH)
(:DEFINITION EXECUTE-STORE)
(:DEFINITION EXECUTE-SUB)
(:DEFINITION NEXT-INST)
(:DEFINITION UPDATE-NTH)
(:EXECUTABLE-COUNTERPART ARG1)
(:EXECUTABLE-COUNTERPART BINARY-+)
(:EXECUTABLE-COUNTERPART CONSP)
(:EXECUTABLE-COUNTERPART EQUAL)
(:EXECUTABLE-COUNTERPART NTH)
(:EXECUTABLE-COUNTERPART OPCODE)
(:EXECUTABLE-COUNTERPART REPEAT)
(:EXECUTABLE-COUNTERPART UNARY--)
(:EXECUTABLE-COUNTERPART ZP)
(:REWRITE CAR-CONS)
(:REWRITE CDR-CONS)
(:REWRITE COMMUTATIVITY-OF-*)
(:REWRITE COMMUTATIVITY-OF-+)
(:REWRITE NTH-0-CONS)
(:REWRITE NTH-ADD1!)
(:REWRITE RUN-OPENER)
(:REWRITE STACKS)
(:REWRITE STATES)
(:REWRITE STEP-OPENER)
(:REWRITE UPDATE-NTH-ADD1!))
---
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''
(EQUAL (MAKE-STATE 2 (LIST (+ -1 N) (* A N))
STK
'((PUSH 1)
(STORE 1)
(LOAD 0)
(IFLE 10)
(LOAD 0)
(LOAD 1)
(MUL)
(STORE 1)
(LOAD 0)
(PUSH 1)
(SUB)
(STORE 0)
(GOTO -10)
(LOAD 1)
(RETURN)))
???)
ACL2 Error [Failure] in ( THM ...): See :DOC failure.
******** FAILED ********
M1 >>'(END OF DEMO 1)
(END OF DEMO 1)
M1 >>(THM (EQUAL (RUN (APPEND A B) S)
(RUN B (RUN A S)))
:HINTS (("Goal" :IN-THEORY (DISABLE RUN-APPEND))))
[Note: A hint was supplied for the goal above. Thanks!]
Name the formula above *1.
Perhaps we can prove *1 by induction. Three induction schemes are
suggested by this conjecture. These merge into two derived induction
schemes. However, one of these is flawed and so we are left with one
viable candidate.
We will induct according to a scheme suggested by (RUN A S), but modified
to accommodate (APPEND A B).
These suggestions were produced using the :induction rules BINARY-APPEND
and RUN. If we let (:P A B S) denote *1 above then the induction scheme
we'll use is
(AND (IMPLIES (AND (NOT (ENDP A))
(:P (CDR A) B (STEP S)))
(:P A B S))
(IMPLIES (ENDP A) (:P A B S))).
This induction is justified by the same argument used to admit RUN.
Note, however, that the unmeasured variable S is being instantiated.
When applied to the goal at hand the above induction scheme produces
two nontautological subgoals.
Subgoal *1/2
(IMPLIES (AND (NOT (ENDP A))
(EQUAL (RUN (APPEND (CDR A) B) (STEP S))
(RUN B (RUN (CDR A) (STEP S)))))
(EQUAL (RUN (APPEND A B) S)
(RUN B (RUN A S)))).
By the simple :definition ENDP we reduce the conjecture to
Subgoal *1/2'
(IMPLIES (AND (CONSP A)
(EQUAL (RUN (APPEND (CDR A) B) (STEP S))
(RUN B (RUN (CDR A) (STEP S)))))
(EQUAL (RUN (APPEND A B) S)
(RUN B (RUN A S)))).
But simplification reduces this to T, using the :definitions BINARY-APPEND
and RUN, primitive type reasoning and the :rewrite rule RUN-OPENER.
Subgoal *1/1
(IMPLIES (ENDP A)
(EQUAL (RUN (APPEND A B) S)
(RUN B (RUN A S)))).
By the simple :definition ENDP we reduce the conjecture to
Subgoal *1/1'
(IMPLIES (NOT (CONSP A))
(EQUAL (RUN (APPEND A B) S)
(RUN B (RUN A S)))).
But simplification reduces this to T, using the :definitions BINARY-APPEND
and RUN and primitive type reasoning.
That completes the proof of *1.
Q.E.D.
Summary
Form: ( THM ...)
Rules: ((:DEFINITION BINARY-APPEND)
(:DEFINITION ENDP)
(:DEFINITION NOT)
(:DEFINITION RUN)
(:FAKE-RUNE-FOR-TYPE-SET NIL)
(:INDUCTION BINARY-APPEND)
(:INDUCTION RUN)
(:REWRITE RUN-OPENER))
Proof succeeded.
M1 >>'(END OF DEMO 2)
(END OF DEMO 2)
M1 >>(DEFTHM STEP-1-[LOOP]
(IMPLIES (AND (NATP N) (NATP A))
(EQUAL (RUN (G-SCHED-LOOP N)
(MAKE-STATE 2 (LIST N A) STK *G*))
(MAKE-STATE 14 (LIST 0 (G N A))
(PUSH (G N A) STK)
*G*))))
Name the formula above *1.
Perhaps we can prove *1 by induction. Three induction schemes are
suggested by this conjecture. Subsumption reduces that number to one.
We will induct according to a scheme suggested by (G N A).
This suggestion was produced using the :induction rules G and G-SCHED-LOOP.
If we let (:P A N STK) denote *1 above then the induction scheme we'll
use is
(AND (IMPLIES (AND (NOT (ZP N))
(:P (* N A) (+ -1 N) STK))
(:P A N STK))
(IMPLIES (ZP N) (:P A N STK))).
This induction is justified by the same argument used to admit G.
Note, however, that the unmeasured variable A is being instantiated.
When applied to the goal at hand the above induction scheme produces
four nontautological subgoals.
Subgoal *1/4
(IMPLIES (AND (NOT (ZP N))
(EQUAL (RUN (G-SCHED-LOOP (+ -1 N))
(MAKE-STATE 2 (LIST (+ -1 N) (* N A))
STK
'((PUSH 1)
(STORE 1)
(LOAD 0)
(IFLE 10)
(LOAD 0)
(LOAD 1)
(MUL)
(STORE 1)
(LOAD 0)
(PUSH 1)
(SUB)
(STORE 0)
(GOTO -10)
(LOAD 1)
(RETURN))))
(MAKE-STATE 14 (LIST 0 (G (+ -1 N) (* N A)))
(PUSH (G (+ -1 N) (* N A)) STK)
'((PUSH 1)
(STORE 1)
(LOAD 0)
(IFLE 10)
(LOAD 0)
(LOAD 1)
(MUL)
(STORE 1)
(LOAD 0)
(PUSH 1)
(SUB)
(STORE 0)
(GOTO -10)
(LOAD 1)
(RETURN))))
(NATP N)
(NATP A))
(EQUAL (RUN (G-SCHED-LOOP N)
(MAKE-STATE 2 (LIST N A)
STK
'((PUSH 1)
(STORE 1)
(LOAD 0)
(IFLE 10)
(LOAD 0)
(LOAD 1)
(MUL)
(STORE 1)
(LOAD 0)
(PUSH 1)
(SUB)
(STORE 0)
(GOTO -10)
(LOAD 1)
(RETURN))))
(MAKE-STATE 14 (LIST 0 (G N A))
(PUSH (G N A) STK)
'((PUSH 1)
(STORE 1)
(LOAD 0)
(IFLE 10)
(LOAD 0)
(LOAD 1)
(MUL)
(STORE 1)
(LOAD 0)
(PUSH 1)
(SUB)
(STORE 0)
(GOTO -10)
(LOAD 1)
(RETURN))))).
But simplification reduces this to T, using the :compound-recognizer
rules ACL2::NATP-COMPOUND-RECOGNIZER and ACL2::ZP-COMPOUND-RECOGNIZER,
the :definitions BINARY-APPEND, DO-INST, EXECUTE-GOTO, EXECUTE-IFLE,
EXECUTE-LOAD, EXECUTE-MUL, EXECUTE-PUSH, EXECUTE-STORE, EXECUTE-SUB,
G, G-SCHED-LOOP, NEXT-INST and UPDATE-NTH, the :executable-counterparts
of ARG1, BINARY-+, CAR, CDR, CONSP, EQUAL, NTH, OPCODE, REPEAT, UNARY--
and ZP, primitive type reasoning and the :rewrite rules CAR-CONS, CDR-CONS,
COMMUTATIVITY-OF-*, COMMUTATIVITY-OF-+, NTH-0-CONS, NTH-ADD1!, RUN-OPENER,
STACKS, STATES, STEP-OPENER and UPDATE-NTH-ADD1!.
Subgoal *1/3
(IMPLIES (AND (NOT (ZP N))
(NOT (NATP (* N A)))
(NATP N)
(NATP A))
(EQUAL (RUN (G-SCHED-LOOP N)
(MAKE-STATE 2 (LIST N A)
STK
'((PUSH 1)
(STORE 1)
(LOAD 0)
(IFLE 10)
(LOAD 0)
(LOAD 1)
(MUL)
(STORE 1)
(LOAD 0)
(PUSH 1)
(SUB)
(STORE 0)
(GOTO -10)
(LOAD 1)
(RETURN))))
(MAKE-STATE 14 (LIST 0 (G N A))
(PUSH (G N A) STK)
'((PUSH 1)
(STORE 1)
(LOAD 0)
(IFLE 10)
(LOAD 0)
(LOAD 1)
(MUL)
(STORE 1)
(LOAD 0)
(PUSH 1)
(SUB)
(STORE 0)
(GOTO -10)
(LOAD 1)
(RETURN))))).
But we reduce the conjecture to T, by the :compound-recognizer rules
ACL2::NATP-COMPOUND-RECOGNIZER and ACL2::ZP-COMPOUND-RECOGNIZER and
primitive type reasoning.
Subgoal *1/2
(IMPLIES (AND (NOT (ZP N))
(NOT (NATP (+ -1 N)))
(NATP N)
(NATP A))
(EQUAL (RUN (G-SCHED-LOOP N)
(MAKE-STATE 2 (LIST N A)
STK
'((PUSH 1)
(STORE 1)
(LOAD 0)
(IFLE 10)
(LOAD 0)
(LOAD 1)
(MUL)
(STORE 1)
(LOAD 0)
(PUSH 1)
(SUB)
(STORE 0)
(GOTO -10)
(LOAD 1)
(RETURN))))
(MAKE-STATE 14 (LIST 0 (G N A))
(PUSH (G N A) STK)
'((PUSH 1)
(STORE 1)
(LOAD 0)
(IFLE 10)
(LOAD 0)
(LOAD 1)
(MUL)
(STORE 1)
(LOAD 0)
(PUSH 1)
(SUB)
(STORE 0)
(GOTO -10)
(LOAD 1)
(RETURN))))).
But we reduce the conjecture to T, by the :compound-recognizer rules
ACL2::NATP-COMPOUND-RECOGNIZER and ACL2::ZP-COMPOUND-RECOGNIZER and
primitive type reasoning.
Subgoal *1/1
(IMPLIES (AND (ZP N) (NATP N) (NATP A))
(EQUAL (RUN (G-SCHED-LOOP N)
(MAKE-STATE 2 (LIST N A)
STK
'((PUSH 1)
(STORE 1)
(LOAD 0)
(IFLE 10)
(LOAD 0)
(LOAD 1)
(MUL)
(STORE 1)
(LOAD 0)
(PUSH 1)
(SUB)
(STORE 0)
(GOTO -10)
(LOAD 1)
(RETURN))))
(MAKE-STATE 14 (LIST 0 (G N A))
(PUSH (G N A) STK)
'((PUSH 1)
(STORE 1)
(LOAD 0)
(IFLE 10)
(LOAD 0)
(LOAD 1)
(MUL)
(STORE 1)
(LOAD 0)
(PUSH 1)
(SUB)
(STORE 0)
(GOTO -10)
(LOAD 1)
(RETURN))))).
This simplifies, using the :compound-recognizer rules
ACL2::NATP-COMPOUND-RECOGNIZER and ACL2::ZP-COMPOUND-RECOGNIZER, the
:executable-counterparts of G-SCHED-LOOP, NATP, NOT and ZP, equality
generation from inequalities and the :forward-chaining rule ACL2::NATP-FC-1,
to
Subgoal *1/1'
(IMPLIES (NATP A)
(EQUAL (RUN '(0 0 0 0)
(MAKE-STATE 2 (LIST 0 A)
STK
'((PUSH 1)
(STORE 1)
(LOAD 0)
(IFLE 10)
(LOAD 0)
(LOAD 1)
(MUL)
(STORE 1)
(LOAD 0)
(PUSH 1)
(SUB)
(STORE 0)
(GOTO -10)
(LOAD 1)
(RETURN))))
(MAKE-STATE 14 (LIST 0 (G 0 A))
(PUSH (G 0 A) STK)
'((PUSH 1)
(STORE 1)
(LOAD 0)
(IFLE 10)
(LOAD 0)
(LOAD 1)
(MUL)
(STORE 1)
(LOAD 0)
(PUSH 1)
(SUB)
(STORE 0)
(GOTO -10)
(LOAD 1)
(RETURN))))).
By the simple :rewrite rule RUN-OPENER we reduce the conjecture to
Subgoal *1/1''
(IMPLIES (NATP A)
(EQUAL (STEP (STEP (STEP (STEP (MAKE-STATE 2 (LIST 0 A)
STK
'((PUSH 1)
(STORE 1)
(LOAD 0)
(IFLE 10)
(LOAD 0)
(LOAD 1)
(MUL)
(STORE 1)
(LOAD 0)
(PUSH 1)
(SUB)
(STORE 0)
(GOTO -10)
(LOAD 1)
(RETURN)))))))
(MAKE-STATE 14 (LIST 0 (G 0 A))
(PUSH (G 0 A) STK)
'((PUSH 1)
(STORE 1)
(LOAD 0)
(IFLE 10)
(LOAD 0)
(LOAD 1)
(MUL)
(STORE 1)
(LOAD 0)
(PUSH 1)
(SUB)
(STORE 0)
(GOTO -10)
(LOAD 1)
(RETURN))))).
But simplification reduces this to T, using the :compound-recognizer
rule ACL2::NATP-COMPOUND-RECOGNIZER, the :definitions DO-INST, EXECUTE-IFLE,
EXECUTE-LOAD, G and NEXT-INST, the :executable-counterparts of <, ARG1,
BINARY-+, CONSP, EQUAL, NTH, OPCODE and ZP, primitive type reasoning
and the :rewrite rules CDR-CONS, NTH-0-CONS, NTH-ADD1!, STACKS, STATES
and STEP-OPENER.
That completes the proof of *1.
Q.E.D.
Summary
Form: ( DEFTHM STEP-1-[LOOP] ...)
Rules: ((:COMPOUND-RECOGNIZER ACL2::NATP-COMPOUND-RECOGNIZER)
(:COMPOUND-RECOGNIZER ACL2::ZP-COMPOUND-RECOGNIZER)
(:DEFINITION BINARY-APPEND)
(:DEFINITION DO-INST)
(:DEFINITION EXECUTE-GOTO)
(:DEFINITION EXECUTE-IFLE)
(:DEFINITION EXECUTE-LOAD)
(:DEFINITION EXECUTE-MUL)
(:DEFINITION EXECUTE-PUSH)
(:DEFINITION EXECUTE-STORE)
(:DEFINITION EXECUTE-SUB)
(:DEFINITION G)
(:DEFINITION G-SCHED-LOOP)
(:DEFINITION NEXT-INST)
(:DEFINITION NOT)
(:DEFINITION UPDATE-NTH)
(:EXECUTABLE-COUNTERPART <)
(:EXECUTABLE-COUNTERPART ARG1)
(:EXECUTABLE-COUNTERPART BINARY-+)
(:EXECUTABLE-COUNTERPART CAR)
(:EXECUTABLE-COUNTERPART CDR)
(:EXECUTABLE-COUNTERPART CONSP)
(:EXECUTABLE-COUNTERPART EQUAL)
(:EXECUTABLE-COUNTERPART G-SCHED-LOOP)
(:EXECUTABLE-COUNTERPART NATP)
(:EXECUTABLE-COUNTERPART NOT)
(:EXECUTABLE-COUNTERPART NTH)
(:EXECUTABLE-COUNTERPART OPCODE)
(:EXECUTABLE-COUNTERPART REPEAT)
(:EXECUTABLE-COUNTERPART UNARY--)
(:EXECUTABLE-COUNTERPART ZP)
(:FAKE-RUNE-FOR-LINEAR-EQUALITIES NIL)
(:FAKE-RUNE-FOR-TYPE-SET NIL)
(:FORWARD-CHAINING ACL2::NATP-FC-1)
(:INDUCTION G)
(:INDUCTION G-SCHED-LOOP)
(:REWRITE CAR-CONS)
(:REWRITE CDR-CONS)
(:REWRITE COMMUTATIVITY-OF-*)
(:REWRITE COMMUTATIVITY-OF-+)
(:REWRITE NTH-0-CONS)
(:REWRITE NTH-ADD1!)
(:REWRITE RUN-OPENER)
(:REWRITE STACKS)
(:REWRITE STATES)
(:REWRITE STEP-OPENER)
(:REWRITE UPDATE-NTH-ADD1!))
STEP-1-[LOOP]
M1 >>'(END OF DEMO 3)
(END OF DEMO 3)
M1 >>(DEFTHM STEP-1
(IMPLIES (NATP N)
(EQUAL (RUN (G-SCHED N)
(MAKE-STATE 0 (LIST N A) STK *G*))
(MAKE-STATE 14 (LIST 0 (G N 1))
(PUSH (G N 1) STK)
*G*))))
ACL2 Warning [Non-rec] in ( DEFTHM STEP-1 ...): A :REWRITE rule generated
from STEP-1 will be triggered only by terms containing the function
symbol G-SCHED, which has a non-recursive definition. Unless this
definition is disabled, this rule is unlikely ever to be used.
By the simple :definition G-SCHED, the :executable-counterpart of REPEAT
and the simple :rewrite rules RUN-APPEND and RUN-OPENER we reduce the
conjecture to
Goal'
(IMPLIES (NATP N)
(EQUAL (RUN (G-SCHED-LOOP N)
(STEP (STEP (MAKE-STATE 0 (LIST N A)
STK
'((PUSH 1)
(STORE 1)
(LOAD 0)
(IFLE 10)
(LOAD 0)
(LOAD 1)
(MUL)
(STORE 1)
(LOAD 0)
(PUSH 1)
(SUB)
(STORE 0)
(GOTO -10)
(LOAD 1)
(RETURN))))))
(MAKE-STATE 14 (LIST 0 (G N 1))
(PUSH (G N 1) STK)
'((PUSH 1)
(STORE 1)
(LOAD 0)
(IFLE 10)
(LOAD 0)
(LOAD 1)
(MUL)
(STORE 1)
(LOAD 0)
(PUSH 1)
(SUB)
(STORE 0)
(GOTO -10)
(LOAD 1)
(RETURN))))).
But simplification reduces this to T, using the :compound-recognizer
rule ACL2::NATP-COMPOUND-RECOGNIZER, the :definitions DO-INST, EXECUTE-PUSH,
EXECUTE-STORE, NEXT-INST and UPDATE-NTH, the :executable-counterparts
of ARG1, BINARY-+, CONS, CONSP, EQUAL, NTH, OPCODE and ZP, primitive
type reasoning and the :rewrite rules CAR-CONS, CDR-CONS, STACKS, STATES,
STEP-1-[LOOP], STEP-OPENER and UPDATE-NTH-ADD1!.
Q.E.D.
Summary
Form: ( DEFTHM STEP-1 ...)
Rules: ((:COMPOUND-RECOGNIZER ACL2::NATP-COMPOUND-RECOGNIZER)
(:DEFINITION DO-INST)
(:DEFINITION EXECUTE-PUSH)
(:DEFINITION EXECUTE-STORE)
(:DEFINITION G-SCHED)
(:DEFINITION NEXT-INST)
(:DEFINITION UPDATE-NTH)
(:EXECUTABLE-COUNTERPART ARG1)
(:EXECUTABLE-COUNTERPART BINARY-+)
(:EXECUTABLE-COUNTERPART CONS)
(:EXECUTABLE-COUNTERPART CONSP)
(:EXECUTABLE-COUNTERPART EQUAL)
(:EXECUTABLE-COUNTERPART NTH)
(:EXECUTABLE-COUNTERPART OPCODE)
(:EXECUTABLE-COUNTERPART REPEAT)
(:EXECUTABLE-COUNTERPART ZP)
(:FAKE-RUNE-FOR-TYPE-SET NIL)
(:REWRITE CAR-CONS)
(:REWRITE CDR-CONS)
(:REWRITE RUN-APPEND)
(:REWRITE RUN-OPENER)
(:REWRITE STACKS)
(:REWRITE STATES)
(:REWRITE STEP-1-[LOOP])
(:REWRITE STEP-OPENER)
(:REWRITE UPDATE-NTH-ADD1!))
Warnings: Non-rec
STEP-1
M1 >>(IN-THEORY (DISABLE G-SCHED))
Summary
Form: ( IN-THEORY (DISABLE ...))
Rules: NIL
:CURRENT-THEORY-UPDATED
M1 >>'(END OF DEMO 4)
(END OF DEMO 4)
M1 >>(DEFTHM STEP-2
(IMPLIES (NATP A)
(EQUAL (G N A) (* A (F N)))))
Name the formula above *1.
Perhaps we can prove *1 by induction. Two induction schemes are suggested
by this conjecture. Subsumption reduces that number to one.
We will induct according to a scheme suggested by (G N A).
This suggestion was produced using the :induction rules F and G. If
we let (:P A N) denote *1 above then the induction scheme we'll use
is
(AND (IMPLIES (AND (NOT (ZP N)) (:P (* N A) (+ -1 N)))
(:P A N))
(IMPLIES (ZP N) (:P A N))).
This induction is justified by the same argument used to admit G.
Note, however, that the unmeasured variable A is being instantiated.
When applied to the goal at hand the above induction scheme produces
three nontautological subgoals.
Subgoal *1/3
(IMPLIES (AND (NOT (ZP N))
(EQUAL (G (+ -1 N) (* N A))
(* (* N A) (F (+ -1 N))))
(NATP A))
(EQUAL (G N A) (* A (F N)))).
By the simple :rewrite rule ASSOCIATIVITY-OF-* we reduce the conjecture
to
Subgoal *1/3'
(IMPLIES (AND (NOT (ZP N))
(EQUAL (G (+ -1 N) (* N A))
(* N A (F (+ -1 N))))
(NATP A))
(EQUAL (G N A) (* A (F N)))).
But simplification reduces this to T, using the :compound-recognizer
rule ACL2::ZP-COMPOUND-RECOGNIZER, the :definitions F and G, primitive
type reasoning and the :rewrite rule ACL2::COMMUTATIVITY-2-OF-*.
Subgoal *1/2
(IMPLIES (AND (NOT (ZP N))
(NOT (NATP (* N A)))
(NATP A))
(EQUAL (G N A) (* A (F N)))).
But we reduce the conjecture to T, by the :compound-recognizer rules
ACL2::NATP-COMPOUND-RECOGNIZER and ACL2::ZP-COMPOUND-RECOGNIZER and
primitive type reasoning.
Subgoal *1/1
(IMPLIES (AND (ZP N) (NATP A))
(EQUAL (G N A) (* A (F N)))).
But simplification reduces this to T, using the :compound-recognizer
rules ACL2::NATP-COMPOUND-RECOGNIZER and ACL2::ZP-COMPOUND-RECOGNIZER,
the :definitions F, FIX and G, primitive type reasoning and the :rewrite
rules COMMUTATIVITY-OF-* and UNICITY-OF-1.
That completes the proof of *1.
Q.E.D.
Summary
Form: ( DEFTHM STEP-2 ...)
Rules: ((:COMPOUND-RECOGNIZER ACL2::NATP-COMPOUND-RECOGNIZER)
(:COMPOUND-RECOGNIZER ACL2::ZP-COMPOUND-RECOGNIZER)
(:DEFINITION F)
(:DEFINITION FIX)
(:DEFINITION G)
(:DEFINITION NOT)
(:FAKE-RUNE-FOR-TYPE-SET NIL)
(:INDUCTION F)
(:INDUCTION G)
(:REWRITE ASSOCIATIVITY-OF-*)
(:REWRITE ACL2::COMMUTATIVITY-2-OF-*)
(:REWRITE COMMUTATIVITY-OF-*)
(:REWRITE UNICITY-OF-1))
STEP-2
M1 >>(DEFTHM MAIN
(IMPLIES (NATP N)
(EQUAL (RUN (G-SCHED N)
(MAKE-STATE 0 (LIST N A) STK *G*))
(MAKE-STATE 14 (LIST 0 (F N))
(PUSH (F N) STK)
*G*))))
ACL2 Warning [Subsume] in ( DEFTHM MAIN ...): A newly proposed :REWRITE
rule generated from MAIN probably subsumes the previously added :REWRITE
rule STEP-1, in the sense that the new rule will now probably be applied
whenever the old rule would have been.
ACL2 Warning [Subsume] in ( DEFTHM MAIN ...): The previously added
rule STEP-1 subsumes a newly proposed :REWRITE rule generated from
MAIN, in the sense that the old rule rewrites a more general target.
Because the new rule will be tried first, it may nonetheless find application.
But simplification reduces this to T, using the :compound-recognizer
rule ACL2::NATP-COMPOUND-RECOGNIZER, the :definition FIX, primitive
type reasoning, the :rewrite rules STEP-1, STEP-2 and UNICITY-OF-1
and the :type-prescription rule F.
Q.E.D.
Summary
Form: ( DEFTHM MAIN ...)
Rules: ((:COMPOUND-RECOGNIZER ACL2::NATP-COMPOUND-RECOGNIZER)
(:DEFINITION FIX)
(:FAKE-RUNE-FOR-TYPE-SET NIL)
(:REWRITE STEP-1)
(:REWRITE STEP-2)
(:REWRITE UNICITY-OF-1)
(:TYPE-PRESCRIPTION F))
Warnings: Subsume
MAIN
M1 >>(DEFTHM COROLLARY1
(LET ((S_FIN (RUN (G-SCHED N)
(MAKE-STATE 0 (LIST N A) STK *G*))))
(IMPLIES (NATP N)
(AND (EQUAL (TOP (STACK S_FIN)) (F N))
(HALTEDP S_FIN)))))
ACL2 Warning [Non-rec] in ( DEFTHM COROLLARY1 ...): A :REWRITE rule
generated from COROLLARY1 will be triggered only by terms containing
the function symbol HALTEDP, which has a non-recursive definition.
Unless this definition is disabled, this rule is unlikely ever to be
used.
By case analysis we reduce the conjecture to
Goal'
(IMPLIES (NATP N)
(AND (EQUAL (TOP (STACK (RUN (G-SCHED N)
(MAKE-STATE 0 (LIST N A)
STK
'((PUSH 1)
(STORE 1)
(LOAD 0)
(IFLE 10)
(LOAD 0)
(LOAD 1)
(MUL)
(STORE 1)
(LOAD 0)
(PUSH 1)
(SUB)
(STORE 0)
(GOTO -10)
(LOAD 1)
(RETURN))))))
(F N))
(HALTEDP (RUN (G-SCHED N)
(MAKE-STATE 0 (LIST N A)
STK
'((PUSH 1)
(STORE 1)
(LOAD 0)
(IFLE 10)
(LOAD 0)
(LOAD 1)
(MUL)
(STORE 1)
(LOAD 0)
(PUSH 1)
(SUB)
(STORE 0)
(GOTO -10)
(LOAD 1)
(RETURN))))))).
But simplification reduces this to T, using the :compound-recognizer
rule ACL2::NATP-COMPOUND-RECOGNIZER, the :definitions DO-INST, HALTEDP
and NEXT-INST, the :executable-counterparts of CONSP, EQUAL, NTH and
OPCODE, primitive type reasoning and the :rewrite rules MAIN, STACKS,
STATES and STEP-OPENER.
Q.E.D.
The storage of COROLLARY1 depends upon the :type-prescription rule
HALTEDP.
Summary
Form: ( DEFTHM COROLLARY1 ...)
Rules: ((:COMPOUND-RECOGNIZER ACL2::NATP-COMPOUND-RECOGNIZER)
(:DEFINITION DO-INST)
(:DEFINITION HALTEDP)
(:DEFINITION NEXT-INST)
(:EXECUTABLE-COUNTERPART CONSP)
(:EXECUTABLE-COUNTERPART EQUAL)
(:EXECUTABLE-COUNTERPART NTH)
(:EXECUTABLE-COUNTERPART OPCODE)
(:FAKE-RUNE-FOR-TYPE-SET NIL)
(:REWRITE MAIN)
(:REWRITE STACKS)
(:REWRITE STATES)
(:REWRITE STEP-OPENER)
(:TYPE-PRESCRIPTION HALTEDP))
Warnings: Non-rec
COROLLARY1
M1 >>(DEFTHM COROLLARY2
(LET ((S_FIN (RUN (G-SCHED N)
(MAKE-STATE 0 (LIST N A)
STK
(COMPILE '(N)
'((A = 1)
(WHILE (N > 0)
(A = (N * A))
(N = (N - 1)))
(RETURN A)))))))
(IMPLIES (NATP N)
(AND (EQUAL (TOP (STACK S_FIN)) (F N))
(HALTEDP S_FIN)))))
ACL2 Warning [Non-rec] in ( DEFTHM COROLLARY2 ...): A :REWRITE rule
generated from COROLLARY2 will be triggered only by terms containing
the function symbol COMPILE, which has a non-recursive definition.
Unless this definition is disabled, this rule is unlikely ever to be
used.
ACL2 Warning [Non-rec] in ( DEFTHM COROLLARY2 ...): A :REWRITE rule
generated from COROLLARY2 will be triggered only by terms containing
the function symbols HALTEDP and COMPILE, which have non-recursive
definitions. Unless these definitions are disabled, this rule is unlikely
ever to be used.
By the :executable-counterpart of COMPILE we reduce the conjecture
to
Goal'
(IMPLIES (NATP N)
(AND (EQUAL (TOP (STACK (RUN (G-SCHED N)
(MAKE-STATE 0 (LIST N A)
STK
'((PUSH 1)
(STORE 1)
(LOAD 0)
(IFLE 10)
(LOAD 0)
(LOAD 1)
(MUL)
(STORE 1)
(LOAD 0)
(PUSH 1)
(SUB)
(STORE 0)
(GOTO -10)
(LOAD 1)
(RETURN))))))
(F N))
(HALTEDP (RUN (G-SCHED N)
(MAKE-STATE 0 (LIST N A)
STK
'((PUSH 1)
(STORE 1)
(LOAD 0)
(IFLE 10)
(LOAD 0)
(LOAD 1)
(MUL)
(STORE 1)
(LOAD 0)
(PUSH 1)
(SUB)
(STORE 0)
(GOTO -10)
(LOAD 1)
(RETURN))))))).
But simplification reduces this to T, using the :compound-recognizer
rule ACL2::NATP-COMPOUND-RECOGNIZER, the :definitions DO-INST, HALTEDP
and NEXT-INST, the :executable-counterparts of CONSP, EQUAL, NTH and
OPCODE, primitive type reasoning and the :rewrite rules MAIN, STACKS,
STATES and STEP-OPENER.
Q.E.D.
The storage of COROLLARY2 depends upon the :type-prescription rule
HALTEDP.
Summary
Form: ( DEFTHM COROLLARY2 ...)
Rules: ((:COMPOUND-RECOGNIZER ACL2::NATP-COMPOUND-RECOGNIZER)
(:DEFINITION DO-INST)
(:DEFINITION HALTEDP)
(:DEFINITION NEXT-INST)
(:EXECUTABLE-COUNTERPART COMPILE)
(:EXECUTABLE-COUNTERPART CONSP)
(:EXECUTABLE-COUNTERPART EQUAL)
(:EXECUTABLE-COUNTERPART NTH)
(:EXECUTABLE-COUNTERPART OPCODE)
(:FAKE-RUNE-FOR-TYPE-SET NIL)
(:REWRITE MAIN)
(:REWRITE STACKS)
(:REWRITE STATES)
(:REWRITE STEP-OPENER)
(:TYPE-PRESCRIPTION HALTEDP))
Warnings: Non-rec
COROLLARY2
M1 >>'(END OF DEMO 5)
(END OF DEMO 5)
M1 >>'(THE END)
(THE END)
M1 >>Bye.
|