added sum_case_map_upd_empty, sum_case_empty_map_upd, and
authoroheimb
Thu Feb 01 18:47:31 2001 +0100 (2001-02-01)
changeset 1101555d95834c815
parent 11014 c205ede3140d
child 11016 8f8ba41a5e7a
added sum_case_map_upd_empty, sum_case_empty_map_upd, and
sum_case_map_upd_map_upd (also to default simpset),
added map_of_map
src/HOL/Map.ML
     1.1 --- a/src/HOL/Map.ML	Thu Feb 01 18:13:06 2001 +0100
     1.2 +++ b/src/HOL/Map.ML	Thu Feb 01 18:47:31 2001 +0100
     1.3 @@ -48,6 +48,27 @@
     1.4  qed "finite_range_updI";
     1.5  
     1.6  
     1.7 +section "sum_case and empty/map_upd";
     1.8 +
     1.9 +Goal "sum_case (m(k|->y)) empty =  (sum_case m empty)(Inl k|->y)";
    1.10 +by (rtac ext 1);
    1.11 +by (simp_tac (simpset() addsplits [sum.split]) 1);
    1.12 +qed "sum_case_map_upd_empty";
    1.13 +Addsimps[sum_case_map_upd_empty];
    1.14 +
    1.15 +Goal "sum_case empty (m(k|->y)) =  (sum_case empty m)(Inr k|->y)";
    1.16 +by (rtac ext 1);
    1.17 +by (simp_tac (simpset() addsplits [sum.split]) 1);
    1.18 +qed "sum_case_empty_map_upd";
    1.19 +Addsimps[sum_case_empty_map_upd];
    1.20 +
    1.21 +Goal "sum_case (m1(k1|->y1)) (m2(k2|->y2)) = (sum_case (m1(k1|->y1)) m2)(Inr k2|->y2)";
    1.22 +by (rtac ext 1);
    1.23 +by (simp_tac (simpset() addsplits [sum.split]) 1);
    1.24 +qed "sum_case_map_upd_map_upd";
    1.25 +Addsimps[sum_case_map_upd_map_upd];
    1.26 +
    1.27 +
    1.28  section "map_upds";
    1.29  
    1.30  Goal "a ~: set as --> (!m bs. (m(a|->b)(as[|->]bs)) = (m(as[|->]bs)(a|->b)))";
    1.31 @@ -93,9 +114,10 @@
    1.32  by  Auto_tac;
    1.33  qed_spec_mp "weak_map_of_SomeI";
    1.34  
    1.35 -Goal "[| map_of xs k = Some z; P z |] ==> map_of [(k,z):xs . P z] k = Some z";
    1.36 +Goal 
    1.37 +"[| map_of xs k = Some z; P k z |] ==> map_of (filter (split P) xs) k = Some z";
    1.38  by (rtac mp 1);
    1.39 -by (assume_tac 2);
    1.40 +by (atac 2);
    1.41  by (etac thin_rl 1);
    1.42  by (induct_tac "xs" 1);
    1.43  by  Auto_tac;
    1.44 @@ -109,6 +131,11 @@
    1.45  by Auto_tac;
    1.46  qed "finite_range_map_of";
    1.47  
    1.48 +Goal "map_of (map (%(a,b). (a,f b)) xs) x = option_map f (map_of xs x)";
    1.49 +by (induct_tac "xs" 1);
    1.50 +by Auto_tac;
    1.51 +qed "map_of_map";
    1.52 +
    1.53  
    1.54  section "option_map related";
    1.55  
    1.56 @@ -124,6 +151,7 @@
    1.57  
    1.58  Addsimps[option_map_o_empty, option_map_o_map_upd];
    1.59  
    1.60 +
    1.61  section "++";
    1.62  
    1.63  Goalw [override_def] "m ++ empty = m";