• Stars
    star
    109
  • Rank 319,077 (Top 7 %)
  • Language
    Racket
  • Created over 7 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Some fun examples of solving problems with symbolic execution
             o--o                        o                 o 
             |   |                       |  o              | 
             O-Oo  o-o  o-o o-o o-o  oo -o-   o-o o-o   oo | 
             |  \  |-' |    |   |-' | |  |  | | | |  | | | | 
             o   o o-o  o-o o   o-o o-o- o  | o-o o  o o-o-o 
                                                             
                                                             
                      o--o               o   o      
                      |   |              |   |      
                      O-Oo  o-o o-o o-o -o- -o- o-o 
                      |  \  | |  \  |-'  |   |  |-' 
                      o   o o-o o-o o-o  o   o  o-o 


In CS and in life, it is often easier to make the rules than it is to find a
way to follow them. It is much easier to explain the game of Sudoku to a
beginner than it is to solve a difficult puzzle yourself; it is much easier to
critique a dish than it is to cook; it is much easier to describe a good human
being than it is to be one.

Surprisingly, however, it turns out that sometimes a problem's description (in
the form of a solution-checking program) is all you need to get a solution! For
some problems, with some cleverness, we can automagically turn solution-checker
into a solution-finder; that is, we can turn a metaphorical critic into a
metaphorical chef.

Rosette [0] is a language in which we can define solution-checkers for our
problems. On the surface, a Rosette program is an ordinary Scheme (well,
Racket) program, and indeed you can run your Rosette program with a purported
"solution" to check whether or not it solves your problem.

The magic is that we can run Rosette programs without any input at all. Using
some clever tricks, Rosette can work backwards from your checker and invent a
brand-new input that will pass all of your checks. That is, once you have
written a Sudoku-checker, you can get a Sudoku-solver for free!

Internally, Rosette works by converting your Racket checks into a very large
Boolean circuit, and then using a highly-optimized SAT solver to find
true-or-false values for each variable in the circuit. Rosette then converts
the SAT solver's solution back into Racket-ey values.

Yes, there are scalability and efficiency concerns. Some problems are hard to
find solutions to. Some of those problems are inherently tricky -- you can't
reverse hashes with Rosette. Other problems can be rewritten to be easier for
Rosette to solve, though it may not be obvious how to do this.

But for small problems, this is rarely an issue! Computers are fast these days:
even an inefficient program to solve a small problem can run fast enough to be
practical. That is why I find Rosette exciting: because, at least in my toy
domains, it lets me think about programming as a way to specify a problem
rather than a solution.

This repository, then, contains some small examples of small problems, where a
small solution-checker is all that is needed to get Rosette to find a small
solution.

Enjoy!

[0] http://emina.github.io/rosette/

More Repositories

1

nearley

📜🔜🌲 Simple, fast, powerful parser toolkit for JavaScript.
JavaScript
3,584
star
2

gradient-descent-the-ultimate-optimizer

Code for our NeurIPS 2022 paper
Python
359
star
3

tower-of-power

What is hip? Tell me, tell me (if you think you know)
Python
108
star
4

memo

A language for mental models
Jupyter Notebook
28
star
5

designing-perceptual-puzzles-by-differentiating-probabilistic-programs

Supplementary materials for our SIGGRAPH 2022 paper
Jupyter Notebook
27
star
6

shabdle

Shabdle is Wordle in Hindi
Mathematica
24
star
7

neural-ambigrams

Generating digits that are secretly *other* digits doing handstands
HTML
19
star
8

acting-as-inverse-inverse-planning

Code for our SIGGRAPH 2023 paper, "Acting as Inverse Inverse Planning"
Jupyter Notebook
16
star
9

chaos-game-fractal-foliage

Code for "Learning to Play the Chaos Game: Dreaming of fractal foliage by differentiating iterated function systems"
Jupyter Notebook
14
star
10

Snapin8r

A Scratch 2.0->Snap! converter
JavaScript
13
star
11

eddie

An automatic first-order theorem prover in Haskell
Haskell
12
star
12

emo.7

The man page for emoticons.
Groff
9
star
13

torchsaber

Elegant dimensions for a more civilized age
Python
8
star
14

kesar

A Python library for quickly building human subject studies
Python
8
star
15

shock

It's simple… it's static… it's shock!
JavaScript
8
star
16

jigsaw

An Escher-esque jigsaw puzzle generator
Standard ML
8
star
17

prufrock

A literary proof assistant built on the affine calculus of inductive constraints
Standard ML
8
star
18

gifblocks

Make animated GIFs from your Scratch projects!
HTML
8
star
19

haskell-lambda-calculus

A simple lambda calculus interpreter in Haskell.
Haskell
7
star
20

hamelin

Revenge of the The Py'd Piper
Python
7
star
21

lowtex

Low-tech text processing
JavaScript
7
star
22

baobab

Interactive Fiction with Racket and love
JavaScript
6
star
23

voxel

Yet another raytracer, because we don't have enough of those already
Scheme
5
star
24

sublime-nearley

A nearley syntax plugin for TextMate/Sublime Text
Makefile
5
star
25

softraxterizer

A small softras implemented in JAX
Python
4
star
26

hell

Because http://xkcd.com/724/
JavaScript
4
star
27

hootow-hyperlapse

Using classic computer vision algorithms to align hundreds of images of Hoover Tower
Jupyter Notebook
4
star
28

quackoverflow

Meow.
JavaScript
3
star
29

boxcars

Lively box-and-pointer diagrams for Racket.
Racket
3
star
30

bellhop

A simple, informative bell schedule app.
JavaScript
3
star
31

optimally-framing-roger-rabbit

accelerating accelerators with differentiable kD-trees
Python
3
star
32

englipsum

Usable loremtext
JavaScript
2
star
33

Legible

Regexes for Humans
JavaScript
2
star
34

Human

Humanist documentation
Python
2
star
35

ketchup

A temporal RSS proxy
JavaScript
2
star
36

turtlegrad

Bidirectional programming by gradient descent
JavaScript
2
star
37

scotty

Specify Characters On a TTY - Readline for binary input
C
2
star
38

watchat

Racket
2
star
39

jeopardy-wagering-under-uncertainty

Python
1
star
40

indexme

Quick, portable, versatile directory listing generator
Shell
1
star
41

jokebot

A simple demo IRC bot in Python
Python
1
star
42

poison-ivy

Create a graphical representation of dependency relationships between Ivy conjectures.
Python
1
star
43

generative-adversarial-web-development

Substance… and style!
HTML
1
star
44

lagrange-climbs-a-hill

Interpolating Lagrangian mechanics by AD and gradient descent
Python
1
star
45

bentley-blizzard-blossoms

A frosty MNIST alternative :)
Jupyter Notebook
1
star