~ubuntu-branches/ubuntu/wily/acl2/wily

« back to all changes in this revision

Viewing changes to books/workshops/2009/verbeek-schmaltz/verbeek/generic-modules/GeNoC.lisp

  • Committer: Package Import Robot
  • Author(s): Camm Maguire
  • Date: 2015-01-16 10:35:45 UTC
  • mfrom: (3.3.26 sid)
  • Revision ID: package-import@ubuntu.com-20150116103545-prehe9thgo79o8w8
Tags: 7.0-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#|$ACL2s-Preamble$;
 
2
;; julien schmaltz
 
3
;; top level module of GeNoC
 
4
;; june 20th 2005
 
5
;; file: GeNoC.lisp
 
6
;;Amr helmy 
 
7
;;24st january 2008
 
8
;;Edited 3rd march 2008 to add the round robin
 
9
(begin-book);$ACL2s-Preamble$|#
 
10
 
 
11
(in-package "ACL2")
 
12
 
 
13
(include-book "GeNoC-scheduling")
 
14
(include-book "GeNoC-routing")
 
15
(include-book "GeNoC-departure")
 
16
(include-book "GeNoC-simulation")
 
17
(in-theory (disable mv-nth))
 
18
 
 
19
(defun genoc_t (m nodeset measure trlst accup time ntkstate order)
 
20
  ;; the composition of routing and scheduling is built by function genoc_t.
 
21
  ;; it takes as arguments:
 
22
  ;; - a list of missives, m
 
23
  ;; - the set of existing nodes, nodeset
 
24
  ;; - the measure provided by the scheduler
 
25
  ;; - an accumulator of arrived messages
 
26
  ;; - an accumulator of network states for simulation
 
27
  ;; - the time
 
28
  ;; - the state of the network
 
29
  ;; - an ordering
 
30
  ;; it returns:
 
31
  ;; - the arrived messages
 
32
  ;; - the en route messages
 
33
  ;; - the network state accumulator
 
34
  
 
35
  ;; the measure is set to the measure defined by the scheduler
 
36
  (declare (xargs :measure (acl2-count measure)))
 
37
  (if (endp m)
 
38
    ;; no more messages to send
 
39
    (mv trlst nil accup)
 
40
    ;; else
 
41
    (mv-let (delayed departing)
 
42
          ;; call R4D to determine which missives are ready for departure
 
43
          (readyfordeparture m nil nil time)
 
44
          ;; determine set of routes for all departing missives
 
45
          (let ((v (routing departing nodeset)))                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
 
46
            (cond ((not (legal-measure measure v nodeset ntkstate order))
 
47
                  ;; illegal measure supplied
 
48
                   (mv trlst m accup))
 
49
                  ;; check if it is possible to schedule
 
50
                  ((scheduling-assumptions v nodeset ntkstate order)
 
51
                   ;; schedule and recursivily call genoc_t
 
52
                   (mv-let (newtrlst arrived newmeasure newntkstate)
 
53
                           (scheduling v nodeset ntkstate order)
 
54
                           (genoc_t  (append newtrlst delayed)
 
55
                                     nodeset
 
56
                                     newmeasure
 
57
                                     (append arrived trlst) 
 
58
                                     (append accup (list (extract-simulation newntkstate)))
 
59
                                     (+ 1 time)
 
60
                                     newntkstate 
 
61
                                     (get_next_priority order))))
 
62
                  (t
 
63
                   ;; scheduler has instructed to terminate
 
64
                   (mv trlst m accup)))))))
 
65
 
 
66
 
 
67
 
 
68
;; correctness of genoc_t
 
69
;; ----------------------
 
70
(defun correctroutes-genoc_t (routes m-dest)
 
71
  ;; genoc_t is correct if every element ctr of the output list
 
72
  ;; is such that (a) frmv(ctr) = frmtm(m) and (b) forall r in 
 
73
  ;; routesv(ctr) last(r) = desttm(m). for the m such that
 
74
  ;; idm(m) = idv(ctr).
 
75
  ;; this function checks that (b) holds.
 
76
  (if (endp routes)
 
77
      t
 
78
    (let ((r (car routes)))
 
79
      (and (equal (car (last r)) m-dest)
 
80
           (correctroutes-genoc_t (cdr routes) m-dest)))))
 
81
 
 
82
(defun genoc_t-correctness1 (trlst m/trlst)
 
83
  ;; we complement the correctness of genoc_t
 
84
  (if (endp trlst)
 
85
      (if (endp m/trlst)
 
86
          t
 
87
        nil)
 
88
    (let* ((tr (car trlst))
 
89
           (v-frm (frmv tr))
 
90
           (routes (routesv tr))
 
91
           (m (car m/trlst))
 
92
           (m-frm (frmm m))
 
93
           (m-dest (destm m)))
 
94
      (and (equal v-frm m-frm)
 
95
           (correctroutes-genoc_t routes m-dest)
 
96
           (genoc_t-correctness1 (cdr trlst)  (cdr m/trlst))))))  
 
97
 
 
98
(defun genoc_t-correctness (trlst m)
 
99
  ;; before checking correctness we filter m
 
100
  ;; according to the ids of trlst
 
101
  (let ((m/trlst  (extract-sublst (tomissives m) (v-ids trlst))))
 
102
    (genoc_t-correctness1 trlst m/trlst)))
 
103
 
 
104
 
 
105
;; non tail definition of genoc_t
 
106
;; ------------------------------
 
107
(defun genoc_t-non-tail-comp (m nodeset measure time ntkstate order)
 
108
  (declare (xargs :measure (acl2-count measure)))
 
109
  ;; we define a non tail function that computes the 
 
110
  ;; first output of genoc_t, i.e the completed transactions
 
111
  (if (endp m)
 
112
    nil
 
113
    (mv-let (delayed departing)
 
114
            (readyfordeparture m nil nil time) 
 
115
            (let ((v (routing departing nodeset)))
 
116
              (cond ((not (legal-measure measure v nodeset ntkstate order))
 
117
                    nil)
 
118
                    ((scheduling-assumptions v nodeset ntkstate order)
 
119
                     (mv-let (newtrlst arrived newmeasure newntkstate)
 
120
                             (scheduling v nodeset ntkstate order)
 
121
                             (append (genoc_t-non-tail-comp (append newtrlst delayed)
 
122
                                                            nodeset
 
123
                                                            newmeasure
 
124
                                                            (+ time 1)
 
125
                                                            newntkstate
 
126
                                                            (get_next_priority order))
 
127
                                     arrived)))
 
128
                    (t nil))))))
 
129
 
 
130
;; we now prove that this function is right
 
131
 
 
132
(defthm true-listp-genoc_t-non-tail-comp     ;; ok
 
133
  (implies (true-listp m)
 
134
           (true-listp (genoc_t-non-tail-comp m nodeset measure  time ntkstate order)))
 
135
  :rule-classes :type-prescription)
 
136
 
 
137
(defthm genoc_t-non-tail-=-tail-comp      ;; ok
 
138
  (equal (mv-nth 0 (genoc_t m nodeset measure trlst accup time ntkstate order))
 
139
         (append (genoc_t-non-tail-comp m nodeset measure time ntkstate order)
 
140
                 trlst)))
 
141
 
 
142
 
 
143
;; proof of genoc_t correctness
 
144
;; ----------------------------
 
145
 
 
146
;; first we add a lemma that tells acl2 that 
 
147
;; converting the travels that are routed and delayed
 
148
;; produced a valid list of missives
 
149
(defthm tmissivesp-mv-nth-0-scheduling-routing      ;; ok
 
150
  (let ((nodeset (nodesetgenerator params)))
 
151
    (implies (and (tmissivesp m nodeset)
 
152
                  (validparamsp params))
 
153
             (tmissivesp (mv-nth 0  (scheduling (routing m nodeset)
 
154
                                                nodeset  ntkstate
 
155
                                                order)) nodeset )))
 
156
  :hints (("goal" 
 
157
           :use ((:instance  tmissivesp-mv-nth-0-scheduling 
 
158
                             (trlst  (routing m (nodesetgenerator params)))))
 
159
           :in-theory (disable trlstp tmissivesp))))
 
160
 
 
161
 
 
162
;; the next three theorems are to be moved in to the file GeNoC-misc
 
163
;; the recursive call of genoc_t-non-tail-comp calls append
 
164
;; we put the append at the top.
 
165
;; to do so we add the two rules below:
 
166
 
 
167
(defthm v-ids-append
 
168
  ;; the ids of an append is the append of the ids
 
169
  (equal (v-ids (append a b))
 
170
         (append (v-ids a) (v-ids b))))
 
171
 
 
172
(defthm tm-ids-append
 
173
  ;; the ids of an append is the append of the ids
 
174
  (equal (tm-ids (append a b))
 
175
         (append (tm-ids a) (tm-ids b))))
 
176
 
 
177
(defthm extract-sublst-append
 
178
  ;; filtering according to an append is the append 
 
179
  ;; of the filtering.
 
180
  (equal (extract-sublst m (append id1 id2))
 
181
         (append (extract-sublst m id1)
 
182
                 (extract-sublst m id2))))
 
183
 
 
184
 
 
185
;; then to split the proof is two cases, we replace the 
 
186
;; append by a conjunction. 
 
187
;; the rule below allows this decomposition:
 
188
 
 
189
(defthm correctroutess1-append
 
190
  (implies (and (equal (len a) (len c))
 
191
                (equal (len b) (len d)))
 
192
           (equal (genoc_t-correctness1 (append a b) 
 
193
                                        (append c d))
 
194
                  (and (genoc_t-correctness1 a c)
 
195
                       (genoc_t-correctness1 b d)))))
 
196
 
 
197
 
 
198
 
 
199
 
 
200
;; now we need to prove some lemmas so that previous rules
 
201
;; (from genoc-misc) about extract-sublst, tomissives, etc could
 
202
;; fire.
 
203
 
 
204
;next thoerem is to prove that the append of the result of the
 
205
;scheduling to a a list of tmissives will result in a tmissives list
 
206
 
 
207
(defthm sched-rout-missivesp-append
 
208
  (implies (and (validparamsp params) 
 
209
                (not-in (tm-ids x) (tm-ids y)) 
 
210
                (tmissivesp x (nodesetgenerator params)) 
 
211
                (tmissivesp y (nodesetgenerator params)))
 
212
           (tmissivesp 
 
213
            (append 
 
214
             (mv-nth 0 
 
215
                     (scheduling 
 
216
                      (routing x (nodesetgenerator params)) 
 
217
                      (nodesetgenerator params) ntkstate order)) y) 
 
218
            (nodesetgenerator params)))
 
219
  :hints (("goal" 
 
220
           :use ((:instance tmissivesp-append-tmissivesp 
 
221
                            (a (mv-nth 0 
 
222
                                       (scheduling 
 
223
                                        (routing x
 
224
                                                 (nodesetgenerator
 
225
                                                  params)) 
 
226
                                                  (nodesetgenerator
 
227
                                                   params) 
 
228
                                                  ntkstate order)))
 
229
                            (b y))
 
230
                 (:instance tmissivesp-newTrlst 
 
231
                            (trlst (routing x (nodesetgenerator params))))
 
232
                 (:instance trlstp-routing (m x))                      
 
233
                 (:instance subsetp-arrived-newtrlst-ids 
 
234
                            (trlst (routing x (nodesetgenerator params)))
 
235
                            (nodeset (nodesetgenerator params)))
 
236
                 (:instance ids-routing (m x))))))
 
237
 
 
238
(defthm v-ids-genoc_t-non-tail-comp      ;; ok
 
239
  ;; the ids of the output of genoc_t-non-tail-comp is a 
 
240
  ;; subset of those of m
 
241
  ;; for this theorem the rule ids-routing is useful
 
242
  (let ((nodeset (nodesetgenerator params)))
 
243
    (implies (and (tmissivesp m nodeset)
 
244
                  (validparamsp params))
 
245
             (let ((gnt 
 
246
                    (genoc_t-non-tail-comp m nodeset measure time ntkstate order)))
 
247
               (subsetp (v-ids gnt) (tm-ids m)))))
 
248
  :hints (("goal"
 
249
           :in-theory 
 
250
           (disable mv-nth tmissivesp trlstp))
 
251
          ("subgoal *1/4"
 
252
           :do-not '(eliminate-destructors generalize)
 
253
           :use ((:instance tmissivesp-append-tmissivesp 
 
254
                            (nodeset (nodesetgenerator params))
 
255
                            (b (mv-nth 0 (readyfordeparture m nil nil time))) 
 
256
                            (a (mv-nth 0 
 
257
                                       (scheduling 
 
258
                                        (routing 
 
259
                                         (mv-nth 
 
260
                                          1 
 
261
                                          (readyfordeparture m nil nil
 
262
                                                             time)) 
 
263
                                         (nodesetgenerator params)) 
 
264
                                         (nodesetgenerator params)
 
265
                                        ntkstate 
 
266
                                        order ))))
 
267
                 (:instance subsetp-arrived-newtrlst-ids
 
268
                            (trlst (routing (mv-nth 1
 
269
                                                    (readyfordeparture
 
270
                                                     m nil nil time) )
 
271
                                            (nodesetgenerator
 
272
                                             params)))
 
273
                            (nodeset (nodesetgenerator params)))
 
274
                 (:instance ids-routing (m (mv-nth 1
 
275
                                                   (readyfordeparture
 
276
                                                    m nil nil
 
277
                                                    time)))))
 
278
           :in-theory (disable mv-nth ids-routing
 
279
                               subsetp-arrived-newtrlst-ids
 
280
                               tmissivesp trlstp))
 
281
          ("subgoal *1/2"
 
282
           :in-theory (disable TM-IDS-APPEND GENOC_T-NON-TAIL-COMP TMISSIVESP)
 
283
           :use ((:instance ids-routing (m (mv-nth 1
 
284
                                                   (readyfordeparture
 
285
                                                    m nil nil time))))
 
286
                 (:instance tmissivesp-append-tmissivesp 
 
287
                            (nodeset (nodesetgenerator params))
 
288
                            (b (mv-nth 0 (readyfordeparture m nil nil time))) 
 
289
                            (a (mv-nth 0 (scheduling 
 
290
                                          (routing 
 
291
                                           (mv-nth
 
292
                                            1
 
293
                                            (readyfordeparture m nil
 
294
                                                               nil
 
295
                                                               time))
 
296
                                           (nodesetgenerator params)) 
 
297
                                           (nodesetgenerator params) 
 
298
                                          ntkstate order))))))
 
299
          ("subgoal *1/2''" :in-theory (enable TM-IDS-APPEND GENOC_T-NON-TAIL-COMP TMISSIVESP))))
 
