title: Where might I find a method to convert an arbitrary boolean expression into conjunctive or disjunctive normal form?
body: <p>I've written <a href="https://bitbucket.org/BillyONeal/pevfind/overview" rel="noreferrer">a little app</a> that parses expressions into abstract syntax trees. Right now, I use a bunch of heuristics against the expression in order to decide how to best evaluate the query. Unfortunately, there are examples which make the query plan extremely bad.</p>
  
  <p>I've found a way to provably make better guesses as to how queries should be evaluated, but I need to put my expression into CNF or DNF first in order to get provably correct answers. I know this could result in potentially exponential time and space, but for typical queries my users run this is not a problem.</p>
  
  <p>Now, converting to CNF or DNF is something I do by hand all the time in order to simplify complicated expressions. (Well, maybe not <em>all the time</em>, but I do know how that's done using e.g. demorgan's laws, distributive laws, etc.) However, I'm not sure how to begin translating that into a method that is implementable as an algorithm. I've looked at papers on query optimization, and several start with "well first we put things into CNF" or "first we put things into DNF", and they never seem to explain their method for accomplishing that.</p>
  
  <p>Where should I start?</p>