Logic Folding