300
 
 
301
 
 
302
(defthm not-in-v-ids-genoc_t-non-tail-comp      ;; ok
 
303
  ;; if the ids of a list have no common element with 
 
304
  ;; another ids then the output of genoc_t-non-tail-comp does
 
305
  ;; not introduce any new id
 
306
  (let ((nodeset (nodesetgenerator params)))
 
307
    (implies (and (not-in (tm-ids delayed) sched-ids)
 
308
                  (tmissivesp delayed nodeset)
 
309
                  (validparamsp params))
 
310
             (not-in (v-ids (genoc_t-non-tail-comp delayed nodeset measure
 
311
                                                   time ntkstate
 
312
                                                   order))
 
313
                     sched-ids)))
 
314
  :otf-flg t
 
315
  :hints (("goal"
 
316
           :do-not-induct t
 
317
           :in-theory (disable tmissivesp))))
 
318
 
 
319
(defthm v-ids-genoc_t-non-tail-comp-no-dup       ;; ok
 
320
  ;; the ids of the output of genoc_t-non-tail-comp have no dup
 
321
  (let ((nodeset (nodesetgenerator params)))
 
322
    (implies (and (tmissivesp m nodeset)
 
323
                  (validparamsp params))
 
324
             (let ((gnt (genoc_t-non-tail-comp m nodeset measure time
 
325
                                               ntkstate order)))
 
326
               (no-duplicatesp-equal (v-ids gnt)))))
 
327
  :otf-flg t
 
328
  :hints (("goal"
 
329
           :do-not '(eliminate-destructors generalize)
 
330
           :do-not-induct t
 
331
           :induct (genoc_t-non-tail-comp m (nodesetgenerator params)
 
332
                                          measure time ntkstate order)
 
333
           :in-theory (disable tmissivesp trlstp ))
 
334
          ("subgoal *1/3"
 
335
           :use ((:instance trlstp-routing 
 
336
                            (m (mv-nth 1 (readyfordeparture m nil nil time))))
 
337
                 (:instance not-in->not-insched
 
338
                            (x (v-ids 
 
339
                                (mv-nth 
 
340
                                 1 
 
341
                                 (scheduling
 
342
                                  (routing 
 
343
                                   (mv-nth 1 
 
344
                                           (readyfordeparture m nil
 
345
                                                              nil
 
346
                                                              time)) 
 
347
                                   (nodesetgenerator params))
 
348
                                  
 
349
                                  (nodesetgenerator params) ntkstate order))))
 
350
                            (y (tm-ids 
 
351
                                (mv-nth 1 (readyfordeparture m nil nil time))))
 
352
                            (z(tm-ids 
 
353
                               (mv-nth 0 (readyfordeparture m nil nil time)))))
 
354
                 (:instance not-in-2->not-in-append  
 
355
                            (x (tm-ids 
 
356
                                (mv-nth 0 
 
357
                                        (scheduling
 
358
                                         (routing 
 
359
                                          (mv-nth 
 
360
                                           1 (readyfordeparture m nil
 
361
                                                                nil
 
362
                                                                time))
 
363
                                          (nodesetgenerator params))
 
364
                                         
 
365
                                         (nodesetgenerator params)  
 
366
                                         ntkstate order))))
 
367
                            (y (tm-ids 
 
368
                                (mv-nth 0 (readyfordeparture m nil nil time))))
 
369
                            (z (v-ids 
 
370
                                (mv-nth 
 
371
                                 1 (scheduling
 
372
                                    (routing (mv-nth 
 
373
                                              1
 
374
                                              (readyfordeparture m nil
 
375
                                                                 nil
 
376
                                                                 time)) 
 
377
                                             (nodesetgenerator params))
 
378
                                     (nodesetgenerator params)  
 
379
                                    ntkstate order)))))
 
380
                 (:instance not-in-v-ids-genoc_t-non-tail-comp
 
381
                            (delayed  
 
382
                             (append 
 
383
                              (mv-nth 
 
384
                               0 
 
385
                               (scheduling
 
386
                                (routing (mv-nth 
 
387
                                          1
 
388
                                          (readyfordeparture m nil nil time)) 
 
389
                                         (nodesetgenerator params))
 
390
                                
 
391
                                 (nodesetgenerator params)
 
392
                                ntkstate order)) 
 
393
                              (mv-nth 0
 
394
                                      (readyfordeparture m nil nil time))))
 
395
                            
 
396
                            (measure 
 
397
                             (mv-nth 
 
398
                              2 
 
399
                              (scheduling 
 
400
                               (routing (mv-nth 
 
401
                                         1 
 
402
                                         (readyfordeparture m nil nil
 
403
                                                            time)) 
 
404
                                        (nodesetgenerator params))
 
405
                                (nodesetgenerator params)  ntkstate order)))
 
406
                            (sched-ids 
 
407
                             (v-ids 
 
408
                              (mv-nth 
 
409
                               1 
 
410
                               (scheduling 
 
411
                                (routing 
 
412
                                 (mv-nth 1 (readyfordeparture m nil
 
413
                                                              nil
 
414
                                                              time)) 
 
415
                                 (nodesetgenerator params))
 
416
                                 (nodesetgenerator params)ntkstate order))))
 
417
                            (time (+ 1 time))
 
418
                            (order (get_next_priority order))
 
419
                            (ntkstate 
 
420
                             (mv-nth 
 
421
                              3 
 
422
                              (scheduling 
 
423
                               (routing 
 
424
                                (mv-nth 
 
425
                                 1 (readyfordeparture m nil nil time))
 
426
                                (nodesetgenerator params)) 
 
427
                                (nodesetgenerator params) ntkstate order))))
 
428
                 (:instance not-in-1-0-ready-for-dept 
 
429
                            (nodeset (nodesetgenerator params)))
 
430
                 (:instance subsetp-arrived-newtrlst-ids
 
431
                            (trlst (routing (mv-nth 
 
432
                                             1 
 
433
                                             (readyfordeparture m nil
 
434
                                                                nil
 
435
                                                                time))
 
436
                                            (nodesetgenerator params)))
 
437
                            (nodeset (nodesetgenerator params)))
 
438
                 (:instance not-in-newtrlst-arrived
 
439
                            (trlst (routing (mv-nth 
 
440
                                             1 
 
441
                                             (readyfordeparture m nil
 
442
                                                                nil
 
443
                                                                time)) 
 
444
                                            (nodesetgenerator params)))
 
445
                            (nodeset (nodesetgenerator params)))
 
446
                 (:instance trlstp-arrived 
 
447
                            (trlst (routing (mv-nth 1
 
448
                                                    (readyfordeparture
 
449
                                                     m nil nil time)) 
 
450
                                            (nodesetgenerator params)))
 
451
                            (nodeset  (nodesetgenerator params))))
 
452
           :in-theory (e/d (trlstp) 
 
453
                           (trlstp-arrived mv-nth trlstp 
 
454
                                           not-in-v-ids-genoc_t-non-tail-comp 
 
455
                                           tmissivesp)))
 
456
          ("subgoal *1/2.3'" 
 
457
           :use ((:instance not-in-1-0-ready-for-dept-reverse 
 
458
                            (nodeset (nodesetgenerator params)))))))
 
459
 
 
460
;; move to GeNoC-misc
 
461
(defthm tmissivesp-extract-sublst       
 
462
  (let ((nodeset (nodesetgenerator params)))
 
463
    (implies (and (tmissivesp m nodeset)
 
464
                  (validparamsp params)
 
465
                  (true-listp ids)
 
466
                  (no-duplicatesp-equal ids)
 
467
                  (subsetp ids (tm-ids m)))
 
468
             (tmissivesp (extract-sublst m ids) nodeset)))
 
469
  :hints (("goal"
 
470
           :in-theory (disable tmissivesp))
 
471
          ("subgoal *1/1"
 
472
           :in-theory (enable tmissivesp))))
 
473
;; the following 7 theorems are intermediate lemmas to prove the
 
474
;; ultimate version 
 
475
;; Tomissives-delayed-ultimate which is that too-missives newtrlst is
 
476
;; equal to tomissive to extract-sublst from the initial M based upon
 
477
;; the newtrlst's ids
 
478
 
 
479
(defthm tomissives-delayed/rtg
 
480
  ;; we prove that the conversion of the delayed travels
 
481
  ;; into a list of missives is equal to the filtering 
 
482
  ;; of the initial list of missives m according to the ids
 
483
  ;; of the delayed travels.
 
484
  (let ((nodeset (nodesetgenerator params)))
 
485
    (mv-let (newtrlst/rtg arrived/rtg newmeasure newntkstate)
 
486
            (scheduling (routing m nodeset)  nodeset  ntkstate order)
 
487
            (declare (ignore arrived/rtg newmeasure newntkstate))
 
488
            (implies (and (tmissivesp m nodeset)
 
489
                          (validparamsp params))
 
490
                     (equal (tomissives newtrlst/rtg)
 
491
                            (extract-sublst (tomissives m) 
 
492
                                            (tm-ids newtrlst/rtg))))))
 
493
  :otf-flg t
 
494
  :hints (("goal"
 
495
           :do-not-induct t
 
496
           :do-not '(eliminate-destructors generalize fertilize)
 
497
           :use ((:instance totmissives-extract-sublst
 
498
                            (l (routing m (nodesetgenerator params)))
 
499
                            (ids (tm-ids 
 
500
                                  (mv-nth 
 
501
                                   0 (scheduling 
 
502
                                      (routing m (nodesetgenerator params))
 
503
                                       (nodesetgenerator params) 
 
504
                                      ntkstate order)))))
 
505
                 (:instance newtrlst-travel-correctness
 
506
                            (trlst (routing m (nodesetgenerator params)))
 
507
                            (nodeset (nodesetgenerator params)))
 
508
                 (:instance subsetp-arrived-newtrlst-ids
 
509
                            (trlst (routing m (nodesetgenerator params)))
 
510
                            (nodeset (nodesetgenerator params))))
 
511
           :in-theory (disable binary-append nth-with-large-index
 
512
                               extract-sublst tm-ids
 
513
                               member-equal-tm-ids-assoc-equal
 
514
                               tomissives m-ids assoc-equal trlstp
 
515
                               missivesp totmissives-extract-sublst 
 
516
                               len subsetp-arrived-newtrlst-ids))))
 
517
 
 
518
(defthm newtrlst-subsetp-ready-4-dept
 
519
  (let ((nodeset (nodesetgenerator params)))
 
520
    (mv-let (newtrlst/rtg arrived/rtg newmeasure newntkstate)
 
521
            (scheduling 
 
522
             (routing (mv-nth 1 
 
523
                              (readyfordeparture m nil nil time))
 
524
                      nodeset) 
 
525
              nodeset  ntkstate order)
 
526
            (declare (ignore arrived/rtg newmeasure newntkstate))
 
527
            (implies (and (tmissivesp m nodeset)
 
528
                          (validparamsp params))
 
529
                     (subsetp(tm-ids newtrlst/rtg)
 
530
                             (tm-ids (extract-sublst 
 
531
                                      m 
 
532
                                      (tm-ids 
 
533
                                       (mv-nth 
 
534
                                        1 
 
535
                                        (readyfordeparture m
 
536
                                                           nil
 
537
                                                           nil
 
538
                                                           time)))))))))
 
539
  :hints (("goal" 
 
540
           :in-theory (disable tm-orgs extract-sublst m-ids 
 
541
                               idm nfix m-ids
 
542
                               mv-nth-0-scheduling-on-zero-measure
 
543
                               id-not-eq-car-member-cdr-missives
 
544
                               assoc-equal
 
545
                               subset-ready-for-departure-3
 
546
                               not-in-1-0-ready-for-dept
 
547
                               NO-DUPLICATESP
 
548
                               checkroutes-subsetp-validroute
 
549
                               true-listp-mv-nth-1-sched-2
 
550
                               subset-ready-for-departure-2
 
551
                               true-listp-last last consp-last
 
552
                               subsetp-arrived-newtrlst-ids
 
553
                               len nth tmissivesp-extract-sublst
 
554
                               tmissivesp-extract trlstp-routing
 
555
                               true-listp
 
556
                               leq-position-equal-len
 
557
                               member-equal-m-ids-assoc-equal v-ids
 
558
                               nfix )
 
559
 
 
560
           :use ((:instance subsetp-arrived-newtrlst-ids
 
561
                            (trlst 
 
562
                             (routing (mv-nth 
 
563
                                       1 
 
564
                                       (readyfordeparture m nil nil
 
565
                                                          time))
 
566
                                      (nodesetgenerator params)))
 
567
                            (nodeset (nodesetgenerator params)))
 
568
                 (:instance trlstp-routing 
 
569
                            (m (mv-nth 1 (readyfordeparture m nil nil time))))
 
570
                 (:instance subset-ready-for-departure-3 
 
571
                            (nodeset (nodesetgenerator params)))
 
572
                 (:instance tmissivesp-ready-4-departure-mv-1 
 
573
                            (nodeset (nodesetgenerator params)))
 
574
                 (:instance subset-ready-for-departure-2 
 
575
                            (nodeset (nodesetgenerator params)))
 
576
                 (:instance tmissivesp-equal-subsetp 
 
577
                            (nodeset (nodesetgenerator params)) 
 
578
                            (x (mv-nth 1 (readyfordeparture m nil nil
 
579
                                                            time))) 
 
580
                            (y m))
 
581
                 (:instance tmissivesp-ready-4-departure-mv-1 
 
582
                            (nodeset (nodesetgenerator params)))))))
 
