Reason maintenance systems and their applications