src/HOL/UNITY/Update.ML
changeset 4776 1f9362e769c1
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/HOL/UNITY/Update.ML	Fri Apr 03 12:34:33 1998 +0200
     1.3 @@ -0,0 +1,26 @@
     1.4 +(*  Title:      HOL/UNITY/Update.thy
     1.5 +    ID:         $Id$
     1.6 +    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
     1.7 +    Copyright   1998  University of Cambridge
     1.8 +
     1.9 +Function updates: like the standard theory Map, but for ordinary functions
    1.10 +*)
    1.11 +
    1.12 +open Update;
    1.13 +
    1.14 +goalw thy [update_def] "(f[x|->y] = f) = (f x = y)";
    1.15 +by Safe_tac;
    1.16 +by (etac subst 1);
    1.17 +by (rtac ext 2);
    1.18 +by Auto_tac;
    1.19 +qed "update_idem_iff";
    1.20 +
    1.21 +(* f x = y ==> f[x|->y] = f *)
    1.22 +bind_thm("update_idem", update_idem_iff RS iffD2);
    1.23 +
    1.24 +AddIffs [refl RS update_idem];
    1.25 +
    1.26 +goal thy "(f[x|->y])z = (if x=z then y else f z)";
    1.27 +by (simp_tac (simpset() addsimps [update_def]) 1);
    1.28 +qed "update_apply";
    1.29 +Addsimps [update_apply];