583
 
 
584
 
 
585
 
 
586
 
 
587
(defthm newtrlst-subsetp-M
 
588
  (let ((nodeset (nodesetgenerator params)))
 
589
    (mv-let (newtrlst/rtg arrived/rtg new newntkstate)
 
590
            (scheduling (routing (mv-nth 1 (readyfordeparture m nil nil time)) nodeset)  nodeset  ntkstate order)
 
591
            (declare (ignore arrived/rtg new newntkstate))
 
592
            (implies (and (tmissivesp m nodeset)
 
593
                          (validparamsp params))
 
594
                     (subsetp (tm-ids newtrlst/rtg) (tm-ids m)))))
 
595
  :hints (("goal" 
 
596
           :in-theory (disable extract-sublst
 
597
                               m-ids 
 
598
                               mv-nth-0-scheduling-on-zero-measure
 
599
                               assoc-equal
 
600
                               subset-ready-for-departure-3
 
601
                               not-in-1-0-ready-for-dept
 
602
                               checkroutes-subsetp-validroute
 
603
                               true-listp-mv-nth-1-sched-2
 
604
                               len nth tmissivesp-extract-sublst
 
605
                               tmissivesp-extract 
 
606
                               leq-position-equal-len
 
607
                               member-equal-m-ids-assoc-equal v-ids
 
608
                               nfix )
 
609
           :use 
 
610
           ((:instance tmissivesp-ready-4-departure-mv-1 
 
611
                       (nodeset (nodesetgenerator params)))
 
612
            (:instance subsetp-arrived-newtrlst-ids
 
613
                       (trlst (routing 
 
614
                               (mv-nth 
 
615
                                1 
 
616
                                (readyfordeparture m nil nil time)) 
 
617
                               (nodesetgenerator params)))
 
618
                       (nodeset (nodesetgenerator params)))
 
619
            (:instance trlstp-routing 
 
620
                       (m (mv-nth 1 (readyfordeparture
 
621
                                     m nil nil time)))) 
 
622
            (:instance subset-ready-for-departure-2 
 
623
                       (nodeset (nodesetgenerator params)))))))
 
624
 
 
625
(defthm taking-the-to-missives-out
 
626
  (let ((nodeset (nodesetgenerator params)))
 
627
    (mv-let (newtrlst/rtg arrived/rtg newmeasure newntkstate)
 
628
            (scheduling 
 
629
             (routing 
 
630
              (mv-nth 
 
631
               1 
 
632
               (readyfordeparture m nil nil time)) nodeset) 
 
633
               nodeset  ntkstate order)
 
634
            (declare (ignore arrived/rtg newmeasure newntkstate))
 
635
            (implies (and (tmissivesp m nodeset)
 
636
                          (validparamsp params))
 
637
                     (equal 
 
638
                      (extract-sublst 
 
639
                       (tomissives 
 
640
                        (extract-sublst 
 
641
                         m 
 
642
                         (tm-ids (mv-nth 
 
643
                                  1 
 
644
                                  (readyfordeparture m nil nil time)))))
 
645
                       (tm-ids newtrlst/rtg))
 
646
                      (tomissives 
 
647
                       (extract-sublst 
 
648
                        (extract-sublst 
 
649
                         m 
 
650
                         (tm-ids (mv-nth 1 (readyfordeparture m nil
 
651
                                                              nil
 
652
                                                              time))))
 
653
                        (tm-ids newtrlst/rtg)))))))
 
654
  :hints (("goal" 
 
655
           :in-theory (disable tmissivesp tomissives-extract-sublst) 
 
656
           :use 
 
657
           ((:instance tomissives-extract-sublst 
 
658
                       (nodeset (nodesetgenerator params))
 
659
                       (ids (tm-ids 
 
660
                             (mv-nth 
 
661
                              0 
 
662
                              (scheduling 
 
663
                               (routing 
 
664
                                (mv-nth 1 (readyfordeparture m nil nil time))
 
665
                                (nodesetgenerator params)) 
 
666
                                 (nodesetgenerator params) ntkstate order))))
 
667
                            (l (extract-sublst 
 
668
                                m (tm-ids 
 
669
                                   (mv-nth 
 
670
                                    1
 
671
                                    (readyfordeparture m nil nil time))))))
 
672
            (:instance subset-ready-for-departure-2 
 
673
                       (nodeset (nodesetgenerator params)))        
 
674
            (:instance subset-ready-for-departure-3 
 
675
                       (nodeset (nodesetgenerator params)))
 
676
            (:instance tmissivesp-extract 
 
677
                       (ids (tm-ids 
 
678
                             (mv-nth 1 (readyfordeparture m nil nil time)))) 
 
679
                       (nodeset (nodesetgenerator params)))                       
 
680
                 (:instance tmissivesp-ready-4-departure-mv-1 
 
681
                            (nodeset (nodesetgenerator params)))))
 
682
          ("subgoal 2" :in-theory (disable tmissivesp)
 
683
           :use 
 
684
           ((:instance tmissivesp-ready-4-departure-mv-1 
 
685
                       (nodeset (nodesetgenerator params)))
 
686
            (:instance subset-ready-for-departure-2 
 
687
                       (nodeset (nodesetgenerator params)))        
 
688
            (:instance subset-ready-for-departure-3 
 
689
                       (nodeset (nodesetgenerator params)))
 
690
            (:instance tmissivesp-extract 
 
691
                       (ids 
 
692
                        (tm-ids 
 
693
                         (mv-nth 1 (readyfordeparture m nil nil time)))) 
 
694
                            (nodeset (nodesetgenerator params)))))
 
695
          ("subgoal 3" 
 
696
           :use 
 
697
           ((:instance subsetp-arrived-newtrlst-ids
 
698
                       (trlst (routing 
 
699
                               (mv-nth 1 (readyfordeparture m nil nil
 
700
                                                            time)) 
 
701
                               (nodesetgenerator params)))
 
702
                       (nodeset (nodesetgenerator params))) 
 
703
            (:instance trlstp-routing 
 
704
                       (m (mv-nth 1 (readyfordeparture m nil nil time))))
 
705
            (:instance ids-routing  
 
706
                       (m (mv-nth 1 (readyfordeparture m nil nil time))))
 
707
            (:instance tmissivesp-ready-4-departure-mv-1 
 
708
                       (nodeset (nodesetgenerator params)))))))
 
709
 
 
710
(defthm tomissives-delayed-intermediate-2
 
711
  (let ((nodeset (nodesetgenerator params)))
 
712
    (mv-let (newtrlst/rtg arrived/rtg newmeasure newntkstate)
 
713
            (scheduling (routing (mv-nth 1 (readyfordeparture m nil
 
714
                                                              nil
 
715
                                                              time))
 
716
                                 nodeset)  nodeset  ntkstate order)
 
717
            (declare (ignore arrived/rtg newmeasure newntkstate))
 
718
            (implies (and (tmissivesp m nodeset)
 
719
                          (validparamsp params))
 
720
                     (equal (tomissives newtrlst/rtg)
 
721
                            (extract-sublst 
 
722
                             (tomissives
 
723
                              (extract-sublst 
 
724
                               m 
 
725
                               (tm-ids
 
726
                                (mv-nth 
 
727
                                 1 (readyfordeparture m nil nil time)))))
 
728
                             (tm-ids newtrlst/rtg))))))
 
729
  :hints (("goal" 
 
730
           :in-theory (disable TOMISSIVES LEN NTH-WITH-LARGE-INDEX TM-IDS 
 
731
                               nth assoc-equal MEMBER-EQUAL-TM-IDS-ASSOC-EQUAL 
 
732
                               MEMBER-EQUAL-M-IDS-ASSOC-EQUAL M-IDS)
 
733
           :use ((:instance tmissivesp-equal-subsetp 
 
734
                            (y m) 
 
735
                            (nodeset (nodesetgenerator params))
 
736
                            (x (mv-nth 1 (readyfordeparture m nil nil time))))
 
737
                 (:instance subset-ready-for-departure-3 
 
738
                            (nodeset (nodesetgenerator params)))
 
739
                 (:instance tmissivesp-ready-4-departure-mv-1 
 
740
                            (nodeset (nodesetgenerator params)))))))
 
741
 
 
742
(defthm tomissives-delayed-ultimate
 
743
  (let ((nodeset (nodesetgenerator params)))
 
744
    (mv-let (newtrlst/rtg arrived/rtg newmeasure newntkstate)
 
745
            (scheduling (routing (mv-nth 1 (readyfordeparture m nil
 
746
                                                              nil
 
747
                                                              time))
 
748
                                 nodeset)  nodeset  ntkstate order)
 
749
            (declare (ignore arrived/rtg newmeasure newntkstate))
 
750
            (implies (and (tmissivesp m nodeset)
 
751
                          (validparamsp params))
 
752
                     (equal (tomissives newtrlst/rtg)
 
753
                            (tomissives 
 
754
                             (extract-sublst m (tm-ids newtrlst/rtg)))))))
 
755
    :hints (("goal" 
 
756
             :use ((:instance subsetp-arrived-newtrlst-ids
 
757
                              (trlst 
 
758
                               (routing 
 
759
                                (mv-nth 1
 
760
                                        (readyfordeparture m nil nil
 
761
                                                           time)) 
 
762
                                (nodesetgenerator params)))
 
763
                              (nodeset (nodesetgenerator params)))
 
764
                   (:instance trlstp-routing 
 
765
                              (m (mv-nth 1 
 
766
                                         (readyfordeparture m nil nil time))))
 
767
                   (:instance extract-sublst-cancel-tm 
 
768
                              (id1 (tm-ids 
 
769
                                    (mv-nth 
 
770
                                     1 (readyfordeparture m nil nil time))))
 
771
                              (id2 (tm-ids newtrlst/rtg)))
 
772
                   (:instance tmissivesp-ready-4-departure-mv-1 
 
773
                              (nodeset (nodesetgenerator params)))))))          
 
774
 
 
775
(defthm tomissives-delayed-ultimate-bis
 
776
  (let ((nodeset (nodesetgenerator params)))
 
777
    (mv-let (newtrlst/rtg arrived/rtg newmeasure newntkstate)
 
778
            (scheduling (routing (mv-nth 1 (readyfordeparture m nil
 
779
                                                              nil
 
780
                                                              time))
 
781
                                 nodeset)  nodeset  ntkstate order)
 
782
            (declare (ignore arrived/rtg newmeasure newntkstate))
 
783
            (implies (and (tmissivesp m nodeset)
 
784
                          (validparamsp params))
 
785
                     (equal (tomissives newtrlst/rtg)
 
786
                            (extract-sublst (tomissives  m )
 
787
                                            (tm-ids newtrlst/rtg))))))
 
788
  :hints (("goal" 
 
789
           :in-theory (disable subset-ready-for-departure-2
 
790
                               idm tm-curs
 
791
                               tm-orgs id-not-eq-car-member-cdr
 
792
                               leq-position-equal-len default-car
 
793
                               mv-nth-0-scheduling-on-zero-measure
 
794
                               nth-with-large-index tmissivesp
 
795
                               true-listp-mv-nth-1-sched-2
 
796
                               validfield-route m-ids nfix
 
797
                               default-cdr
 
798
                               tomissives-extract-sublst
 
799
                               id-not-eq-car-member-cdr-missives m-ids
 
800
                               member-equal-tm-ids-assoc-equal
 
801
                               len tomissives-delayed-ultimate len
 
802
                               assoc-equal member-equal-m-ids-assoc-equal)
 
803
           :use 
 
804
           ((:instance subsetp-arrived-newtrlst-ids
 
805
                       (trlst 
 
806
                        (routing 
 
807
                         (mv-nth 1 (readyfordeparture m nil nil time)) 
 
808
                         (nodesetgenerator params)))
 
809
                       (nodeset (nodesetgenerator params)))
 
810
            (:instance subset-ready-for-departure-2 
 
811
                       (nodeset (nodesetgenerator params)))        
 
812
            (:instance trlstp-routing 
 
813
                       (m (mv-nth 1 (readyfordeparture m nil nil time))))
 
814
            (:instance tomissives-extract-sublst 
 
815
                       (nodeset (nodesetgenerator params))
 
816
                       (l m)
 
817
                       (ids(tm-ids 
 
818
                            (mv-nth 
 
819
                             0 
 
820
                             (scheduling 
 
821
                              (routing 
 
822
                               (mv-nth 
 
823
                                1 (readyfordeparture m nil nil time))
 
824
                               (nodesetgenerator params)) 
 
825
                               (nodesetgenerator params) ntkstate order)))))
 
826
            (:instance tmissivesp-ready-4-departure-mv-1 
 
827
                       (nodeset (nodesetgenerator params)))))))
 
