1
#|-*-Lisp-*-=================================================================|#
3
#| coi: Computational Object Inference |#
5
#|===========================================================================|#
1
; Computational Object Inference
2
; Copyright (C) 2005-2014 Kookamara LLC
7
; 11410 Windermere Meadows
8
; Austin, TX 78759, USA
9
; http://www.kookamara.com/
11
; License: (An MIT/X11-style license)
13
; Permission is hereby granted, free of charge, to any person obtaining a
14
; copy of this software and associated documentation files (the "Software"),
15
; to deal in the Software without restriction, including without limitation
16
; the rights to use, copy, modify, merge, publish, distribute, sublicense,
17
; and/or sell copies of the Software, and to permit persons to whom the
18
; Software is furnished to do so, subject to the following conditions:
20
; The above copyright notice and this permission notice shall be included in
21
; all copies or substantial portions of the Software.
23
; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28
; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29
; DEALINGS IN THE SOFTWARE.
8
33
;; What we want to do is export the primary theories here into
66
91
(set::union (cons-onto-all '0 (mem::domain-aux (car mem-tree) (+ -1 depth)))
67
92
(cons-onto-all '1 (mem::domain-aux (cdr mem-tree) (+ -1 depth)))))))
70
95
;this bits are in reverse order (least significant bit comes first in the list)
71
96
(defun convert-reversed-bit-list-to-integer (bit-list)
75
100
(* 2 (convert-reversed-bit-list-to-integer (cdr bit-list))))))
77
;; (defmacro def-set-processor (&key (processor-name 'unsupplied)
102
;; (defmacro def-set-processor (&key (processor-name 'unsupplied)
78
103
;; (element-processor 'unsupplied) ;can this be a term?
79
104
;; (predicate 'unsupplied))
80
105
;; `(defun ,processor-name (set) ;can this take more than one arg?
135
160
;;always return nats less than size? Not necessarily. There
136
161
;;may be nats less than 2^depth but greater than size. We
137
162
;;have to filter them out.
139
164
(SET::FILTER<not-NATP-LESS-THAN-SIZE> (set::rkeys record-part) size)
167
192
(local (include-book "data-structures/memories/memory-impl" :dir :system))
170
195
(defthm mem::_store-memory
171
196
(mem::_memory-p (mem::_store mem::addr mem::elem mem::mem))
172
197
:hints(("Goal" :in-theory (enable mem::_memory-p))))
174
199
(defthm mem::_store-memory-main
175
200
(equal (mem::memory-p (mem::_store mem::addr mem::elem mem::mem))
176
201
(mem::memory-p mem::mem)))
178
203
(defthm mem::_memtree-store-memtree-2
179
204
(mem::_memtree-p (mem::_memtree-store-nil mem::addr mem::mtree mem::depth) mem::depth)
201
226
:hints (("Goal" :in-theory (enable MEM::|_ADDRESS-P| EXPT-SPLIT))))
203
228
;what should we do with 0?
204
;we could also represent 0 with the bit-list nil, but consider (mem::domain (mem::store 0 4 (mem::new 4))) = '(0)
229
;we could also represent 0 with the bit-list nil, but consider (mem::domain (mem::store 0 4 (mem::new 4))) = '(0)
205
230
;len is the lenght of the bit list. we need it. consider whether 0 should be '(0) or '(0 0) of '(0 0 0), etc.
206
231
(defun convert-integer-to-reversed-bit-list (n len)
208
233
nil ;the empty bit list
210
235
(convert-integer-to-reversed-bit-list (floor n 2) (+ -1 len)))))
212
237
(defthm mod-by-2-cases
213
238
(implies (and (not (EQUAL 0 (MOD ADDR 2)))
217
242
:hints (("Goal" :cases ((integerp addr))
218
243
:in-theory (enable mod-by-2))))
461
486
MEM::|_MEMORY-FAST|
462
487
MEM::|_MEMORY-SIZE|
463
488
MEM::|_MEMORY-RECORD|
466
(SET::DOUBLE-CONTAINMENT
491
(SET::DOUBLE-CONTAINMENT-expensive
469
494
;show how s affects this...
471
496
;for typed records gotta unwrap the domain...
473
(in-theory (disable mem::domain)) ;move back
498
(in-theory (disable mem::domain)) ;move back
475
500
;bzo add to sets library
476
501
(defthm delete-of-insert-diff
560
585
;; (and (equal len (len (set::head x)))
561
586
;; (all-have-len len (set::tail x)))))
563
(defun len-equal (a len)
588
(defun len-equal (a len)
564
589
(declare (xargs :guard t))
565
590
(equal (len a) (rfix len)))
567
592
(set::quantify-predicate (len-equal a len))
680
705
(implies (and (not (natp a))
681
706
(force (set::all<bit-listp> bit-lists)))
682
707
(not (set::in a (convert-reversed-bit-lists-to-integers bit-lists))))
683
:hints (("Goal" :in-theory (enable SET::ALL<BIT-LISTP>
708
:hints (("Goal" :in-theory (enable SET::ALL<BIT-LISTP>
685
710
:do-not '(generalize eliminate-destructors))))
773
798
(SET::IN (CONVERT-REVERSED-BIT-LIST-TO-INTEGER a)
774
799
(CONVERT-REVERSED-BIT-LISTS-TO-INTEGERS x))))
775
:hints (("Goal" :in-theory (enable set::in
800
:hints (("Goal" :in-theory (enable set::in
777
802
:do-not '(generalize eliminate-destructors))))
871
896
(defthm all-bit-listp-of-domain-aux
872
897
(set::all<bit-listp> (mem::domain-aux tree depth))
873
898
:hints (("Goal" :in-theory (enable mem::domain-aux acl2::equal-booleans-reducton))))
874
;; LIST::EQUAL-OF-BOOLEANS-REWRITE
899
;; LIST::EQUAL-OF-BOOLEANS-REWRITE
876
901
(defthm setp-of-domain-aux
877
902
(set::setp (mem::domain-aux tree depth))
1158
1183
MEM::|_MEMORY-P|
1161
(in-theory (disable MEM::MEM-TREE-DOMAIN))
1186
(in-theory (disable MEM::MEM-TREE-DOMAIN))
1163
1188
(defthm mem-tree-domain-after-store
1164
1189
(implies (good-memoryp mem)
1165
1190
(equal (MEM::MEM-TREE-DOMAIN (CAAR (MEM::STORE A V MEM))
1166
(CADDR ;(MEM::STORE A V
1191
(CADDR ;(MEM::STORE A V
1244
1269
(defthm good-memoryp-of-clear
1245
1270
(implies (acl2::good-memoryp mem)
1246
1271
(acl2::good-memoryp (mem::clear addr mem)))
1247
:hints (("Goal" :in-theory (enable mem::clear))))
1272
:hints (("Goal" :in-theory (enable mem::clear))))
b'\\ No newline at end of file'