src/HOL/List.thy
changeset 44635 3d046864ebe6
parent 44619 fd520fa2fb09
child 44890 22f665a2e91c
equal deleted inserted replaced
44634:2ac4ff398bc3 44635:3d046864ebe6
  2927   with assms have "distinct ys'" by simp
  2927   with assms have "distinct ys'" by simp
  2928   with `length xs' = length ys'` show "distinct (zip xs' ys')"
  2928   with `length xs' = length ys'` show "distinct (zip xs' ys')"
  2929     by (induct xs' ys' rule: list_induct2) (auto elim: in_set_zipE)
  2929     by (induct xs' ys' rule: list_induct2) (auto elim: in_set_zipE)
  2930 qed
  2930 qed
  2931 
  2931 
       
  2932 (* The next two lemmas help Sledgehammer. *)
       
  2933 
       
  2934 lemma distinct_singleton: "distinct [x]" by simp
       
  2935 
       
  2936 lemma distinct_length_2_or_more:
       
  2937 "distinct (a # b # xs) \<longleftrightarrow> (a \<noteq> b \<and> distinct (a # xs) \<and> distinct (b # xs))"
       
  2938 by (metis distinct.simps(2) hd.simps hd_in_set list.simps(2) set_ConsD set_rev_mp set_subset_Cons)
       
  2939 
  2932 
  2940 
  2933 subsubsection {* List summation: @{const listsum} and @{text"\<Sum>"}*}
  2941 subsubsection {* List summation: @{const listsum} and @{text"\<Sum>"}*}
  2934 
  2942 
  2935 lemma (in monoid_add) listsum_foldl [code]:
  2943 lemma (in monoid_add) listsum_foldl [code]:
  2936   "listsum = foldl (op +) 0"
  2944   "listsum = foldl (op +) 0"