source: CIVL/mods/dev.civl.sarl/notes/sarl-notes.txt@ 1aaefd4

main test-branch
Last change on this file since 1aaefd4 was aad342c, checked in by Stephen Siegel <siegel@…>, 3 years ago

Performing huge refactor to incorporate ABC, GMC, and SARL into CIVL repo and use Java modules.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5664 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 9.3 KB
Line 
1Cycle when there is a lambda formula as a key in the RangeMap.
2
3in the process of forming a subcontext in which the parent context contains
4a rangeMap with a lambda formula key:
5
6the reduction of the range map goes through and simplifies each key.
7But it does not remove the key when it is being simplified.
8In the process of simplifying it collapses the sub-context.
9This entails forming a new Context with the same range map as the original parent.
10THis entails simplifying the key, which creates a new subcontext with the range map...
11
12
13
14Cycle in call stack:
15divideTest1:
16
17SubContext.init
18Context.initialize, addFact, extractOr, addSub, simplify
19IdealSimplifierWorker.simplifyExpressionWork, simplifyBoolean
20SubContext.init
21
22
23
24simplifyBoolean checks seenBefore, but seenBefore ignores
25 a context if it's not initialized. None of these contexts are.
26 Why?
27
28Context.simplify flattens "this" context, the result in this case
29is just "true". There is no deep hierarchy of context and no way
30to recognize the cycle.
31
32Why do we need to create a subcontext? How do we stop from doing
33it twice?
34
35
36
37
38
39
40
41extract(expression, context) : modifies context based on information
42 in expression.
43
44simplify(context, expression) : Expression
45 returns simplified version of expression based on context.
46
47
48for i=1..n
49 C = new context;
50 for j in 1..n-{i} :
51 extract(p_j, C);
52 p_i <- simplify(C,p_i)
53
54
55Example: (p||q)&&p
56
57123456
58
59
60Only efficient way is to REMOVE one element at a time
61from the context and simplify it, then put it back.
62That takes care of the "and" problem.
63
64But how to simplify the assumption? This won't work.
65Unless you know the context is equivalent to the
66assumption.
67
68
69-----
70
71
72Figure out how to simplify "and".
73Then to simplify or
74
75simplify(or(p_i)) = not simplify(and(not p_i))
76
77
78---
79
80To simplify and:
81Create a new context.
82same method used to addSub
83(and reduce the subMap).
84BUT: the "simplify" method should use union
85of the original (outer) context and this.
86
87simplify(C0, AND(p_i)):
88Let C1=C0
89
90make an interface for Context that can be used
91by the SimplifierWorker. The interface would
92only have get methods that are needed to perform
93simplification
94
95make two different kinds of Context.
96
97
98
99----------------------------------------------
100
101Schwartz Zippel Lemma:
102
103Single point version:
104
105Multipoint version:
106
107
108# of roots over the set T^n (n=9 for us) is at most d*|T|^(n-1), where d is
109the total degree of the polynomial.
110
111prob of getting root: d/|T| < e
112|T|>d/e
113
114e=10^{-1000}
115
116|T|=2^32
117
118d*2^{-32} is prob of getting 0 if it is non-0
119(d*2^{-32})^k is upper bound on prob. of it being non=0 after k applications
120
121
122
123
124
125
126
127
128
129----------------------------------------------
130
131
132
133
134
135subsumption:
136
137if a is a subset of b and a preceded b in dictionary order
138then a is a prefix of b
139
140if a is a subset of b then size(a)<size(b)
141
142
1431 4 6 7 8
1441 4 6 7 8 9
1451 4 6 7 8 10
1461 4 6 7 9
1472 3 4
1482 5 8 10
1494 7 8 : determine if I am subset of any of above?
150
151
152Step 1:
153make concrete arrays instances of HomogeneousExpression<SymbolicExpression>
154
155Re-factor expressions/objects
156
157CURRENT:
158Symbolic Objects:
159current fields: kind, hashCode, hashed, id, order (5)
160current kinds of objects:
161BOOLEAN, CHAR, INT, NUMBER, STRING : make these primitive SymbolicExpressions
162TYPE, TYPE_SEQUENCE
163EXPRESSION_COLLECTION
164EXPRESSION
165
166NEW:
167
168 interface SymbolicObject
169 objectKind(): SymbolicObjectKind
170 objectCategory(): TYPE, EXPRESSION, SEQUENCE, INT
171 interface SymbolicType extends SymbolicObject
172 interface Sequence<T> extends SymbolicObject
173 interface SymbolicExpression extends SymbolicObject
174 interface IntObject extends SymbolicObject
175
176 class CommonObject implements SymbolicObject [hashCode, id]
177 class CommonSymbolicType extends CommonObject
178 class CommonSequence<T> extends SymbolicSequence<T>
179
180
181fields: hashCode, id (2)
182put hashed in id field:
183 id=-2: not hashed
184 id=-1: hashed, but not canonic
185 id=0,1,2,... : canonic
186the object kind can be obtained by a method (not in field)
187equals: compare kinds, then go straight to the intrinsicEquals
188compare: can't just order by kind?
189hashCode:
190
191New kinds of objects:
192TYPE : a type, instanceof SymbolicType
193EXPRESSION : something representing a value, instanceof SymbolicExpression
194SEQUENCE : a sequence of objects of some kind, instanceof SequenceObject
195INT : a Java int
196
197interface SymbolicExpression: represents a value
198 type(): SymbolicType
199 kind(): ExpressionKind
200 getArguments(): SymbolicObject[]
201 numArguments(): int
202 argument(int): SymbolicObject
203NOTE: not every symbolic expression is completely determined by the
204operator, type, and arguments. In particular, these are not:
205
206The following kinds of expressions have 0 args:
207CHAR: interface CharObject extends SymbolicExpression: getChar()
208STRING: interface StringObject extends SymbolicExpression: getString()
209BOOLEAN: interface BooleanObject extends SymbolicExpression: getBoolean()
210NUMBER: interface NumberObject extends SymbolicExpression: getNumber()
211
212The following kind of SymbolicExpression is completely determined by
213operator, type, and arguments:
214
215interface HomogeneousExpression<T extends SymbolicObject> extends SymbolicExpression
216 getArguments(): T[]
217 arguments(): Iterable<T>
218 argument(int): T
219
220
221Other SymbolicExpressions have a positive number of arguments
222ADD, MULTIPLY, etc.
223DENSE_ARRAY_WRITE (keep track of NULLs)
224 - make it a special class with its own fields (numNulls)
225APPLY
226
227Tuple types, function types may also have SEQUENCE objects.
228
229----
230
231
232Design:
233
234universe
235 uses: reason, preuniverse
236
237reason
238 uses: simplify, prove, ....
239
240herbrand
241 uses: like ideal?
242
243ideal
244 uses: simplify, prove, ...
245 ideal.simplify uses preuniverse
246
247prove
248 uses: IF, cvc3, expr,
249 preuniverse (to build expressions)
250
251simplify
252 uses: IF, type, expr, object,
253 preuniverse (by CommonSimplifier)
254
255preuniverse: everything in universe except reasoning
256 uses: expr, type, collections, object, number, util, IF
257
258expr
259 uses: IF
260 object
261 collections
262 type
263
264type
265 uses: IF (expr array len),
266 object
267
268collections
269 uses: IF
270 object
271
272object: symbolic objects
273 uses: IF
274 collections (SymbolicCollection for comparator): CHANGE!
275
276number: arbitrary-precision integer and real numbers
277 uses: IF (IF.number)
278
279util: utility classes
280 uses: nothing
281
282IF: public interface
283 uses: nothing
284 comprises:
285 IF.SymbolicUniverse
286 IF.Reasoner
287 IF.ValidityResult
288 IF.ModelResult
289 IF.SARLException, IF.SARLInternalException, IF.TheoremProverException
290 IF.expr
291 IF.number
292 IF.object
293 IF.type
294
295--------------------
296
297Design issues:
298
299 - massive duplication between SymbolicUniverse and PreUniverse
300 - cyclic dependency object<-->collections
301
302--------------------
303
304Heaps:
305
306/** This is the type for head IDs. Every heap has an unchanging
307 * heap ID. As objects are added or removed from the heap, the
308 * heap expression itself changes, but the underlying heap ID
309 * is constant. References to heap objects always include the
310 * heap ID indicating to which heap the reference points. This
311 * is necessary so that when we canonicalize a heap, we can
312 * determine which references refer to that heap and therefore
313 * must be updated. */
314SymbolicType heapIdType();
315
316/** This is the type of a heap. */
317SymbolicType heapType();
318
319/** Returns the incomplete reference type, which is a super-type
320 * of all reference types. Situation is analogous to array types.
321 */
322SymbolicType referenceType();
323
324/** Returns type "reference-to-T", where T is the given type.
325 * This is a complete reference type. */
326SymbolicType completeReferenceType(SymbolicType type);
327
328/** Returns a heap ID which simply wraps the given string object.
329 * Two heapIds with equal names are equal. */
330SymbolicExpression heapId(StringObject name);
331
332/** Returns the empty heap with the given heap ID. */
333SymbolicExpression emptyHeap(SymbolicExpression heapId);
334
335/** Allocates an object on the heap. Returns a pair: the first
336 * component is the new heap, the second is reference to the new
337 * object in the new heap. */
338Pair<SymbolicExpression,SymbolicExpression>
339 malloc(SymbolicExpression heap, SymbolicType type);
340
341/** Given an expression of heap type, returns
342 * the heap ID; given an expression of reference type, returns
343 * the heap ID of the referenced heap. */
344SymbolicExpression heapIdOf(SymbolicExpression expr);
345
346/** Deallocates an object on the heap. Given a heap and a reference
347 * to an element on the heap, returns the new heap which is obtained
348 * by removing the referenced object from the original. Result
349 * is undefined if heapIdOf(ref) does not equal heapIdOf(heap).
350 */
351SymbolicExpression free(SymbolicExpression heap, SymbolicExpression ref);
352
353/** Dereferences a reference to the heap. The given ref must
354 * have a complete reference type, say "reference-to-T". The type
355 * of the expression returned will then be T. The heaps ID of
356 * the ref and the heap must be equal. */
357SymbolicExpression dereference(SymbolicExpression heap,
358 SymbolicExpression ref);
359
360/** Canonicalize heap.
361 * Given a heap and a collection of expressions, returns a pair.
362 * The first component of the pair is the new heap, the second
363 * element is the collection obtained by updating all references
364 * to objects in the given heap to their new values. */
365Pair<SymbolicExpression, SymbolicCollection<SymbolicExpression>>
366 canonic(SymbolicExpression heap,
367 SymbolicCollection<SymbolicExpression>> expressions);
Note: See TracBrowser for help on using the repository browser.