src/HOL/List.thy
changeset 22422 ee19cdb07528
parent 22262 96ba62dff413
child 22493 db930e490fe5
equal deleted inserted replaced
22421:51a18dd1ea86 22422:ee19cdb07528
  2226 lemma listsp_mono [mono2]: "A \<le> B ==> listsp A \<le> listsp B"
  2226 lemma listsp_mono [mono2]: "A \<le> B ==> listsp A \<le> listsp B"
  2227   by (clarify, erule listsp.induct, blast+)
  2227   by (clarify, erule listsp.induct, blast+)
  2228 
  2228 
  2229 lemmas lists_mono [mono] = listsp_mono [to_set]
  2229 lemmas lists_mono [mono] = listsp_mono [to_set]
  2230 
  2230 
  2231 lemma listsp_meetI:
  2231 lemma listsp_infI:
  2232   assumes l: "listsp A l" shows "listsp B l ==> listsp (meet A B) l" using l
  2232   assumes l: "listsp A l" shows "listsp B l ==> listsp (inf A B) l" using l
  2233   by induct blast+
  2233   by induct blast+
  2234 
  2234 
  2235 lemmas lists_IntI = listsp_meetI [to_set]
  2235 lemmas lists_IntI = listsp_infI [to_set]
  2236 
  2236 
  2237 lemma listsp_meet_eq [simp]: "listsp (meet A B) = meet (listsp A) (listsp B)"
  2237 lemma listsp_inf_eq [simp]: "listsp (inf A B) = inf (listsp A) (listsp B)"
  2238 proof (rule mono_meet [where f=listsp, THEN order_antisym])
  2238 proof (rule mono_inf [where f=listsp, THEN order_antisym])
  2239   show "mono listsp" by (simp add: mono_def listsp_mono)
  2239   show "mono listsp" by (simp add: mono_def listsp_mono)
  2240   show "meet (listsp A) (listsp B) \<le> listsp (meet A B)" by (blast intro: listsp_meetI)
  2240   show "inf (listsp A) (listsp B) \<le> listsp (inf A B)" by (blast intro: listsp_infI)
  2241 qed
  2241 qed
  2242 
  2242 
  2243 lemmas listsp_conj_eq [simp] = listsp_meet_eq [simplified meet_fun_eq meet_bool_eq]
  2243 lemmas listsp_conj_eq [simp] = listsp_inf_eq [simplified inf_fun_eq inf_bool_eq]
  2244 
  2244 
  2245 lemmas lists_Int_eq [simp] = listsp_meet_eq [to_set]
  2245 lemmas lists_Int_eq [simp] = listsp_inf_eq [to_set]
  2246 
  2246 
  2247 lemma append_in_listsp_conv [iff]:
  2247 lemma append_in_listsp_conv [iff]:
  2248      "(listsp A (xs @ ys)) = (listsp A xs \<and> listsp A ys)"
  2248      "(listsp A (xs @ ys)) = (listsp A xs \<and> listsp A ys)"
  2249 by (induct xs) auto
  2249 by (induct xs) auto
  2250 
  2250 
  2789   map_filter} are just there to generate efficient code. Do not use
  2789   map_filter} are just there to generate efficient code. Do not use
  2790   them for modelling and proving.
  2790   them for modelling and proving.
  2791 *}
  2791 *}
  2792 
  2792 
  2793 lemma mem_iff [normal post]:
  2793 lemma mem_iff [normal post]:
  2794   "(x mem xs) = (x \<in> set xs)"
  2794   "x mem xs \<longleftrightarrow> x \<in> set xs"
  2795   by (induct xs) auto
  2795   by (induct xs) auto
  2796 
  2796 
  2797 lemmas in_set_code [code unfold] =
  2797 lemmas in_set_code [code unfold] =
  2798   mem_iff [symmetric, THEN eq_reflection]
  2798   mem_iff [symmetric, THEN eq_reflection]
  2799 
  2799 
  2800 lemma empty_null [code inline]:
  2800 lemma empty_null [code inline]:
  2801   "(xs = []) = null xs"
  2801   "xs = [] \<longleftrightarrow> null xs"
  2802   by (cases xs) simp_all
  2802   by (cases xs) simp_all
  2803 
  2803 
  2804 lemmas null_empty [normal post] =
  2804 lemmas null_empty [normal post] =
  2805   empty_null [symmetric]
  2805   empty_null [symmetric]
  2806 
  2806 
  2807 lemma list_inter_conv:
  2807 lemma list_inter_conv:
  2808   "set (list_inter xs ys) = set xs \<inter> set ys"
  2808   "set (list_inter xs ys) = set xs \<inter> set ys"
  2809   by (induct xs) auto
  2809   by (induct xs) auto
  2810 
  2810 
  2811 lemma list_all_iff [normal post]:
  2811 lemma list_all_iff [normal post]:
  2812   "list_all P xs = (\<forall>x \<in> set xs. P x)"
  2812   "list_all P xs \<longleftrightarrow> (\<forall>x \<in> set xs. P x)"
  2813   by (induct xs) auto
  2813   by (induct xs) auto
  2814 
  2814 
  2815 lemmas list_ball_code [code unfold] =
  2815 lemmas list_ball_code [code unfold] =
  2816   list_all_iff [symmetric, THEN eq_reflection]
  2816   list_all_iff [symmetric, THEN eq_reflection]
  2817 
  2817 
  2818 lemma list_all_append [simp]:
  2818 lemma list_all_append [simp]:
  2819   "list_all P (xs @ ys) = (list_all P xs \<and> list_all P ys)"
  2819   "list_all P (xs @ ys) \<longleftrightarrow> (list_all P xs \<and> list_all P ys)"
  2820   by (induct xs) auto
  2820   by (induct xs) auto
  2821 
  2821 
  2822 lemma list_all_rev [simp]:
  2822 lemma list_all_rev [simp]:
  2823   "list_all P (rev xs) = list_all P xs"
  2823   "list_all P (rev xs) \<longleftrightarrow> list_all P xs"
  2824   by (simp add: list_all_iff)
  2824   by (simp add: list_all_iff)
  2825 
  2825 
  2826 lemma list_ex_iff [normal post]:
  2826 lemma list_ex_iff [normal post]:
  2827   "list_ex P xs = (\<exists>x \<in> set xs. P x)"
  2827   "list_ex P xs \<longleftrightarrow> (\<exists>x \<in> set xs. P x)"
  2828   by (induct xs) simp_all
  2828   by (induct xs) simp_all
  2829 
  2829 
  2830 lemmas list_bex_code [code unfold] =
  2830 lemmas list_bex_code [code unfold] =
  2831   list_ex_iff [symmetric, THEN eq_reflection]
  2831   list_ex_iff [symmetric, THEN eq_reflection]
  2832 
  2832