AGATHA: Using heuristic search to automate the construction of case law theories