828
 
 
829
(defthm v-ids_g_nt_sigma_subsetp-v-ids-newtrlst/rtg    ;; ok
 
830
  ;; this lemma is used in the subsequent proofs
 
831
  ;; it makes a fact "explicit"
 
832
  (let ((nodeset (nodesetgenerator params)))
 
833
    (mv-let (newtrlst arrived newmeasure newntkstate)
 
834
            (scheduling (routing m nodeset)  nodeset  ntkstate order)
 
835
            (declare (ignore arrived newntkstate))
 
836
            (implies (and (tmissivesp m nodeset)
 
837
                          (validparamsp params))
 
838
                     (subsetp 
 
839
                      (v-ids 
 
840
                       (genoc_t-non-tail-comp 
 
841
                        (extract-sublst m (tm-ids newtrlst))
 
842
                        nodeset newmeasure time ntkstate order))
 
843
                      (tm-ids newtrlst)))))
 
844
  :otf-flg t
 
845
  :hints (("goal"
 
846
           :do-not-induct t
 
847
           :use ((:instance subsetp-arrived-newtrlst-ids
 
848
                            (trlst (routing m (nodesetgenerator params)))
 
849
                            (nodeset (nodesetgenerator params)))
 
850
                 (:instance tmissivesp-newTrlst
 
851
                            (trlst (routing m (nodesetgenerator params)))
 
852
                            (nodeset (nodesetgenerator params)))
 
853
                 (:instance tmissivesp-extract-sublst   
 
854
                            (ids (tm-ids (mv-nth 
 
855
                                          0 
 
856
                                          (scheduling
 
857
                                           (routing m
 
858
                                                    (nodesetgenerator params))
 
859
                                           
 
860
                                            (nodesetgenerator
 
861
                                                params)  
 
862
                                           ntkstate order)))))
 
863
                 (:instance  fwd-tmissivesp 
 
864
                             (nodeset (nodesetgenerator params)))
 
865
                 ;; the following is required because in the conclusion of the 
 
866
                 ;; rule there is  call to extract-sublst
 
867
                 (:instance v-ids-genoc_t-non-tail-comp
 
868
                            (m 
 
869
                             (extract-sublst 
 
870
                              m 
 
871
                              (tm-ids 
 
872
                               (mv-nth 
 
873
                                0 
 
874
                                (scheduling 
 
875
                                 (routing m (nodesetgenerator params))
 
876
                                  (nodesetgenerator params)  
 
877
                                 ntkstate order)))))
 
878
                            (measure (mv-nth 
 
879
                                  2 
 
880
                                  (scheduling 
 
881
                                   (routing m (nodesetgenerator params))
 
882
                                    (nodesetgenerator params) 
 
883
                                   ntkstate order)))))
 
884
           :in-theory (disable subsetp-arrived-newtrlst-ids
 
885
                               mv-nth-0-scheduling-on-zero-measure
 
886
                               binary-append len tmissivesp-newtrlst
 
887
                               v-ids-genoc_t-non-tail-comp tm-ids nfix
 
888
                               trlstp tmissivesp))))
 
889
 
 
890
;; arrived/rtg does not modify frames
 
891
;; ---------------------------------------
 
892
 
 
893
(defthm s/d-travel-v-frms
 
894
  (implies (and (trlstp sd-trlst nodeset)
 
895
                (s/d-travel-correctness sd-trlst trlst/sd-ids))
 
896
           (equal (v-frms sd-trlst) (v-frms trlst/sd-ids))))
 
897
 
 
898
(defthm arrived-v-frms-m-frms        ;; ok
 
899
  ;; we prove that the frames of the scheduled travels
 
900
  ;; are equal to the frames of the conversion of the initial list of travels
 
901
  ;; filtered according to the ids of the scheduled travels
 
902
  (mv-let (newtrlst arrived newmeasure newntkstate)
 
903
          (scheduling trlst  nodeset  ntkstate order)
 
904
          (declare (ignore newtrlst newmeasure newntkstate))
 
905
          (implies (and (trlstp trlst nodeset) 
 
906
                        (validparamsp params))
 
907
                   (equal  (v-frms arrived)
 
908
                           (tm-frms 
 
909
                            (totmissives 
 
910
                             (extract-sublst trlst (v-ids arrived)))))))
 
911
  :hints (("goal"
 
912
           :use ((:instance tm-frms-to-v-frms 
 
913
                            (x (extract-sublst 
 
914
                                trlst 
 
915
                                (v-ids (mv-nth 
 
916
                                        1 (scheduling trlst 
 
917
                                                      nodeset ntkstate
 
918
                                                      order))))))
 
919
                 (:instance s/d-travel-v-frms       
 
920
                            (sd-trlst  (mv-nth 1 (scheduling trlst 
 
921
                                                             nodeset
 
922
                                                             ntkstate
 
923
                                                             order)))
 
924
                            (trlst/sd-ids (extract-sublst 
 
925
                                           trlst 
 
926
                                           (v-ids
 
927
                                            (mv-nth 
 
928
                                             1
 
929
                                             (scheduling trlst
 
930
                                                         
 
931
                                                         nodeset  
 
932
                                                         ntkstate order))))))
 
933
                 
 
934
                 (:instance arrived-travels-correctness))
 
935
           :in-theory (disable trlstp s/d-travel-v-frms mv-nth))))
 
936
 
 
937
 
 
938
(defthm arrived/rtg_not_modify_frames        ;; ok
 
939
  ;; we prove the the frames of the arrived travels produced
 
940
  ;; by scheduling and routing are equal to the frames 
 
941
  ;; of the initial list of missives
 
942
  (let ((nodeset (nodesetgenerator params)))
 
943
    (mv-let (newtrlst arrived newmeasure newntkstate)
 
944
            (scheduling (routing m nodeset)  nodeset ntkstate order)
 
945
            (declare (ignore newtrlst newmeasure newntkstate))
 
946
            (implies (and (tmissivesp m nodeset)
 
947
                          (validparamsp params))
 
948
                     (equal (v-frms arrived)
 
949
                            (tm-frms 
 
950
                             (extract-sublst 
 
951
                              m (v-ids arrived)))))))
 
952
  :hints (("goal"
 
953
           :do-not-induct t
 
954
           :do-not '(eliminate-destructors generalize )
 
955
           :use ((:instance arrived-v-frms-m-frms
 
956
                            (trlst (routing m (nodesetgenerator params)))
 
957
                            (nodeset (nodesetgenerator params)))
 
958
                 (:instance subsetp-arrived-newtrlst-ids
 
959
                            (trlst (routing m (nodesetgenerator params)))
 
960
                            (nodeset (nodesetgenerator params))))
 
961
           :in-theory (disable trlstp tmissivesp 
 
962
                               subsetp-arrived-newtrlst-ids
 
963
                               arrived-v-frms-m-frms))
 
964
          ("subgoal 1" 
 
965
           :use ((:instance totmissives-extract-sublst
 
966
                            (l (routing m (nodesetgenerator params))) 
 
967
                            (ids (v-ids 
 
968
                                  (mv-nth 
 
969
                                   1 
 
970
                                   (scheduling 
 
971
                                    (routing m (nodesetgenerator params))
 
972
                                     (nodesetgenerator params) 
 
973
                                    ntkstate order))))
 
974
                            (nodeset (nodesetgenerator params))))
 
975
           :in-theory (disable trlstp tmissivesp 
 
976
                               subsetp-arrived-newtrlst-ids
 
977
                               arrived-v-frms-m-frms ids-routing))))
 
978
 
 
979
 
 
980
(defthm correctroutesp-vm-frms-gc1         ;; ok
 
981
  ;; the correctness of routes and equality of frames imply
 
982
  ;; the main predicate (correctness of genoc_t-non-tail-comp)
 
983
  (implies (and (correctroutesp l (extract-sublst m (v-ids l))
 
984
                                nodeset)
 
985
                (equal (v-frms l)
 
986
                       (tm-frms (extract-sublst m (v-ids l)))))
 
987
           (genoc_t-correctness1 l 
 
988
                                 (tomissives (extract-sublst m (v-ids l)))))
 
989
  
 
990
  :hints (("Goal" :in-theory (disable len nfix assoc-equal
 
991
                                      member-equal-tm-ids-assoc-equal
 
992
                                      member-equal-m-ids-assoc-equal
 
993
                                      true-listp-member-equal))))
 
994
 
 
995
 
 
996
(defthm gc1_arrived/rtg          ;; ok
 
997
  ;; we prove the correctness of the arrived travels
 
998
  (let ((nodeset (nodesetgenerator params)))
 
999
    (implies (and (tmissivesp m nodeset)
 
1000
                  (validparamsp params))
 
1001
             (mv-let (newtrlst arrived newmeasure newntkstate)
 
1002
                     (scheduling (routing m nodeset)  nodeset
 
1003
                                 ntkstate order) 
 
1004
                     (declare (ignore newtrlst newmeasure newntkstate))
 
1005
                     (genoc_t-correctness1 
 
1006
                      arrived
 
1007
                      (tomissives (extract-sublst m (v-ids arrived)))))))
 
1008
  :otf-flg t
 
1009
  :hints (("goal"
 
1010
           :do-not-induct t
 
1011
           :do-not '(eliminate-destructors generalize )
 
1012
           :use 
 
1013
           ((:instance subsetp-arrived-newtrlst-ids
 
1014
                       (trlst (routing m (nodesetgenerator params)))
 
1015
                       (nodeset (nodesetgenerator params)))
 
1016
            (:instance totmissives-extract-sublst
 
1017
                       (l (routing m (nodesetgenerator params))) 
 
1018
                       (ids (v-ids 
 
1019
                             (mv-nth 
 
1020
                              1 
 
1021
                              (scheduling 
 
1022
                               (routing m (nodesetgenerator params))
 
1023
                               
 
1024
                               (nodesetgenerator params)  ntkstate order))))
 
1025
                       (nodeset (nodesetgenerator params)))
 
1026
            (:instance scheduling-preserves-route-correctness
 
1027
                       (nodeset (nodesetgenerator params))
 
1028
                       (trlst (routing m (nodesetgenerator params))))
 
1029
            (:instance correctroutesp-vm-frms-gc1
 
1030
                       (nodeset (nodesetgenerator params))
 
1031
                       (l (mv-nth 
 
1032
                           1 
 
1033
                           (scheduling
 
1034
                            (routing m (nodesetgenerator params))
 
1035
                             (nodesetgenerator params)  ntkstate order)))))
 
1036
           :in-theory (disable trlstp tmissivesp
 
1037
                               correctroutesp-vm-frms-gc1 len       
 
1038
                               subsetp-arrived-newtrlst-ids
 
1039
                               scheduling-preserves-route-correctness
 
1040
                               arrived/rtg_not_modify_frames))))
 
1041
 
 
1042
;;tomissives of scheduling + tomissives of ready 0 ----> tomissives m
 
1043
 
 
1044
(defthm lemma12
 
1045
  (let ((nodeset (nodesetgenerator params))
 
1046
        (mv0-sched (mv-nth 
 
1047
                    0 
 
1048
                    (scheduling 
 
1049
                     (routing (mv-nth 1 (readyfordeparture m nil nil
 
1050
                                                           time)) 
 
1051
                              (nodesetgenerator params))
 
1052
                      (nodesetgenerator params)  ntkstate  order)))
 
1053
      (mv3-sched (mv-nth 
 
1054
                  2 
 
1055
                  (scheduling 
 
1056
                   (routing (mv-nth 1 (readyfordeparture m nil nil
 
1057
                                                         time)) 
 
1058
                            (nodesetgenerator params))
 
1059
                    (nodesetgenerator params)  ntkstate order)))
 
1060
      (mv4-sched (mv-nth 
 
1061
                  3 
 
1062
                  (scheduling 
 
1063
                   (routing (mv-nth 1 (readyfordeparture m nil nil
 
1064
                                                         time)) 
 
1065
                            (nodesetgenerator params))
 
1066
                    (nodesetgenerator params)  ntkstate order)))
 
1067
      (mv0-r4d        (mv-nth 0 (readyfordeparture m nil nil time)))
 
1068
      (order1 (get_next_priority order)))
 
1069
    (implies (and (tmissivesp m nodeset) 
 
1070
                  (validparamsp params))
 
1071
             (equal
 
1072
              (extract-sublst (append 
 
1073
                               (extract-sublst (tomissives m) 
 
1074
                                               (tm-ids mv0-sched))     
 
1075
                               (extract-sublst (tomissives m) 
 
1076
                                               (tm-ids mv0-r4d)))
 
1077
                              (v-ids 
 
1078
                               (genoc_t-non-tail-comp 
 
1079
                                (append mv0-sched mv0-r4d) nodeset
 
1080
                                mv3-sched  
 
1081
                                (+ 1 time) mv4-sched order1)))
 
1082
              (extract-sublst (tomissives m)
 
1083
                              (v-ids (genoc_t-non-tail-comp 
 
1084
                                      (append mv0-sched mv0-r4d) 
 
1085
                                      nodeset mv3-sched  (+ 1 time)
 
1086
                                      mv4-sched 
 
1087
                                      order1))))))
 
1088
  
 
1089
  :hints (("goal" :use 
 
1090
           ((:instance v-ids-genoc_t-non-tail-comp 
 
1091
                       (m (append (mv-nth 
 
1092
                                   0
 
1093
                                   (scheduling 
 
1094
                                    (routing 
 
1095
                                     (mv-nth 
 
1096
                                      1
 
1097
                                      (readyfordeparture m nil nil
 
1098
                                                         time)) 
 
1099
                                     (nodesetgenerator params))
 
1100
                                     (nodesetgenerator params) 
 
1101
                                    ntkstate order)) 
 
1102
                                  (mv-nth 
 
1103
                                   0 
 
1104
                                   (readyfordeparture m nil nil time))))
 
1105
                       (measure (mv-nth 
 
1106
                             2 
 
1107
                             (scheduling 
 
1108
                              (routing (mv-nth 
 
1109
                                        1 (readyfordeparture m nil nil
 
1110
                                                             time))
 
1111
                                       (nodesetgenerator params))
 
1112
                               (nodesetgenerator params)  ntkstate order)))
 
1113
                       (time (+ 1 time))
 
1114
                       (order (get_next_priority order))
 
1115
                       (ntkstate 
 
1116
                        (mv-nth 
 
1117
                         3 
 
1118
                         (scheduling 
 
1119
                          (routing 
 
1120
                           (mv-nth 1 (readyfordeparture m nil nil
 
1121
                                                        time)) 
 
1122
                           (nodesetgenerator params))
 
1123
                           (nodesetgenerator params)  ntkstate order))))
 
1124
            (:instance equalid-tomissives 
 
1125
                       (nodeset (nodesetgenerator params)))
 
1126
            (:instance tm-ids-append-invert 
 
1127
                       (nodeset (nodesetgenerator params))
 
1128
                       (a (mv-nth 
 
1129
                           0 
 
1130
                           (scheduling 
 
1131
                            (routing (mv-nth 
 
1132
                                      1 
 
1133
                                      (readyfordeparture m nil nil
 
1134
                                                         time)) 
 
1135
                                     (nodesetgenerator params))
 
1136
                             (nodesetgenerator params)  ntkstate order))) 
 
1137
                       (b (mv-nth 0 (readyfordeparture m nil nil time))))
 
1138
            (:instance newtrlst-travel-correctness 
 
1139
                       (nodeset (nodesetgenerator params))
 
1140
                       (trlst (routing 
 
1141
                               (mv-nth 1 
 
1142
                                       (readyfordeparture m nil nil
 
1143
                                                          time)) 
 
1144
                               (nodesetgenerator params))))
 
1145
            (:instance subsetp-arrived-newtrlst-ids
 
1146
                       (trlst (routing 
 
1147
                               (mv-nth 1 (readyfordeparture m nil nil
 
1148
                                                            time)) 
 
1149
                               (nodesetgenerator params)))
 
1150
                       (nodeset (nodesetgenerator params)))
 
1151
            (:instance extract-sublst-cancel-m 
 
1152
                       (m (tomissives m))
 
1153
                       (id1 (tm-ids (append 
 
1154
                                     (mv-nth 
 
1155
                                      0
 
1156
                                      (scheduling 
 
1157
                                       (routing 
 
1158
                                        (mv-nth 
 
1159
                                         1 
 
1160
                                         (readyfordeparture m nil nil
 
1161
                                                            time)) 
 
1162
                                        (nodesetgenerator params))
 
1163
                                        (nodesetgenerator params)
 
1164
                                       ntkstate order)) 
 
1165
                                     (mv-nth 
 
1166
                                      0 
 
1167
                                      (readyfordeparture m nil nil time))) )) 
 
1168
                       (id2 (v-ids (genoc_t-non-tail-comp
 
1169
                                    (append (mv-nth 
 
1170
                                             0
 
1171
                                             (scheduling 
 
1172
                                              (routing 
 
1173
                                               (mv-nth 
 
1174
                                                1 
 
1175
                                                (readyfordeparture m
 
1176
                                                                   nil
 
1177
                                                                   nil
 
1178
                                                                   time)) 
 
1179
                                               (nodesetgenerator params))
 
1180
                                               (nodesetgenerator
 
1181
                                                   params)  
 
1182
                                              ntkstate order)) 
 
1183
                                            (mv-nth 
 
1184
                                             0 
 
1185
                                             (readyfordeparture m nil
 
1186
                                                                nil
 
1187
                                                                time)))
 
1188
                                    (nodesetgenerator params)                
 
1189
                                    (mv-nth 2 
 
1190
                                            (scheduling 
 
1191
                                             (routing 
 
1192
                                              (mv-nth 
 
1193
                                               1 
 
1194
                                               (readyfordeparture m
 
1195
                                                                  nil
 
1196
                                                                  nil
 
1197
                                                                  time)) 
 
1198
                                              (nodesetgenerator params))
 
1199
                                              (nodesetgenerator
 
1200
                                                  params)  
 
1201
                                             ntkstate order))
 
1202
                                    (+ 1 time)
 
1203
                                    (mv-nth 
 
1204
                                     3 
 
1205
                                     (scheduling 
 
1206
                                      (routing 
 
1207
                                       (mv-nth 
 
1208
                                        1 
 
1209
                                        (readyfordeparture m nil nil
 
1210
                                                           time)) 
 
1211
                                       (nodesetgenerator params))
 
1212
                                       (nodesetgenerator params) 
 
1213
                                      ntkstate order)) 
 
1214
                                    (get_next_priority order )))))
 
1215
            (:instance tmissivesp-ready-4-departure-mv-0  
 
1216
                       (nodeset (nodesetgenerator params)))
 
1217
            (:instance trlstp-routing 
 
1218
                       (m (mv-nth 1 (readyfordeparture m nil nil time))))
 
1219
          (:instance tmissivesp-append-tmissivesp 
 
1220
                     (a (mv-nth 0
 
1221
                                (scheduling 
 
1222
                                 (routing 
 
1223
                                  (mv-nth 
 
1224
                                   1 (readyfordeparture m nil nil time))
 
1225
                                  (nodesetgenerator params)) 
 
1226
                                  (nodesetgenerator params)  ntkstate
 
1227
                                  order))) 
 
1228
                     (b (mv-nth 0 (readyfordeparture m nil nil time)))
 
1229
                     (nodeset (nodesetgenerator params)))
 
1230
          (:instance v-ids_g_nt_sigma_subsetp-v-ids-newtrlst/rtg 
 
1231
                     (m (append 
 
1232
                         (mv-nth 
 
1233
                          0
 
1234
                          (scheduling 
 
1235
                           (routing 
 
1236
                            (mv-nth 
 
1237
                             1 (readyfordeparture m nil nil time)) 
 
1238
                            (nodesetgenerator params))
 
1239
                            (nodesetgenerator params)  ntkstate
 
1240
                           order)) 
 
1241
                         (mv-nth 0 (readyfordeparture m nil nil time))) ))
 
1242
          (:instance tmissivesp-ready-4-departure-mv-1 
 
1243
                     (nodeset (nodesetgenerator params)))
 
1244
          (:instance not-in-1-0-ready-for-dept-reverse 
 
1245
                     (nodeset (nodesetgenerator params)))
 
1246
          (:instance not-in-1-0-ready-for-dept 
 
1247
                     (nodeset (nodesetgenerator params)))
 
1248
          (:instance tmissivesp-newTrlst
 
1249
                     (trlst (routing 
 
1250
                             (mv-nth 1 
 
1251
                                     (readyfordeparture m nil nil time)) 
 
1252
                             (nodesetgenerator params))) 
 
1253
                     (nodeset (nodesetgenerator params)))))))
 
1254
 
 
1255
 
 
1256
(defthm lemma12final
 
1257
  (let ((nodeset (nodesetgenerator params))
 
1258
        (mv0-sched 
 
1259
         (mv-nth 
 
1260
          0 
 
1261
          (scheduling 
 
1262
           (routing 
 
1263
            (mv-nth 
 
1264
             1 (readyfordeparture m nil nil time)) 
 
1265
            (nodesetgenerator params))
 
1266
            (nodesetgenerator params)  ntkstate order)))
 
1267
        (mv3-sched 
 
1268
         (mv-nth 
 
1269
          2 
 
1270
          (scheduling 
 
1271
           (routing 
 
1272
            (mv-nth 
 
1273
             1 (readyfordeparture m nil nil time)) 
 
1274
            (nodesetgenerator params))
 
1275
            (nodesetgenerator params)  ntkstate order)))
 
1276
        (mv4-sched 
 
1277
         (mv-nth 
 
1278
          3 
 
1279
          (scheduling 
 
1280
           (routing 
 
1281
            (mv-nth 
 
1282
             1 (readyfordeparture m nil nil time)) 
 
1283
            (nodesetgenerator params))
 
1284
            (nodesetgenerator params) ntkstate order)))
 
1285
        (mv0-r4d (mv-nth 0 (readyfordeparture m nil nil time))))
 
1286
    (implies (and (tmissivesp m nodeset) 
 
1287
                  (validparamsp params))
 
1288
             (equal 
 
1289
              (extract-sublst 
 
1290
               (append (extract-sublst (tomissives m) 
 
1291
                                       (tm-ids mv0-sched))
 
1292
                       (tomissives mv0-r4d))
 
1293
               (v-ids 
 
1294
                (genoc_t-non-tail-comp 
 
1295
                 (append mv0-sched mv0-r4d) nodeset mv3-sched 
 
1296
                 (+ 1 time) mv4-sched (get_next_priority order))))
 
1297
              (extract-sublst 
 
1298
               (tomissives m)
 
1299
               (v-ids 
 
1300
                (genoc_t-non-tail-comp 
 
1301
                 (append mv0-sched mv0-r4d) nodeset mv3-sched (+ 1
 
1302
                                                                 time) 
 
1303
                 mv4-sched (get_next_priority order)))))))
 
1304
    :hints (("goal" 
 
1305
             :in-theory (e/d () (tmissivesp
 
1306
                                 checkroutes-subsetp-validroute
 
1307
                                 m-ids-append-invert
 
1308
                                 nil-r4d-nil-mv0 nil-r4d-nil-mv1  zp
 
1309
                                ; true-listp-genoc_t-non-tail-comp
 
1310
                                 tomissives
 
1311
                                 member-equal-tm-ids-assoc-equal 
 
1312
                                 member-equal-m-ids-assoc-equal tm-ids
 
1313
                                 assoc-equal m-ids))
 
1314
             :use ((:instance lemma12)
 
1315
                   (:instance subset-ready-for-departure-4 
 
1316
                              (nodeset (nodesetgenerator params)))
 
1317
                 (:instance tmissivesp-ready-4-departure-mv-0 
 
1318
                            (nodeset (nodesetgenerator params)))
 
1319
                 (:instance tmissivesp-equal-subsetp 
 
1320
                            (nodeset (nodesetgenerator params))
 
1321
                            (y  m)
 
1322
                            (x  (mv-nth 0 (readyfordeparture m nil nil time))))
 
1323
                 (:instance tmissives-subset-extract-tomissives-equal 
 
1324
                            (nodeset (nodesetgenerator params))
 
1325
                            (x m)
 
1326
                            (ids (tm-ids 
 
1327
                                  (mv-nth 
 
1328
                                   0 
 
1329
                                   (readyfordeparture m nil nil time)))))
 
1330
                 (:instance subset-ready-for-departure 
 
1331
                            (nodeset (nodesetgenerator params)))
 
1332
                 (:instance subset-ready-for-departure-4 
 
1333
                            (nodeset (nodesetgenerator params)))
 
1334
                 (:instance tmissivesp-ready-4-departure-mv-0 
 
1335
                            (nodeset (nodesetgenerator params)))))))
 
1336
 
 
1337
(defthm takingtomissivesout-equal
 
1338
  (let ((nodeset (nodesetgenerator params))
 
1339
        (mv1-sched (mv-nth 
 
1340
                    1 
 
1341
                    (scheduling 
 
1342
                     (routing 
 
1343
                      (mv-nth 1 (readyfordeparture m nil nil time)) 
 
1344
                      (nodesetgenerator params))
 
1345
                      (nodesetgenerator params)  ntkstate order))))
 
1346
    (implies (and (tmissivesp M nodeset) 
 
1347
                  (validparamsp params))
 
1348
             (equal
 
1349
              (tomissives 
 
1350
               (extract-sublst (mv-nth 1 (readyfordeparture m nil nil time))
 
1351
                               (v-ids mv1-sched)))
 
1352
              (extract-sublst  (tomissives 
 
1353
                                (mv-nth 1 (readyfordeparture m nil nil time)))
 
1354
                               (v-ids mv1-sched)))))
 
1355
                                                   
 
1356
  :hints (("goal" 
 
1357
           :use ((:instance tmissivesp-equal-subsetp 
 
1358
                            (x (mv-nth 1 (readyfordeparture m nil nil time)))
 
1359
                            (nodeset (nodesetgenerator params))
 
1360
                            (y m))
 
1361
                 (:instance ToMissives-extract-sublst 
 
1362
                            (L (extract-sublst 
 
1363
                                m 
 
1364
                                (tm-ids (mv-nth 
 
1365
                                         1 
 
1366
                                         (readyfordeparture m nil nil time)))))
 
1367
                            (ids (v-ids 
 
1368
                                  (mv-nth 
 
1369
                                   1 
 
1370
                                   (scheduling 
 
1371
                                    (routing 
 
1372
                                     (mv-nth 
 
1373
                                      1 (readyfordeparture m nil nil time))
 
1374
                                     (nodesetgenerator params)) 
 
1375
                                     (nodesetgenerator params) 
 
1376
                                    ntkstate order)))) 
 
1377
                            (nodeset (nodesetgenerator params)))
 
1378
                 (:instance subsetp-arrived-newtrlst-ids
 
1379
                            (trlst (routing 
 
1380
                                    (mv-nth 
 
1381
                                     1 
 
1382
                                     (readyfordeparture m nil nil
 
1383
                                                        time)) 
 
1384
                                    (nodesetgenerator params)))
 
1385
                            (nodeset (nodesetgenerator params)))))))
 
