Skip to content

Latest commit

 

History

History
214 lines (159 loc) · 8.74 KB

project.org

File metadata and controls

214 lines (159 loc) · 8.74 KB

Project setup

Redirect dante to the nix directory

I had setup .dir-locals.el to do this but dante still died for some reason

Hygiene

Explicit module exports

continuous integration

Hackage package

heroku server

Variational Solver

Performance

Store Ref (SRef SVal) in the state maps instead of the SBV a

the idea here is to avoid lots of pack and unpacking of these values. The average case has is way more lookups then generations, so when we lookup we don’t want any extra actions

NEXT Utilize the reader monad in sbv to season the solver

Issue: #7

  • Note taken on [2020-11-12 Thu 18:16]
    With the parallel version of vsmt we have to season the solver with the variational core. This means that we actually compute n IL’s where n is the number of threads. This is likely a small price to pay for the parallelism but could certainly be reduced. SBVs SymbolicT is a reader monad over IO but sbv doesn’t export the ReaderT type class instance, so in the main thread we can season, then grab the state with T.symbolicEnv but then there is no way for me to call local over the thread instances and thus no way to replace the thread states with the seasoned state. Hence, we are forced recompute the state for each thread with a call with toIL.

CANCELLED Add serialization for incremental incremental vsmt (may add this to sbv)

Not enough time left in phd for this

Use Earley to parse expressions

  • Note taken on [2020-11-12 Thu 14:32]
    Megaparsec is great but can have memory blow up if the parser isn’t exactly right, Early only parses context free grammars but you never have backtracking so it can be much much faster

Generate data during the parsing pass [0%]

  • Note taken on [2020-12-03 Thu 20:01]
    Right now I have an additional O(n) pass before generating the variational core
  • Note taken on [2020-12-03 Thu 20:00]
    We need to know the number of unique dimensions to know the maximum possible variants, this allows the solver to shut down

Number of choices

Number of variables

Number of unique dimensions

Remove CV’s from result maps and just construct the string to represent smtlib program

Optimizations

Constant Folding

Copy Propagation

If we find a statement like:

(assert (== x 2))

then do we perform propagation for x -> 2?

Result module

shallow embedded for ease of creating data on the fly

HOLD Server setup

HOLD REPL setup

Hackage documentation

IN PROG Solver

  • Note taken on [2020-12-22 Tue 12:53]
    We ran into a severe architectural issue with the async version of vsmt. The problem boils down to have to copy the base solver state for each alternative. sbv currently doesn’t have a way to do that so I added a freeze un-freeze strategy from the vector package, but the z3 state still messed up. There are two paths forward: 1. get sbv to return all the constants and asserstions to recreate the solver state, this is what is recommended by z3 devs and 2: use configurations to maintain the correct context for each thread. This last strategy is very brute force-y and essentially admits defeat.
  • Note taken on [2020-12-03 Thu 21:47]
    I tried to toggle debugging in the type system. It didn’t work because the channels are hard coded over the solver monad. If you try to paramterize it then we have problems with the has typeclass which now must be parameterized over the input to state. This looks like living with the redundancy is the easiest win for the remainder of the phd
  • Note taken on [2020-09-19 Sat 04:47]
    Massive changes to the internal model of the solver today. Most importantly I was liberated of several assumptions I had made from vsat. In vsat I moved all unary operators (just Not) into either symbolic terms or into choices. This worked well because there were never any edge cases where I would not be able to move a negation via a distributive property. In vsmt this is not the case, you may have a Not over and inequality that has complicated arithmetic in it and thus you cannot distribute the Not. Hence I combined the zipper I made yesterday to include boolean contexts. This greatly simplified the code base and made it much easier to reason about. I have check vsmt’s soundness up to ~700 random tests with propositions that only hold boolean terms. For a mix of arithmetic and boolean terms there are several problems: first is the quickcheck is creating propositions that aren’t satisfiable themselves and so the solver concludes unsat and the test fails, secondly I’ve had to filter out a lot of floats because they explode the search space and thus a check-sat call takes too much time. I’ve limited the solver to 15 seconds per check sat in the meantime. All things considered I’m very confident in the soundness of the solver now, i’m sure there are edge cases lurking in the arithmetic but these are likely too expensive to nail down and probably also exist in z3 and sbv.
  • Note taken on [2020-09-15 Tue 15:59]
    I noticed that evaluate’, the form of evaluate that works on arithmetics had type IL' -> IL'. This is strange because it is pure! Then I noticed that evaluate' was identical to accumulate' which makes sense because accumulation is pure symbolic evaluation. Hence I removed evaluate' in favor of accumulate' which is more accurate about the effects that are occurring
  • Note taken on [2020-09-15 Tue 02:36]
    Fixed the result accumulation. I employed a Maybe to wrap around the Variant Context. There needs to be hygiene work next, the code doesn’t read well and neither do the types. Which means that now I have a working implementation some refactoring is in order
  • Note taken on [2020-09-14 Mon 18:36]
    Solver core is working for up to two choices now. However, the result module is not accumulating results properly. There are several problems:
    1. mappend is erasing previous results
    2. We fundamentally need a way to demarcate between variables which are local to the assertion stack and those which are not
    3. the ite building is not occurring the linked list of return values

Boolean solving

Arithmetic smt solving

Variant Contexts can be used to limit the solver

  • Note taken on [2020-11-10 Tue 13:50]
    Quite easy actually, we spin up a second thread and use channels to send over a dimension asking the solver to check if the dimension is true in current context and then return the result

Investigate possible uses of StableName

  • Note taken on [2021-03-24 Wed 12:32]
    Tried to use StableNames to memoize accumulation. This is a no-go, the references in the sat solver are lost with stable names and the memoization is too expensive without StableNames to use on ASTs

Investigate possible uses with IORef patterns

  • Note taken on [2021-03-24 Wed 12:33]
    I tried IORef’s vs STM and found no difference between then for this workload. Going to stick with STM which has a better interface

Testing

hedgehog properties vs quickcheck properties

Tasty setup and harness

Quickcheck/smallcheck generators

Quickcheck/smallcheck properties

  • Note taken on [2021-03-24 Wed 12:34]
    Newtype wrapper for only booleans is done
  • Note taken on [2020-09-19 Sat 14:39]
    soundness is setup and working but we need newtype wrappers instead of predicates, see #4

Good Properties to prove

A variational core is at most a single unreducible operator, a symbolic and a choice

Parser roundtripping

Mathematical equivalences which should always hold

Boolean equivalences which should always hold

Benchmarking

Gauge setup

bench-show

Variational String generator

Use the text-metrics package

link: http://hackage.haskell.org/package/text-metrics-0.3.0/docs/Data-Text-Metrics.html