2

One of the most common bugs I make while implementing a program synthesizer with Rosette is using unlifted Racket constructs in an unsafe way that makes synthesizer to output (unsat).

In fact, as a beginner Rosette programmer, it is difficult to just pinpoint the unlifted Racket constructs that could be causing problems. I thought DrRacket may be able to help, for example, by not showing the arrows from the #lang rosette line to the unlifted Racket constructs such as assv, but it wasn't the case, i.e., it was displaying the arrows to both unlifted (e.g., assv) and lifted operators (e.g., first).

I've been using two strategies, (i) building synthesis code in rosette/safe as far as I can then switch to the full language, which is inconvenient since I can't use newer & fancier Racker constructs, and (ii) skim the constructs I use in my code and check whether they are "provided" by rosette/base/base.rkt, which is tiresome.

Any suggestions from seasoned Rosette programmers?

Mike Chung
  • 140
  • 7
  • In DrRacket, if a function is provided by racket, you can right-click on it and usually one of the menu items will be "View documentation for ___ from racket/base" if it's from Racket, or "View documentation for ___ from rosette/base/base" if it's from Rosette. This doesn't work for everything however. – Alex Knauth Dec 10 '18 at 03:37

1 Answers1

3

One approach is to start programming in rosette/safe and then require the constructs you need from Racket explicitly, as needed. Then if things go wrong, it will be easier to find out where and when they did.

So, for example, your code would look something like this:

   #lang rosette/safe

   (require (only-in racket for assv))

As your codebase grows, you can also collect all these imports into a single module that exports them. The rest of your code would then require that module, which would act as your custom version of rosette/safe plus the minimal amount of Racket constructs you need.

emina
  • 166
  • 2