1386
 
 
1387
 
 
1388
 
 
1389
(defthm lemma121final
 
1390
  (let ((nodeset (nodesetgenerator params))
 
1391
        (mv1-sched (mv-nth 
 
1392
                    1 
 
1393
                    (scheduling 
 
1394
                     (routing 
 
1395
                      (mv-nth 
 
1396
                       1 (readyfordeparture m nil nil time)) 
 
1397
                      (nodesetgenerator params))
 
1398
                      (nodesetgenerator params)  ntkstate order))))
 
1399
    (implies (and (tmissivesp M nodeset) 
 
1400
                  (validparamsp params))
 
1401
             (equal 
 
1402
              (extract-sublst 
 
1403
               (tomissives (mv-nth 1 (readyfordeparture m nil nil time)))
 
1404
               (v-ids mv1-sched))
 
1405
              (tomissives (extract-sublst M (v-ids mv1-sched))))))                                   
 
1406
  :hints (("Goal" 
 
1407
           :in-theory (disable tmissivesp len)
 
1408
           :do-not-induct t
 
1409
           :use ((:instance extract-sublst-cancel-TM 
 
1410
                            (id1 (TM-ids 
 
1411
                                  (mv-nth 
 
1412
                                   1 (readyfordeparture m nil nil time)))) 
 
1413
                            (id2 (v-ids 
 
1414
                                  (mv-nth 
 
1415
                                   1 
 
1416
                                   (scheduling 
 
1417
                                    (routing 
 
1418
                                     (mv-nth 
 
1419
                                      1 
 
1420
                                      (readyfordeparture m nil nil time))
 
1421
                                     (nodesetgenerator params))  
 
1422
                                     (nodesetgenerator params)
 
1423
                                     ntkstate order)))))
 
1424
                 (:instance tmissivesp-ready-4-departure-mv-1 
 
1425
                            (nodeset (nodesetgenerator params)))
 
1426
                 (:instance ToMissives-extract-sublst 
 
1427
                            (L (extract-sublst 
 
1428
                                m 
 
1429
                                (tm-ids 
 
1430
                                 (mv-nth 1
 
1431
                                         (readyfordeparture m nil nil time)))))
 
1432
                            (ids (v-ids 
 
1433
                                  (mv-nth 
 
1434
                                   1 
 
1435
                                   (scheduling 
 
1436
                                    (routing 
 
1437
                                     (mv-nth 
 
1438
                                      1 (readyfordeparture m nil nil time))
 
1439
                                     (nodesetgenerator params)) 
 
1440
                                     (nodesetgenerator params) 
 
1441
                                    ntkstate order)))) 
 
1442
                            (nodeset (nodesetgenerator params)))
 
1443
                 (:instance ids-routing 
 
1444
                            (M (mv-nth 1 (readyfordeparture m nil nil time))))
 
1445
                 (:instance tmissivesp-equal-subsetp 
 
1446
                            (x (mv-nth 1 (readyfordeparture m nil nil time)))
 
1447
                            (nodeset (nodesetgenerator params))
 
1448
                            (y m))
 
1449
                 (:instance subsetp-arrived-newtrlst-ids
 
1450
                            (trlst (routing 
 
1451
                                    (mv-nth 
 
1452
                                     1 (readyfordeparture m nil nil
 
1453
                                                          time)) 
 
1454
                                    (nodesetgenerator params)))
 
1455
                            (nodeset (nodesetgenerator params)))))))
 
1456
 
 
1457
 
 
1458
(defthm subset-arrived-tm-ids-M
 
1459
  (implies (and (tmissivesp M (nodesetgenerator params))
 
1460
                (validparamsp params))
 
1461
           (subsetp (V-ids (mv-nth 
 
1462
                            1
 
1463
                            (scheduling 
 
1464
                             (routing (mv-nth 
 
1465
                                       1
 
1466
                                       (readyfordeparture m nil nil time))
 
1467
                                      (nodesetgenerator params))  
 
1468
                              (nodesetgenerator params)  ntkstate order))) 
 
1469
                    (Tm-ids M)))
 
1470
  :hints (("Goal" 
 
1471
           :in-theory (disable tmissivesp)
 
1472
           :use 
 
1473
           ((:instance subset-ready-for-departure-2 
 
1474
                       (nodeset (nodesetgenerator params)))
 
1475
            (:instance tmissivesp-ready-4-departure-mv-1 
 
1476
                       (nodeset (nodesetgenerator params)))
 
1477
            (:instance ids-routing 
 
1478
                       (M (mv-nth 1 (readyfordeparture m nil nil time))))
 
1479
            (:instance subsetp-arrived-newtrlst-ids
 
1480
                       (trlst (routing 
 
1481
                               (mv-nth 
 
1482
                                1 
 
1483
                                (readyfordeparture m nil nil time)) 
 
1484
                               (nodesetgenerator params)))
 
1485
                       (nodeset (nodesetgenerator params)))))))
 
1486
 
 
1487
 
 
1488
(defthm lasttheorem-lemma1211
 
1489
  (let ((nodeset (nodesetgenerator params))
 
1490
        (mv1-sched 
 
1491
         (mv-nth 
 
1492
          1 
 
1493
          (scheduling 
 
1494
           (routing (mv-nth 1 (readyfordeparture m nil nil time)) 
 
1495
                    (nodesetgenerator params))
 
1496
            (nodesetgenerator params)  ntkstate order))))
 
1497
    (implies (and (tmissivesp M nodeset) 
 
1498
                  (validparamsp params))
 
1499
             (equal (extract-sublst (tomissives m)
 
1500
                                    (v-ids mv1-sched))
 
1501
                    (tomissives (extract-sublst 
 
1502
                                 (mv-nth 1 (readyfordeparture m nil nil time))
 
1503
                                 (v-ids mv1-sched))))))
 
1504
  :hints (("Goal" 
 
1505
           :in-theory (disable tmissivesp)
 
1506
           :use ((:instance lemma121final)
 
1507
                 (:instance takingtomissivesout-equal)))))
 
1508
(defthm true-listp-r4d
 
1509
  (implies (tmissivesp m nodeset)
 
1510
           (true-listp (mv-nth 0 (readyfordeparture m nil nil time))))
 
1511
  :hints (("Goal" :use (tmissivesp-ready-4-departure-mv-0)
 
1512
                  :in-theory (disable tmissivesp-ready-4-departure-mv-0)))
 
1513
  :rule-classes :type-prescription)
 
1514
 
 
1515
(defthm genoc_t-thm          ;; ok
 
1516
  ;; now we can prove the correctness of genoc_t
 
1517
  (let ((nodeset (nodesetgenerator params)))
 
1518
    (implies (and (tmissivesp m nodeset) ;(goodorder order)
 
1519
                  (validparamsp params))
 
1520
             (mv-let (cplt abt)
 
1521
                     (genoc_t m nodeset measure nil  accup time ntkstate order)
 
1522
                     (declare (ignore abt))
 
1523
                     (genoc_t-correctness cplt m))))
 
1524
  :otf-flg t
 
1525
  :hints (("goal"
 
1526
           :induct (genoc_t-non-tail-comp m (nodesetgenerator params)
 
1527
                                          measure time ntkstate order)
 
1528
           :do-not '(eliminate-destructors generalize)
 
1529
           :in-theory (disable trlstp tmissivesp lemma121final)
 
1530
           :do-not-induct t)
 
1531
          ("subgoal *1/2"
 
1532
           :in-theory (disable tmissivesp mv-nth
 
1533
                               extract-sublst-cancel-m
 
1534
                       lemma121final trlstp tmissivesp
 
1535
                       lemma12)
 
1536
           :use 
 
1537
           ((:instance gc1_arrived/rtg 
 
1538
                       (m (mv-nth 1 (readyfordeparture m nil nil time))))
 
1539
            (:instance lasttheorem-lemma1211)
 
1540
            (:instance v-ids-genoc_t-non-tail-comp 
 
1541
                       (m (append (mv-nth 
 
1542
                                   0
 
1543
                                   (scheduling 
 
1544
                                    (routing 
 
1545
                                     (mv-nth 
 
1546
                                      1 
 
1547
                                      (readyfordeparture m nil nil
 
1548
                                                         time)) 
 
1549
                                     (nodesetgenerator params))
 
1550
                                     (nodesetgenerator params)
 
1551
                                    ntkstate order)) 
 
1552
                                  (mv-nth 
 
1553
                                   0 (readyfordeparture m nil nil time))))
 
1554
                       (measure (mv-nth 
 
1555
                             2
 
1556
                             (scheduling 
 
1557
                              (routing 
 
1558
                               (mv-nth 
 
1559
                                1 
 
1560
                                (readyfordeparture m nil nil time)) 
 
1561
                               (nodesetgenerator params))
 
1562
                               (nodesetgenerator params)
 
1563
                              ntkstate order)))
 
1564
                       (time (+ 1 time))
 
1565
                       (ntkstate (mv-nth 
 
1566
                                  3 
 
1567
                                  (scheduling 
 
1568
                                   (routing 
 
1569
                                    (mv-nth 
 
1570
                                     1 
 
1571
                                     (readyfordeparture m nil nil
 
1572
                                                        time)) 
 
1573
                                    (nodesetgenerator params))
 
1574
                                    (nodesetgenerator params) 
 
1575
                                   ntkstate order)))
 
1576
                       (order (get_next_priority order))) 
 
1577
            (:instance gc1_arrived/rtg 
 
1578
                       (m  (mv-nth 1 (readyfordeparture m nil nil time))))))
 
1579
          ("subgoal *1/2.2"
 
1580
           :use 
 
1581
           ((:instance v-ids-genoc_t-non-tail-comp 
 
1582
                       (m (append 
 
1583
                           (mv-nth 
 
1584
                            0 
 
1585
                            (scheduling 
 
1586
                             (routing 
 
1587
                              (mv-nth 
 
1588
                               1 (readyfordeparture m nil nil time)) 
 
1589
                              (nodesetgenerator params))
 
1590
                              (nodesetgenerator params)  ntkstate
 
1591
                             order)) 
 
1592
                           (mv-nth 0 (readyfordeparture m nil nil time))))
 
1593
                       (measure (mv-nth 
 
1594
                             2 
 
1595
                             (scheduling 
 
1596
                              (routing 
 
1597
                               (mv-nth 1 (readyfordeparture m nil nil
 
1598
                                                            time)) 
 
1599
                               (nodesetgenerator params))
 
1600
                               (nodesetgenerator params)  ntkstate
 
1601
                              order))) 
 
1602
                       (time (+ 1 time))
 
1603
                       (ntkstate (mv-nth 
 
1604
                                  3 
 
1605
                                  (scheduling 
 
1606
                                   (routing 
 
1607
                                    (mv-nth 
 
1608
                                     1 (readyfordeparture m nil nil
 
1609
                                                          time)) 
 
1610
                                    (nodesetgenerator params))
 
1611
                                    (nodesetgenerator params)  
 
1612
                                   ntkstate order)))
 
1613
                       (order (get_next_priority order)))))
 
1614
          ("Subgoal *1/3.1" 
 
1615
           :in-theory (disable tmissivesp mv-nth
 
1616
                               extract-sublst-cancel-m
 
1617
                               lasttheorem-lemma1211 lemma12)
 
1618
           :use 
 
1619
           ((:instance tmissivesp-ready-4-departure-mv-1
 
1620
                       (nodeset (nodesetgenerator Params)))
 
1621
            (:instance gc1_arrived/rtg 
 
1622
                       (M (mv-nth 1 (readyfordeparture m nil nil time))))))    
 
1623
          ("Subgoal *1/3.1'" 
 
1624
           :in-theory (disable tmissivesp mv-nth
 
1625
                               extract-sublst-cancel-m 
 
1626
                               lemma121final lemma12))))#|ACL2s-ToDo-Line|#
 
1627
 
 
1628
 
 
1629
 
 
1630
;;------------------------------------------------------------
 
1631
;;      definition and validation of genoc
 
1632
;;------------------------------------------------------------
 
1633
 
 
1634
;; we load the generic definitions of the interfaces
 
1635
(include-book "interfaces-computes")
 
1636
 
 
1637
;(include-book "GeNoC-interfaces")
 
1638
 
 
1639
;; ComputetTMissives
 
1640
;; --------------
 
1641
;(defun computeTMissives (transactions)
 
1642
  ;; apply the function p2psend to build a list of tmissives
 
1643
  ;; from a list of transactions
 
1644
;(if (endp transactions)
 
1645
;     nil
 
1646
;    (let* ((trans (car transactions))
 
1647
;          (id (idt trans))
 
1648
;           (org (orgt trans))
 
1649
;          (msg (msgt trans))
 
1650
;           (dest (destt trans))
 
1651
;           (flit (flitt trans))
 
1652
;           (time (timet trans)))
 
1653
;      (cons (list id org org (p2psend msg) dest flit time)
 
1654
;            (computetmissives (cdr transactions))))))
 
1655
 
 
1656
 
 
1657
;; ComputeResults
 
1658
;; -------------
 
1659
;(defun computeresults (trlst)
 
1660
  ;; apply the function p2precv to build a list of results
 
1661
  ;; from a list of travels
 
1662
;  (if (endp trlst)
 
1663
;      nil
 
1664
;    (let* ((tr (car trlst))
 
1665
;           (id (idv tr))
 
1666
;           (r (car (routesv tr)))
 
1667
;           (dest (car (last r)))
 
1668
;           (frm (frmv tr))
 
1669
;           (flit (flitv tr)))
 
1670
;      (cons (list id dest (p2precv frm) flit)
 
1671
;            (computeresults (cdr trlst))))))
 
1672
 
 
1673
 
 
1674
;; genoc
 
1675
;; -----
 
1676
 
 
1677
(defun genoc (trs params params2 order)
 
1678
  ;; main function
 
1679
  (if (ValidStateParamsp params params2)
 
1680
    (mv-let (responses aborted simu)
 
1681
            (genoc_t (computetmissives trs)
 
1682
                     (NodesetGenerator params)
 
1683
                     (initial-measure (routing (computetmissives trs) (NodesetGenerator params))
 
1684
                                      (NodesetGenerator params)
 
1685
                                      (generate-initial-ntkstate trs (stategenerator params params2))
 
1686
                                      order)
 
1687
                     nil
 
1688
                     nil
 
1689
                     '0 
 
1690
                     (generate-initial-ntkstate trs (stategenerator params params2))
 
1691
                     order)
 
1692
            (declare(ignore simu))
 
1693
            (mv (computeresults responses) aborted))
 
1694
    (mv nil nil)))
 
