src/HOL/Update.ML
changeset 5069 3ea049f7979d
parent 4898 68fd1a2b8b7b
child 5070 c42429b3e2f2
equal deleted inserted replaced
5068:fb28eaa07e01 5069:3ea049f7979d
     6 Function updates: like theory Map, but for ordinary functions
     6 Function updates: like theory Map, but for ordinary functions
     7 *)
     7 *)
     8 
     8 
     9 open Update;
     9 open Update;
    10 
    10 
    11 goalw thy [update_def] "(f[x:=y] = f) = (f x = y)";
    11 Goalw [update_def] "(f[x:=y] = f) = (f x = y)";
    12 by Safe_tac;
    12 by Safe_tac;
    13 by (etac subst 1);
    13 by (etac subst 1);
    14 by (rtac ext 2);
    14 by (rtac ext 2);
    15 by Auto_tac;
    15 by Auto_tac;
    16 qed "update_idem_iff";
    16 qed "update_idem_iff";
    18 (* f x = y ==> f[x:=y] = f *)
    18 (* f x = y ==> f[x:=y] = f *)
    19 bind_thm("update_idem", update_idem_iff RS iffD2);
    19 bind_thm("update_idem", update_idem_iff RS iffD2);
    20 
    20 
    21 AddIffs [refl RS update_idem];
    21 AddIffs [refl RS update_idem];
    22 
    22 
    23 goal thy "(f[x:=y])z = (if x=z then y else f z)";
    23 Goal "(f[x:=y])z = (if x=z then y else f z)";
    24 by (simp_tac (simpset() addsimps [update_def]) 1);
    24 by (simp_tac (simpset() addsimps [update_def]) 1);
    25 qed "update_apply";
    25 qed "update_apply";
    26 Addsimps [update_apply];
    26 Addsimps [update_apply];