1
; Copyright (C) 2000 Panagiotis Manolios
3
; This program is free software; you can redistribute it and/or modify
4
; it under the terms of the GNU General Public License as published by
5
; the Free Software Foundation; either version 2 of the License, or
6
; (at your option) any later version.
8
; This program is distributed in the hope that it will be useful,
9
; but WITHOUT ANY WARRANTY; without even the implied warranty of
10
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
; GNU General Public License for more details.
13
; You should have received a copy of the GNU General Public License
14
; along with this program; if not, write to the Free Software
15
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
; Written by Panagiotis Manolios who can be reached as follows.
19
; Email: pete@cs.utexas.edu
22
; Department of Computer Science
23
; The University of Texas at Austin
24
; Austin, TX 78701 USA
29
This is a set of macros for relating an abstract system and a concrete
30
system with a WEB. The systems are deterministic.
34
(defun bor-macro (lst)
35
(declare (xargs :guard t))
41
(bor-macro (cdr lst)))
45
(defmacro bor (&rest args)
48
; The reason for the bor macro is that (or a b) gets expanded to (if a
49
; a b). This results in extra rewriting in many situations. bor is
50
; equivalent to or if all the arguments are booleans.
52
; Generate-Full-System is given abs-step, the function that steps the
53
; abstract system for one step, abs-p, the predicate that recognizes
54
; abstract states, con-step, the function that steps the concrete
55
; system for one step, con-p, the predicate that recognizes concrete
56
; states, and con-rank, the rank of a concrete state. Note that I am
57
; assuming that the step of abstract and concrete states depends only
58
; on the state. There may be situations in which this is not the
59
; case. If so, use the non-deterministic versions of these macros.
60
; Also, I am assuming that the rank of abstract states is 0. This may
61
; also not be the case in general. R, B, and rank should be
64
(defmacro generate-full-system (abs-step abs-p con-step con-p
65
con-to-abs good-con con-rank)
69
(declare (xargs :normalize nil))
73
(equal x (,con-to-abs y))))
76
(declare (xargs :normalize nil))
84
(equal (,con-to-abs x)
88
(declare (xargs :normalize nil))
94
(declare (xargs :normalize nil))
96
(equal y (,abs-step x)))
97
(t (equal y (,con-step x)))))
101
(local (in-theory nil))
108
(equal x (,con-to-abs y))))
109
:hints (("goal" :by Wf-rel))
110
:rule-classes ((:forward-chaining :trigger-terms ((Wf-rel x y)))))
121
(equal (,con-to-abs x)
123
:hints (("goal" :by B))
124
:rule-classes ((:forward-chaining :trigger-terms ((B x y)))))
131
:hints (("goal" :by rank))
132
:rule-classes ((:forward-chaining :trigger-terms ((rank x)))))
137
(equal y (,abs-step x)))
138
(t (equal y (,con-step x)))))
139
:hints (("goal" :by R))
140
:rule-classes ((:forward-chaining :trigger-terms ((R x y)))))
145
(defmacro prove-web (abs-step abs-p con-step con-p con-to-abs con-rank)
147
(defthm B-is-a-WF-bisim-core
148
(let ((u (,abs-step s))
150
(implies (and (WF-rel s w)
153
(e0-ord-< (,con-rank v)
156
(in-theory (disable b-is-a-wf-bisim-core))
158
(defthm con-to-abs-type
159
(,abs-p (,con-to-abs x)))
161
(defthm abs-step-type
162
(,abs-p (,abs-step x)))
164
(defthm con-step-type
165
(,con-p (,con-step x)))
175
(defmacro wrap-it-up (abs-step abs-p con-step con-p good-con con-to-abs con-rank)
181
(local (in-theory nil))
183
(local (in-theory (enable abs-step-type con-step-type con-not-abs abs-not-con
186
b-is-a-wf-bisim-core)))
190
:by (:functional-instance
191
encap-B-is-an-equivalence
193
(encap-abs-step ,abs-step)
195
(encap-con-step ,con-step)
197
(encap-con-to-abs ,con-to-abs)
198
(encap-good-con ,good-con)
199
(encap-con-rank ,con-rank)
201
(encap-wf-rel wf-rel)
204
(defthm rank-well-founded
205
(e0-ordinalp (rank x)))
207
(defun-weak-sk exists-w-succ-for-u-weak (w u)
212
(defun-weak-sk exists-w-succ-for-s-weak (w s)
216
(e0-ord-< (rank v) (rank w)))))
220
(local (in-theory nil))
222
(defthm exists-w-succ-for-u-weak-fc
223
(implies (and (R w v)
225
(exists-w-succ-for-u-weak w u))
226
:hints (("goal" :by exists-w-succ-for-u-weak-suff))
227
:rule-classes ((:forward-chaining
228
:trigger-terms ((r w v) (b u v)
229
(exists-w-succ-for-u-weak w u)))))
231
(defthm exists-w-succ-for-s-weak-fc
232
(implies (and (R w v)
234
(e0-ord-< (rank v) (rank w)))
235
(exists-w-succ-for-s-weak w s))
236
:hints (("goal" :by exists-w-succ-for-s-weak-suff))
237
:rule-classes ((:forward-chaining
238
:trigger-terms ((r w v) (b s v)
239
(exists-w-succ-for-s-weak w s))))))
241
(local (in-theory nil))
243
(local (in-theory (enable abs-step-type con-step-type con-not-abs abs-not-con
245
exists-w-succ-for-s-weak-fc exists-w-succ-for-u-weak-fc
246
R-fc Wf-rel-fc B-fc rank-fc
247
b-is-a-wf-bisim-core)))
249
(defthm b-is-a-wf-bisim-weak
250
(implies (and (b s w)
252
(or (exists-w-succ-for-u-weak w u)
254
(e0-ord-< (rank u) (rank s)))
255
(exists-w-succ-for-s-weak w s)))
257
:by (:functional-instance
260
(encap-abs-step ,abs-step)
262
(encap-con-step ,con-step)
264
(encap-con-to-abs ,con-to-abs)
265
(encap-good-con ,good-con)
266
(encap-con-rank ,con-rank)
269
(encap-wf-rel wf-rel)
273
(encap-exists-w-succ-for-u exists-w-succ-for-u-weak)
274
(encap-exists-w-succ-for-s exists-w-succ-for-s-weak))))
277
(defun-sk exists-w-succ-for-u (w u)
282
(defun-sk exists-w-succ-for-s (w s)
286
(e0-ord-< (rank v) (rank w)))))
288
(local (in-theory nil))
289
(local (in-theory (enable exists-w-succ-for-s-suff exists-w-succ-for-u-suff)))
291
(defthm b-is-a-wf-bisim
292
(implies (and (b s w)
294
(or (exists-w-succ-for-u w u)
296
(e0-ord-< (rank u) (rank s)))
297
(exists-w-succ-for-s w s)))
299
:by (:functional-instance
302
(exists-w-succ-for-u-weak exists-w-succ-for-u)
303
(exists-w-succ-for-s-weak exists-w-succ-for-s))))