1695
 
 
1696
;; genoc correctness
 
1697
;; -----------------
 
1698
(defun genoc-correctness (results trs/ids)
 
1699
  ;; trs/ids is the initial list of transactions filtered according
 
1700
  ;; to the ids of the list of results. 
 
1701
  ;; we check that the messages and the destinations of these two lists
 
1702
  ;; are equal.
 
1703
  (and (equal (r-msgs results)
 
1704
              (t-msgs trs/ids))
 
1705
       (equal (r-dests results)
 
1706
              (t-dests trs/ids))))
 
1707
 
 
1708
(defun all-frms-equal-to-p2psend (trlst trs)
 
1709
  ;; check that every frame of trlst is equal to the application
 
1710
  ;; of p2psend to the corresponding message in the list of 
 
1711
  ;; transactions trs
 
1712
  (if (endp trlst)
 
1713
      (if (endp trs) 
 
1714
          t
 
1715
        nil)
 
1716
    (let* ((tr (car trlst))
 
1717
           (trans (car trs))
 
1718
           (tr-frm (frmv tr))
 
1719
           (t-msg (msgt trans)))
 
1720
      (and (equal tr-frm (p2psend2 t-msg))
 
1721
           (all-frms-equal-to-p2psend (cdr trlst) (cdr trs))))))
 
1722
 
 
1723
(defthm gc1-=>-all-frms-equal-to-p2psend      ;; ok
 
1724
  (implies (genoc_t-correctness1 trlst (tomissives (computetmissives trs)))
 
1725
           (all-frms-equal-to-p2psend trlst trs))
 
1726
  :hints (("Goal" 
 
1727
           :in-theory (disable last true-listp leq-position-equal-len 
 
1728
                                nfix len))))
 
1729
 
 
1730
(defthm all-frms-equal-r-msgs-t-msgs
 
1731
  ;; if frames have been computed by p2psend then
 
1732
  ;; computeresults applies p2precv. we get thus the initial msg.
 
1733
  (implies (and (all-frms-equal-to-p2psend trlst trs)
 
1734
                (validfields-trlst trlst nodeset))
 
1735
           (equal (r-msgs (computeresults trlst))
 
1736
                  (t-msgs trs)))
 
1737
  :hints (("Goal" 
 
1738
           :in-theory (disable last true-listp leq-position-equal-len 
 
1739
                               nfix len))))
 
1740
 
 
1741
(defthm gc1-r-dest-tm-dests       ;; ok
 
1742
  (implies (and (genoc_t-correctness1 trlst m/trlst)
 
1743
                (validfields-trlst trlst nodeset)
 
1744
                (missivesp m/trlst nodeset))
 
1745
           (equal (r-dests (computeresults trlst))
 
1746
                  (m-dests m/trlst))))
 
1747
 
 
1748
 
 
1749
(in-theory (disable mv-nth))           
 
1750
 
 
1751
(defthm validfields-trlst-genoc_nt       ;; ok
 
1752
  ;; to use the lemma all-frms-equal-to-p2psend we need to establish
 
1753
  ;; that genoc_nt contains travels with validfields
 
1754
  ;; and that it contains no duplicated ids
 
1755
  (let ((nodeset (nodesetgenerator params)))
 
1756
    (implies (and (tmissivesp m nodeset)
 
1757
                  (validparamsp params))
 
1758
             (validfields-trlst 
 
1759
              (genoc_t-non-tail-comp m nodeset measure time ntkstate
 
1760
                                     order) 
 
1761
              nodeset)))
 
1762
  :otf-flg t
 
1763
  :hints (("goal"
 
1764
           :do-not-induct t
 
1765
           :induct (genoc_t-non-tail-comp m (nodesetgenerator params)
 
1766
                                          measure  time ntkstate order))
 
1767
          ("subgoal *1/3"
 
1768
           :use
 
1769
           ((:instance tmissivesp-newTrlst
 
1770
                       (trlst (routing 
 
1771
                               (mv-nth 1 (readyfordeparture m nil nil time)) 
 
1772
                               (nodesetgenerator params)))
 
1773
                       (nodeset (nodesetgenerator params)))
 
1774
            (:instance trlstp-arrived
 
1775
                       (trlst (routing 
 
1776
                               (mv-nth 1 (readyfordeparture m nil nil time)) 
 
1777
                               (nodesetgenerator params)))
 
1778
                       (nodeset (nodesetgenerator params)))
 
1779
            (:instance tmissivesp-mv-nth-0-scheduling
 
1780
                       (trlst (routing 
 
1781
                               (mv-nth 1 (readyfordeparture m nil nil time)) 
 
1782
                               (nodesetgenerator params)))))
 
1783
           :in-theory (disable tmissivesp-newTrlst trlstp-arrived
 
1784
                               tmissivesp-mv-nth-0-scheduling))))
 
1785
 
 
1786
 
 
1787
(defthm tm-orgs-computetmissives      ;; ok
 
1788
  (equal (tm-orgs (computetmissives trs))
 
1789
         (t-orgs trs)))
 
1790
 
 
1791
(defthm tm-dests-computetmissives      ;; ok
 
1792
  (equal (tm-dests (computetmissives trs))
 
1793
         (t-dests trs)))        
 
1794
 
 
1795
 
 
1796
                        
 
1797
(defthm tm-ids-computestmissives       ;; ok
 
1798
  ;; lemma for the next defthm
 
1799
  (equal (tm-ids (computetmissives trs))
 
1800
         (t-ids trs)))
 
1801
 
 
1802
 
 
1803
(defthm tmissivesp-computetmissives     ;; ok
 
1804
  (implies (transactionsp trs nodeset)
 
1805
           (tmissivesp (computetmissives trs) nodeset)))
 
1806
 
 
1807
 
 
1808
 
 
1809
(defthm Extract-computemissives-tmissivesp-instance
 
1810
  (implies (and (transactionsp trs (nodesetgenerator params))
 
1811
                (validparamsp params))
 
1812
           (tmissivesp
 
1813
            (extract-sublst (computetmissives trs)
 
1814
                            (v-ids 
 
1815
                             (genoc_t-non-tail-comp (computetmissives trs)
 
1816
                                                    (nodesetgenerator params)
 
1817
                                                    measure time ntkstate order))) 
 
1818
            (nodesetgenerator params)))
 
1819
  :hints (("Goal" 
 
1820
           :use 
 
1821
           ((:instance v-ids-genoc_t-non-tail-comp 
 
1822
                       (m (computetmissives trs))) 
 
1823
            (:instance tmissivesp-computetmissives 
 
1824
                       (nodeset (nodesetgenerator params))) 
 
1825
            (:instance subset-arrived-tm-ids-M 
 
1826
                       (M (computetmissives trs)))
 
1827
            (:instance v-ids-genoc_t-non-tail-comp-no-dup 
 
1828
                       (M (computetmissives trs)))))))
 
1829
 
 
1830
 
 
1831
(defthm computetmissives-assoc-equal       ;; ok
 
1832
  ;; if (assoc-equal e l) is not nil then we can link
 
1833
  ;; assoc-equal and computetmissives as follows:
 
1834
  ;; (this lemma is needed to prove the next defthm)
 
1835
  (implies (assoc-equal e l)
 
1836
           (equal (computetmissives (list (assoc-equal e l)))
 
1837
                  (list (assoc-equal e (computetmissives l))))))
 
1838
 
 
1839
 
 
1840
(defthm computetmissives-append       ;; ok
 
1841
  (equal (computetmissives (append a b))
 
1842
         (append (computetmissives a) 
 
1843
                 (computetmissives b))))
 
1844
 
 
1845
 
 
1846
(defthm member-equal-assoc-equal-not-nil-t-ids
 
1847
  ;; if e is an id of a travel of l
 
1848
  ;; then (assoc-equal e l) is not nil
 
1849
  (implies (and (member-equal e (t-ids trs))
 
1850
                (validfields-t trs))
 
1851
           (assoc-equal e trs)))
 
1852
 
 
1853
(defthm computetmissives-extract-sublst      ;; ok
 
1854
  ;; calls of computetmissives are moved into calls
 
1855
  ;; of extract-sublst
 
1856
  (implies (and (subsetp ids (t-ids trs))
 
1857
                (validfields-t trs))
 
1858
           (equal (computetmissives (extract-sublst trs ids))
 
1859
                  (extract-sublst (computetmissives trs) ids)))
 
1860
  :otf-flg t
 
1861
  :hints (("goal"
 
1862
           :induct (extract-sublst trs ids)
 
1863
           :do-not-induct t
 
1864
           :in-theory (disable computetmissives append))))
 
1865
 
 
1866
 
 
1867
(defthm computemissives-Extract-tmissivesp-instance
 
1868
  (implies (and (transactionsp trs (nodesetgenerator params))
 
1869
                (validparamsp params))
 
1870
           (tmissivesp
 
1871
            (computetmissives 
 
1872
             (extract-sublst trs
 
1873
                             (v-ids 
 
1874
                              (genoc_t-non-tail-comp (computetmissives trs)
 
1875
                                                     (nodesetgenerator params)
 
1876
                                                     measure  time
 
1877
                                                     ntkstate
 
1878
                                                     order)))) 
 
1879
            (nodesetgenerator params)))
 
1880
  
 
1881
  :hints (("Goal" 
 
1882
           :use 
 
1883
           ((:instance v-ids-genoc_t-non-tail-comp 
 
1884
                       (m (computetmissives trs))) 
 
1885
            (:instance Extract-computemissives-tmissivesp-instance)
 
1886
            (:instance subset-arrived-tm-ids-M 
 
1887
                       (M (computetmissives trs)))
 
1888
            (:instance v-ids-genoc_t-non-tail-comp-no-dup 
 
1889
                       (M (computetmissives trs)))
 
1890
            (:instance computetmissives-extract-sublst
 
1891
                       (ids (v-ids 
 
1892
                             (genoc_t-non-tail-comp (computetmissives trs)
 
1893
                                                    (nodesetgenerator params)
 
1894
                                                    measure  time ntkstate
 
1895
                                                    order))))))))
 
1896
 
 
1897
 
 
1898
 
 
1899
(in-theory (disable fwd-chaining-transactionsp))
 
