How to add tri-state checkboxes to form created with Form API?
From what I understand, the indeterminate property of a checkbox is purely a visual thing, and also cannot be set with HTML, which in turn means that you won't be able to use the FormAPI or create an indeterminate element without JavaScript.

Chris Coyier sets out some example situations though in this blog post, but an important quote is below (in case the post goes down).


  Here are some things to know about indeterminate checkboxes:
  
  You can't make a checkbox indeterminate through HTML. There is no
  indeterminate attribute. It is a property of checkboxes though, which
  you can change via JavaScript.


I should imagine you could probably use Drupal.settings to your advantage here though, and run the check server-side for "true for some children", and pass an array of ID's through to Drupal.settings. Following that run something like the following in a Drupal behaviour:

 // This is an array of IDs
 trueForSomeChildren = Drupal.settings.myModule.trueForSomeChildren;

 $(trueForSomeChildrenjoin(', ')).attr("indeterminate", true);


Howeverm I don't think there's an already-built module to do what you want. There is a patch here for the FacetAPI where they allow for indeterminate, but it kind of follows this example.