Tractables/Dice.jl

what size to pass here?

Closed this issue · 1 comments

https://github.com/Juice-jl/Dice.jl/blob/f9d123ba3faaa2ae2079bb9f62df7fc23b56cfa5/examples/qc/benchmarks/lib/stlc/generator.jl#L109

        end
    )
end

function tb_gen_expr(sz::Integer, track_return)
    track_return(
        if sz == 0
            @dice_ite if flip(register_weight!("sz$(s)_pvar"))
                DistVar(0) # really, this is arbitrary
            else
                DistBoolean(true) # really, this is arbitrary
            end
        else
            sz′ = sz - 1
            frequency_for("sz$(s)", [
                DistVar(0), # really, this is arbitrary
                DistBoolean(true), # really, this is arbitrary
                begin
                    typ = tb_gen_type(2, track_return) # TODO: what size to pass here?
                    e = tb_gen_expr(sz′, track_return)
                    DistAbs(typ, e)
                end,
                begin
                    e1 = tb_gen_expr(sz′, track_return)
                    e2 = tb_gen_expr(sz′, track_return)
                    DistApp(e1, e2)
                end,
            ])
        end
    )
end

function tb_gen_type(sz::Integer, track_return)
    track_return(
        if sz == 0
            DistTBool()
        else
            sz′ = sz - 1
            @dice_ite if flip(register_weight!("tysz$(s)_ptbool"))
                DistTBool()
            else
                ty1 = tb_gen_type(sz′, track_return)
                ty2 = tb_gen_type(sz′, track_return)
                DistTFun(ty1, ty2)
            end
        end
    )
end