INNER CODE UNIT · Python

Gen

stp/stp · scripts/fuzz/uf-differential-fuzz.py:35

class Gen:
    def __init__(self):
        self.widths = rng.choice([[2], [2, 3], [3, 4], [2, 8]])
        self.nvars = rng.randint(2, 4)
        self.vars = []   # (name, sort) sort: int width or 'bool'
        for i in range(self.nvars):
            sort = rng.choice(self.widths + ['bool'])
            self.vars.append(("v%d" % i, sort))
        self.funcs = []  # (name, [domain sorts], codomain)
        for i in range(rng.randint(1, 2)):
            arity = rng.randint(1, 2)
            dom = [rng.choice(self.widths + ['bool']) for _ in range(arity)]
            cod = rng.choice(self.widths + ['bool'])
            self.funcs.append(("f%d" % i, dom, cod))
        self.apps = []   # (func index, [arg terms]) -> recorded at build
        self.use_define = rng.random() < 0.3
        self.use_let = rng.random() < 0.3

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…