Abstract-In many practical situations, we know the values of some quantities x1, . . . , xn, we know the relations between these quantities, the desired quantity y, and maybe some auxiliary quantities, and we want to estimate y. There exist automatic tools for such estimations -called program synthesis tools.A program synthesis tool usually generates a program for computing y. In many cases, however, several such programs are possible, and it is desirable to generate the optimal (e.g., the fastest) program. In this paper, we describe algorithms aimed at such optimal program synthesis.The problem can be interpreted in logical terms, as assigning fuzzy-style degrees to rules describing relations between variables.