1900
 
 
1901
(defthm gc1-gnc-trs
 
1902
  (implies (and (transactionsp trs (nodesetgenerator params)) 
 
1903
                (validparamsp params))
 
1904
           (genoc_t-correctness1 
 
1905
            (genoc_t-non-tail-comp 
 
1906
             (computetmissives trs)
 
1907
             (nodesetgenerator params) measure  '0 ntkstate order) 
 
1908
            (tomissives (computetmissives 
 
1909
                         (extract-sublst 
 
1910
                          trs 
 
1911
                          (v-ids 
 
1912
                           (genoc_t-non-tail-comp 
 
1913
                            (computetmissives trs) (nodesetgenerator params) 
 
1914
                            measure '0 ntkstate order)))))))
 
1915
  :hints (("Goal" :use ((:instance v-ids-genoc_t-non-tail-comp 
 
1916
                                   (time '0) 
 
1917
                                   (m (computetmissives trs)))
 
1918
                        (:instance tomissives-extract-sublst 
 
1919
                                   (l (computetmissives trs))
 
1920
                                   (ids (v-ids 
 
1921
                                         (genoc_t-non-tail-comp 
 
1922
                                          (computetmissives trs) 
 
1923
                                          (nodesetgenerator params)
 
1924
                                          measure 
 
1925
                                          '0 ntkstate order)))
 
1926
                                   (nodeset (nodesetgenerator params)))
 
1927
                        (:instance genoc_t-thm 
 
1928
                                   (time '0) 
 
1929
                                   (m (computetmissives trs)))))))
 
1930
 
 
1931
 
 
1932
(defthm gc1-=>-all-frms-equal-to-p2psend-instance       ;; ok
 
1933
  (implies (and (transactionsp trs (nodesetgenerator params)) 
 
1934
                (validparamsp params))
 
1935
           (all-frms-equal-to-p2psend 
 
1936
            (genoc_t-non-tail-comp (computetmissives trs)
 
1937
                                   (nodesetgenerator params) 
 
1938
                                   measure '0 ntkstate order) 
 
1939
            (extract-sublst trs 
 
1940
                            (v-ids 
 
1941
                             (genoc_t-non-tail-comp 
 
1942
                              (computetmissives trs) (nodesetgenerator params) 
 
1943
                              measure  '0 ntkstate order))))))
 
1944
 
 
1945
(defthm gc1-gnc-trs-inv
 
1946
  (implies (and (transactionsp Trs (nodesetgenerator params))  
 
1947
                (validparamsp params))
 
1948
           (genoc_t-correctness1 
 
1949
            (genoc_t-non-tail-comp (computetmissives
 
1950
                                    trs)(nodesetgenerator params) measure
 
1951
                                    '0 ntkstate order) 
 
1952
            (tomissives  
 
1953
             (extract-sublst (computetmissives trs) 
 
1954
                             (v-ids 
 
1955
                              (genoc_t-non-tail-comp 
 
1956
                               (computetmissives trs) 
 
1957
                               (nodesetgenerator params) 
 
1958
                               measure  '0 ntkstate order))))))
 
1959
  :hints (("Goal" 
 
1960
           :in-theory (disable transactionsp)
 
1961
           :use 
 
1962
           ((:instance v-ids-genoc_t-non-tail-comp 
 
1963
                       (time '0) 
 
1964
                       (m (computetmissives trs))) 
 
1965
            (:instance subset-arrived-tm-ids-M 
 
1966
                       (time '0) 
 
1967
                       (M (computetmissives trs)))
 
1968
            (:instance v-ids-genoc_t-non-tail-comp-no-dup 
 
1969
                       (time '0)
 
1970
                       (M (computetmissives trs)))
 
1971
            (:instance tmissivesp-computetmissives 
 
1972
                       (nodeset (nodesetgenerator params)))
 
1973
            (:instance computetmissives-extract-sublst
 
1974
                       (ids (v-ids (genoc_t-non-tail-comp 
 
1975
                                    (computetmissives trs)
 
1976
                                    (nodesetgenerator params)
 
1977
                                    measure  '0 ntkstate order))))
 
1978
            (:instance gc1-gnc-trs)))))
 
1979
 
 
1980
 
 
1981
(defthm all-frms-equal-r-msgs-t-msgs-instance
 
1982
  ;; if frames have been computed by p2psend then
 
1983
  ;; computeresults applies p2precv. we get thus the initial msg.
 
1984
  (implies (and (transactionsp trs (nodesetgenerator params)) 
 
1985
                (validparamsp params))
 
1986
           (equal (r-msgs (computeresults 
 
1987
                           (genoc_t-non-tail-comp 
 
1988
                            (computetmissives trs)(nodesetgenerator
 
1989
                                                   params) 
 
1990
                            measure  '0 ntkstate order)))
 
1991
                  (t-msgs (extract-sublst 
 
1992
                           trs 
 
1993
                           (v-ids 
 
1994
                            (genoc_t-non-tail-comp 
 
1995
                             (computetmissives trs) (nodesetgenerator params) 
 
1996
                             measure  '0 ntkstate order))))))
 
1997
  :hints (("Goal" 
 
1998
           :use 
 
1999
           ((:instance validfields-trlst-genoc_nt 
 
2000
                       (time '0) 
 
2001
                       (m (computetmissives trs)))
 
2002
            (:instance all-frms-equal-r-msgs-t-msgs 
 
2003
                       (nodeset (nodesetgenerator params))
 
2004
                       (trlst (genoc_t-non-tail-comp 
 
2005
                               (computetmissives trs)
 
2006
                               (nodesetgenerator params) measure '0
 
2007
                               ntkstate order))
 
2008
                       (trs (extract-sublst 
 
2009
                             trs 
 
2010
                             (v-ids (genoc_t-non-tail-comp 
 
2011
                                     (computetmissives trs) 
 
2012
                                     (nodesetgenerator params) 
 
2013
                                     measure  '0 ntkstate order)))))))))
 
2014
 
 
2015
(defthm r-ids-computeresults
 
2016
  (equal (r-ids (computeresults x))
 
2017
         (v-ids x)))
 
2018
 
 
2019
(defthm all-frms-equal-r-msgs-t-msgs-instance-use
 
2020
  ;; if frames have been computed by p2psend then
 
2021
  ;; computeresults applies p2precv. we get thus the initial msg.
 
2022
  (implies (and (transactionsp trs (nodesetgenerator params))
 
2023
                (validparamsp params))
 
2024
           (equal (r-msgs 
 
2025
                   (computeresults 
 
2026
                    (genoc_t-non-tail-comp (computetmissives trs)
 
2027
                                           (nodesetgenerator params)
 
2028
                                           measure '0 ntkstate order)))
 
2029
                  (t-msgs (extract-sublst 
 
2030
                           trs 
 
2031
                           (r-ids(computeresults 
 
2032
                                  (genoc_t-non-tail-comp 
 
2033
                                   (computetmissives trs) 
 
2034
                                   (nodesetgenerator params) 
 
2035
                                   measure '0 ntkstate order))))))))        
 
2036
 
 
2037
 
 
2038
(defthm gc1-r-dest-tm-dests-inst      ;; ok
 
2039
  (implies (and (and (transactionsp trs (nodesetgenerator params)) 
 
2040
                     (validparamsp params)))
 
2041
           (equal (r-dests 
 
2042
                   (computeresults 
 
2043
                    (genoc_t-non-tail-comp (computetmissives trs) 
 
2044
                                           (nodesetgenerator params) 
 
2045
                                           measure  '0 ntkstate order)))
 
2046
                  (m-dests (tomissives 
 
2047
                            (extract-sublst (computetmissives trs)
 
2048
                                            (v-ids 
 
2049
                                             (genoc_t-non-tail-comp 
 
2050
                                              (computetmissives trs)
 
2051
                                              (nodesetgenerator params) 
 
2052
                                              measure  '0 ntkstate order)))))))
 
2053
  :hints (("Goal"  :in-theory (disable len nfix nth)
 
2054
           :use 
 
2055
           ((:instance gc1-gnc-trs)
 
2056
            (:instance gc1-r-dest-tm-dests)
 
2057
            (:instance validfields-trlst-genoc_nt 
 
2058
                       (time '0) 
 
2059
                       (m (computetmissives trs)))        
 
2060
            (:instance to-missives-missivesp 
 
2061
                       (m (extract-sublst 
 
2062
                           (computetmissives trs)
 
2063
                           (v-ids 
 
2064
                            (genoc_t-non-tail-comp 
 
2065
                             (computetmissives trs) 
 
2066
                             (nodesetgenerator params)measure 
 
2067
                             '0 ntkstate order)))) 
 
2068
                       (nodeset (nodesetgenerator params) ) )
 
2069
            (:instance tmissivesp-computetmissives 
 
2070
                       (nodeset (nodesetgenerator params)))
 
2071
            (:instance v-ids-genoc_t-non-tail-comp 
 
2072
                       (time '0)
 
2073
                       (m (computetmissives trs))) 
 
2074
            (:instance subset-arrived-tm-ids-M 
 
2075
                       (time '0) 
 
2076
                       (M (computetmissives trs)))
 
2077
            (:instance v-ids-genoc_t-non-tail-comp-no-dup 
 
2078
                       (time '0) 
 
2079
                       (M (computetmissives trs)))
 
2080
            (:instance computetmissives-extract-sublst
 
2081
                       (ids (v-ids 
 
2082
                             (genoc_t-non-tail-comp 
 
2083
                              (computetmissives trs)
 
2084
                              (nodesetgenerator params)
 
2085
                              measure  '0 ntkstate order))))
 
2086
            (:instance tm-ids-computestmissives )
 
2087
            (:instance gc1-r-dest-tm-dests 
 
2088
                       (nodeset (nodesetgenerator params))
 
2089
                       (trlst (genoc_t-non-tail-comp 
 
2090
                               (computetmissives trs)
 
2091
                               (nodesetgenerator params)
 
2092
                               measure '0 ntkstate order))  
 
2093
                       (m/trlst (tomissives 
 
2094
                                 (extract-sublst 
 
2095
                                  (computetmissives trs)
 
2096
                                  (v-ids (genoc_t-non-tail-comp 
 
2097
                                          (computetmissives trs)
 
2098
                                          (nodesetgenerator params)
 
2099
                                          measure '0 ntkstate order))))))))))   
 
2100
 
 
2101
(defthm gc1-r-dest-tm-dests-inst-use      ;; ok
 
2102
  (implies (and (and (transactionsp trs (nodesetgenerator params)) 
 
2103
                     (validparamsp params)))
 
2104
           (equal (r-dests 
 
2105
                   (computeresults 
 
2106
                    (genoc_t-non-tail-comp 
 
2107
                     (computetmissives trs) 
 
2108
                     (nodesetgenerator params) measure  '0 ntkstate order)))
 
2109
                  (m-dests 
 
2110
                   (tomissives 
 
2111
                    (extract-sublst 
 
2112
                     (computetmissives trs)
 
2113
                     (r-ids (computeresults 
 
2114
                             (genoc_t-non-tail-comp 
 
2115
                              (computetmissives trs)
 
2116
                              (nodesetgenerator params) 
 
2117
                              measure  '0 ntkstate order)))))))))
 
2118
 
 
2119
(defthm m-dest-t-dests-extract-sublst      ;; ok
 
2120
  (implies (and (subsetp ids (t-ids trs))
 
2121
                (validfields-t trs))
 
2122
           (equal (tm-dests (extract-sublst (computetmissives trs) ids))
 
2123
                  (t-dests (extract-sublst trs ids))))
 
2124
  :hints (("goal"
 
2125
           :do-not-induct t
 
2126
           :use (:instance tm-dests-computetmissives
 
2127
                           (trs (extract-sublst trs ids)))
 
2128
           :in-theory (disable tm-dests-computetmissives))))
 
2129
 
 
2130
 
 
2131
 
 
2132
(defthm tm-dests-compute-missives-extract-sublst-use
 
2133
  (implies (and (subsetp ids (t-ids trs)) 
 
2134
                (transactionsp trs nodeset))
 
2135
           (equal (t-dests (extract-sublst trs ids)) 
 
2136
                  (tm-dests  (extract-sublst  (computetmissives trs) ids))))
 
2137
  :rule-classes nil)
 
2138
 
 
2139
(defthm  m-dests-tm-dests  
 
2140
  (equal (m-dests (tomissives x))
 
2141
         (tm-dests x)))
 
2142
 
 
2143
(defthm m-dests-to-missives-compute-missives-extract-sublst-use
 
2144
  (implies (and (subsetp ids (t-ids trs)) 
 
2145
                (transactionsp trs nodeset))
 
2146
           (equal (t-dests (extract-sublst trs ids)) 
 
2147
                  (m-dests  (tomissives (extract-sublst
 
2148
                                         (computetmissives trs) 
 
2149
                                         ids)))))
 
2150
  :rule-classes nil)
 
2151
 
 
2152
(defthm m-dests-to-missives-compute-missives-extract-sublst-use-instance
 
2153
  (implies (and (transactionsp trs (nodesetgenerator params))
 
2154
                (validparamsp params))
 
2155
           (equal (t-dests 
 
2156
                   (extract-sublst 
 
2157
                    trs 
 
2158
                    (r-ids
 
2159
                     (computeresults 
 
2160
                      (genoc_t-non-tail-comp (computetmissives trs)
 
2161
                                             (nodesetgenerator params)
 
2162
                                             measure  '0 ntkstate order))))) 
 
2163
                  (m-dests  
 
2164
                   (tomissives (extract-sublst  
 
2165
                                (computetmissives trs) 
 
2166
                                (r-ids
 
2167
                                 (computeresults 
 
2168
                                  (genoc_t-non-tail-comp 
 
2169
                                   (computetmissives trs)
 
2170
                                   (nodesetgenerator params)
 
2171
                                   measure  '0 ntkstate order))))))))
 
2172
  :hints (("Goal"    
 
2173
           :use 
 
2174
           ((:instance m-dests-to-missives-compute-missives-extract-sublst-use 
 
2175
                       (nodeset (nodesetgenerator params))
 
2176
                       (ids (r-ids
 
2177
                             (computeresults 
 
2178
                              (genoc_t-non-tail-comp (computetmissives trs)
 
2179
                                                     (nodesetgenerator params)
 
2180
                                                     measure '0 ntkstate order)))))
 
2181
            (:instance tmissivesp-computetmissives 
 
2182
                       (nodeset (nodesetgenerator params)))
 
2183
            (:instance v-ids-genoc_t-non-tail-comp 
 
2184
                       (time '0) 
 
2185
                       (m (computetmissives trs)))))))
 
2186
 
 
2187
(defthm equality-to-test
 
2188
  (let ((nodeset (nodesetgenerator params)))
 
2189
    (mv-let (results aborted)
 
2190
            (genoc trs params params2 order)
 
2191
            (declare (ignore aborted))
 
2192
            (implies (and (transactionsp trs nodeset)
 
2193
                          (validstateparamsp params params2))
 
2194
                     (equal 
 
2195
                      (computeresults 
 
2196
                       (genoc_t-non-tail-comp (computetmissives trs)
 
2197
                                              (nodesetgenerator
 
2198
                                               params) 
 
2199
                                              (initial-measure (routing (computetmissives trs) (NodesetGenerator params))
 
2200
                                                               (NodesetGenerator params)
 
2201
                                                               (generate-initial-ntkstate trs (stategenerator params params2))
 
2202
                                                               order)
 
2203
                                              '0 
 
2204
                                              (generate-initial-ntkstate trs (stategenerator params params2))
 
2205
                                              order)) 
 
2206
                      results))))
 
2207
  
 
2208
  :hints (("Goal" 
 
2209
        :use 
 
2210
        (:instance 
 
2211
         m-dests-to-missives-compute-missives-extract-sublst-use-instance 
 
2212
         (ntkstate (stategenerator params params2))))))  
 
2213
 
 
2214
 
 
2215
(defthm genoc-is-correct            ;; ok
 
2216
  (let ((nodeset (nodesetgenerator params)))
 
2217
    (mv-let (results aborted)
 
2218
            (genoc trs params params2 order)
 
2219
            (declare (ignore aborted))
 
2220
            (implies (and (transactionsp trs nodeset)
 
2221
                          (validstateparamsp params params2))
 
2222
                     (genoc-correctness
 
2223
                      results
 
2224
                      (extract-sublst trs (r-ids results))))))
 
2225
  :otf-flg t
 
2226
  :hints (("goal" :do-not-induct t
 
2227
           :in-theory (disable equality-to-test len nfix  nth)
 
2228
           :use 
 
2229
           ((:instance all-frms-equal-r-msgs-t-msgs-instance-use )
 
2230
            (:instance  equality-to-test )
 
2231
            (:instance 
 
2232
             m-dests-to-missives-compute-missives-extract-sublst-use-instance
 
2233
             (ntkstate (generate-initial-ntkstate trs (stategenerator params params2)))
 
2234
             (measure (initial-measure (routing (computetmissives trs) (NodesetGenerator params))
 
2235
                                      (NodesetGenerator params)
 
2236
                                      (generate-initial-ntkstate trs (stategenerator params params2))
 
2237
                                      order)))))))
 
 
b'\\ No newline at end of file'