list_to_set_comprehension: don't crash in case distinctions on datatypes with even number of constructors
authortraytel
Thu, 05 Sep 2013 11:10:51 +0200
changeset 53412 01b804df0a30
parent 53411 ab4edf89992f
child 53413 ca3fdc640ebf
list_to_set_comprehension: don't crash in case distinctions on datatypes with even number of constructors
src/HOL/List.thy
--- a/src/HOL/List.thy	Thu Sep 05 01:58:48 2013 +0200
+++ b/src/HOL/List.thy	Thu Sep 05 11:10:51 2013 +0200
@@ -548,9 +548,9 @@
         fun check (i, case_t) s =
           (case strip_abs_body case_t of
             (Const (@{const_name List.Nil}, _)) => s
-          | _ => (case s of NONE => SOME i | SOME _ => NONE))
+          | _ => (case s of SOME NONE => SOME (SOME i) | _ => NONE))
       in
-        fold_index check cases NONE
+        fold_index check cases (SOME NONE) |> the_default NONE
       end
     (* returns (case_expr type index chosen_case) option  *)
     fun dest_case case_term =