src/ZF/Tools/ind_cases.ML
changeset 18678 dd0c569fa43d
parent 18418 bf448d999b7e
child 18708 4b3dadb4fe33
equal deleted inserted replaced
18677:01265301db7f 18678:dd0c569fa43d
    33 
    33 
    34 fun declare name f = IndCasesData.map (Symtab.update (name, f));
    34 fun declare name f = IndCasesData.map (Symtab.update (name, f));
    35 
    35 
    36 fun smart_cases thy ss read_prop s =
    36 fun smart_cases thy ss read_prop s =
    37   let
    37   let
    38     fun err () = error ("Malformed set membership statement: " ^ s);
    38     fun err msg = cat_error msg ("Malformed set membership statement: " ^ s);
    39     val A = read_prop s handle ERROR => err ();
    39     val A = read_prop s handle ERROR msg => err msg;
    40     val c = #1 (Term.dest_Const (Term.head_of (#2 (Ind_Syntax.dest_mem (FOLogic.dest_Trueprop
    40     val c = #1 (Term.dest_Const (Term.head_of (#2 (Ind_Syntax.dest_mem (FOLogic.dest_Trueprop
    41       (Logic.strip_imp_concl A)))))) handle TERM _ => err ();
    41       (Logic.strip_imp_concl A)))))) handle TERM _ => err "";
    42   in
    42   in
    43     (case Symtab.lookup (IndCasesData.get thy) c of
    43     (case Symtab.lookup (IndCasesData.get thy) c of
    44       NONE => error ("Unknown inductive cases rule for set " ^ quote c)
    44       NONE => error ("Unknown inductive cases rule for set " ^ quote c)
    45     | SOME f => f ss (Thm.cterm_of (Theory.sign_of thy) A))
    45     | SOME f => f ss (Thm.cterm_of (Theory.sign_of thy) A))
    46   end;
    46   end;