src/HOL/List.thy
changeset 70911 38298c04c12e
parent 70296 8dd987397e31
child 71393 fce780f9c9c6
equal deleted inserted replaced
70910:3ed399935d7c 70911:38298c04c12e
  2696   with assms have "xy = (x, y)" and "xys = zip xs' ys'"
  2696   with assms have "xy = (x, y)" and "xys = zip xs' ys'"
  2697     by simp_all
  2697     by simp_all
  2698   with xs ys show ?thesis ..
  2698   with xs ys show ?thesis ..
  2699 qed
  2699 qed
  2700 
  2700 
       
  2701 lemma semilattice_map2:
       
  2702   "semilattice (map2 (\<^bold>*))" if "semilattice (\<^bold>*)"
       
  2703     for f (infixl "\<^bold>*" 70)
       
  2704 proof -
       
  2705   from that interpret semilattice f .
       
  2706   show ?thesis
       
  2707   proof
       
  2708     show "map2 (\<^bold>*) (map2 (\<^bold>*) xs ys) zs = map2 (\<^bold>*) xs (map2 (\<^bold>*) ys zs)"
       
  2709       for xs ys zs :: "'a list"
       
  2710     proof (induction "zip xs (zip ys zs)" arbitrary: xs ys zs)
       
  2711       case Nil
       
  2712       from Nil [symmetric] show ?case
       
  2713         by (auto simp add: zip_eq_Nil_iff)
       
  2714     next
       
  2715       case (Cons xyz xyzs)
       
  2716       from Cons.hyps(2) [symmetric] show ?case
       
  2717         by (rule zip_eq_ConsE) (erule zip_eq_ConsE,
       
  2718           auto intro: Cons.hyps(1) simp add: ac_simps)
       
  2719     qed
       
  2720     show "map2 (\<^bold>*) xs ys = map2 (\<^bold>*) ys xs"
       
  2721       for xs ys :: "'a list"
       
  2722     proof (induction "zip xs ys" arbitrary: xs ys)
       
  2723       case Nil
       
  2724       then show ?case
       
  2725         by (auto simp add: zip_eq_Nil_iff dest: sym)
       
  2726     next
       
  2727       case (Cons xy xys)
       
  2728       from Cons.hyps(2) [symmetric] show ?case
       
  2729         by (rule zip_eq_ConsE) (auto intro: Cons.hyps(1) simp add: ac_simps)
       
  2730     qed
       
  2731     show "map2 (\<^bold>*) xs xs = xs"
       
  2732       for xs :: "'a list"
       
  2733       by (induction xs) simp_all
       
  2734   qed
       
  2735 qed
       
  2736 
  2701 lemma pair_list_eqI:
  2737 lemma pair_list_eqI:
  2702   assumes "map fst xs = map fst ys" and "map snd xs = map snd ys"
  2738   assumes "map fst xs = map fst ys" and "map snd xs = map snd ys"
  2703   shows "xs = ys"
  2739   shows "xs = ys"
  2704 proof -
  2740 proof -
  2705   from assms(1) have "length xs = length ys" by (rule map_eq_imp_length_eq)
  2741   from assms(1) have "length xs = length ys" by (rule map_eq_imp_length_eq)