Advertisement
Guest User

Untitled

a guest
Oct 5th, 2015
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 KB | None | 0 0
  1. 231 struct vm {
  2. 232 typedef list<res*> eq; // "cols"
  3. 233 list<eqs> eqs; // "rows"
  4. 234 // function apply(x,y): try to put x,y at the same row and keep the state valid,
  5. 235 // means: require them to be equal.
  6. 236 // rules of state validation:
  7. 237 // 1. all rows must contain at most one nonvar
  8. 238 // 2. nonvars must be the first element in a row
  9. 239 // 3. once element was put in a row, it cannot be moved
  10. 240 // 4. every element appears at most once in at most one row
  11. 241 //
  12. 242 // a row that begins with a nonvar will be called an
  13. 243 // unbounded row. note that the res* pointers (for vars
  14. 244 // or nonvars) are ever dereferenced, serve only as a unique id.
  15. 245 // all comparisons are done by comparing those addresses.
  16. 246 //
  17. 247 // given we have a valid state and we want to update
  18. 248 // another equality condition x=y, we have to execute
  19. 249 // the following function, called apply(x,y):
  20. 250 // 1. if x already appears in row n:
  21. 251 // 1.1 if y never appears
  22. 252 // 1.1.1 if y is a nonvar
  23. 253 // 1.1.1 if the row n is unbounded, add y to the head of row n
  24. 254 // 1.1.2 if the row n is bounded, fail.
  25. 255 // 1.1.2 if y is a var, append it to row n.
  26. 256 // 1.2 if y appears at row k
  27. 257 // 1.2.1 if n==k, return success.
  28. 258 // 1.2.2 if rows n,k are both bounded, fail.
  29. 259 // 1.2.3 append all items of the unbounded row to the bounded one
  30. 260 // and delete the old unbounded row. if both rows are unbounded,
  31. 261 // append into row min(n,k). return success.
  32. 262 // 2. if x never appears
  33. 263 // 2.1 if y never appears, put x,y in a new row and return success.
  34. 264 // otherwise, let n by y's row.
  35. 265 // 2.2 if x is a var or row n is unbounded, append x to row n and return success.
  36. 266 // 2.3 fail
  37. 267 bool apply(res* x, res* y) {
  38. 268
  39. 269 }
  40. 270 };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement