Giter Site home page Giter Site logo

rosette-sketch-interpreter's Introduction

SemGuS solvers with Rosette and Sketch

This repository contains my work in creating a SemGuS solver based in Rosette and Sketch. Each are designated into their own C# project directories. Note that they use the parser as a dependency and at the moment it requires that the SemGuS-Parser directory exist directly outside this repository.

Running

cd src/RosetteSolver
dotnet run <path-to-example-sem-file.sem> <output.rkt>

Current limitations

Firstly, the SketchSolver is not in the repository anymore, I had a prototype at one point but then I updated to use a newer format so it is no longer applicable. It was never functional anyway.

Secondly, I will outline some of the limitations with the RosetteSolver. Currently, the only two examples which it can synthesize to a compiling Racket/Rosette module are mul-impv.sem and max-exp.sem. Of the two, only max-exp.sem generates a correct solution. mul-impv.sem runs out of time/memory.

The other impv tests don't compile just because in order to handle assigment to multiple variables, the solver invokes a helper function which was specifically made for the S nonterminal in mul-impv.sem. It just needs to be generated based on the number of input and output variables for a given nonterminal, which should be relatively easy to do.

None of the regex tests work at the moment because the solver lacks the ability to handle more than two semantic rules in one production. The SemGuS format allows multiple semantic rules mainly for things like conditionals in a while loop or if statement, which looks something like this:

 (($while (B b.t1) (S s.t1))
            (and
                (B.Sem b.t1 x0 y0 c0 b.v1)
                (= b.v1 true)                  ; Condition evaluates to true under G0
                (S.Sem s.t1 x0 y0 c0 x1 y1 c1) ; G0 -> G1: assign G1 by evaluating s on G0
                (S.Sem s.t  x1 y1 c1 x2 y2 c2) ; G1 -> G2: assign G2 by evaluating t on G1
            )
            (and
                (B.Sem b.t1 x0 y0 c0 b.v1)
                (= b.v1 false)                 ; Condition evaluates to false under G0
                (= x2 x0) (= y2 y0) (= c2 c0)  ; G2 := G0; do not execute s
            )
        )

The solver supports this kind of structure, but it breaks down for more than two, which in the regex examples is used to model a switch-case sort of flow. It is theoretically easy to add this, it just has to break into an if-else ladder with if Racket statements.

rosette-sketch-interpreter's People

Contributors

panther03 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.