Redefining "range" as a macro
authorpaulson
Fri Jul 26 12:17:04 1996 +0200 (1996-07-26)
changeset 188300b4b6992945
parent 1882 67f49e8c4355
child 1884 5a1f81da3e12
Redefining "range" as a macro
src/HOL/Fun.ML
src/HOL/Set.thy
     1.1 --- a/src/HOL/Fun.ML	Fri Jul 26 12:16:17 1996 +0200
     1.2 +++ b/src/HOL/Fun.ML	Fri Jul 26 12:17:04 1996 +0200
     1.3 @@ -19,28 +19,14 @@
     1.4  qed "apply_inverse";
     1.5  
     1.6  
     1.7 -(*** Range of a function ***)
     1.8 +(*** Image of a set under a function ***)
     1.9  
    1.10  (*Frequently b does not have the syntactic form of f(x).*)
    1.11 -val [prem] = goalw Fun.thy [range_def] "b=f(x) ==> b : range(f)";
    1.12 -by (EVERY1 [rtac CollectI, rtac exI, rtac prem]);
    1.13 -qed "range_eqI";
    1.14 -
    1.15 -val rangeI = refl RS range_eqI;
    1.16 -
    1.17 -val [major,minor] = goalw Fun.thy [range_def]
    1.18 -    "[| b : range(%x.f(x));  !!x. b=f(x) ==> P |] ==> P"; 
    1.19 -by (rtac (major RS CollectD RS exE) 1);
    1.20 -by (etac minor 1);
    1.21 -qed "rangeE";
    1.22 -
    1.23 -(*** Image of a set under a function ***)
    1.24 -
    1.25  val prems = goalw Fun.thy [image_def] "[| b=f(x);  x:A |] ==> b : f``A";
    1.26  by (REPEAT (resolve_tac (prems @ [CollectI,bexI,prem]) 1));
    1.27  qed "image_eqI";
    1.28  
    1.29 -val imageI = refl RS image_eqI;
    1.30 +bind_thm ("imageI", refl RS image_eqI);
    1.31  
    1.32  (*The eta-expansion gives variable-name preservation.*)
    1.33  val major::prems = goalw Fun.thy [image_def]
    1.34 @@ -59,6 +45,19 @@
    1.35  by (fast_tac (!claset addIs [imageI,UnCI] addSEs [imageE,UnE]) 1);
    1.36  qed "image_Un";
    1.37  
    1.38 +(*** Range of a function -- just a translation for image! ***)
    1.39 +
    1.40 +goal Fun.thy "!!b. b=f(x) ==> b : range(f)";
    1.41 +by (EVERY1 [etac image_eqI, rtac UNIV_I]);
    1.42 +bind_thm ("range_eqI", UNIV_I RSN (2,image_eqI));
    1.43 +
    1.44 +bind_thm ("rangeI", UNIV_I RS imageI);
    1.45 +
    1.46 +val [major,minor] = goal Fun.thy 
    1.47 +    "[| b : range(%x.f(x));  !!x. b=f(x) ==> P |] ==> P"; 
    1.48 +by (rtac (major RS imageE) 1);
    1.49 +by (etac minor 1);
    1.50 +qed "rangeE";
    1.51  (*** inj(f): f is a one-to-one function ***)
    1.52  
    1.53  val prems = goalw Fun.thy [inj_def]
    1.54 @@ -181,4 +180,4 @@
    1.55  
    1.56  val set_cs = !claset delrules [equalityI];
    1.57  
    1.58 -fun cfast_tac prems = cut_facts_tac prems THEN' fast_tac (claset_of "Fun");
    1.59 +
     2.1 --- a/src/HOL/Set.thy	Fri Jul 26 12:16:17 1996 +0200
     2.2 +++ b/src/HOL/Set.thy	Fri Jul 26 12:17:04 1996 +0200
     2.3 @@ -60,6 +60,7 @@
     2.4  
     2.5  translations
     2.6    "UNIV"        == "Compl {}"
     2.7 +  "range(f)"    == "f``UNIV"
     2.8    "x ~: y"      == "~ (x : y)"
     2.9    "{x, xs}"     == "insert x {xs}"
    2.10    "{x}"         == "insert x {}"
    2.11 @@ -97,7 +98,6 @@
    2.12    Pow_def       "Pow(A)         == {B. B <= A}"
    2.13    empty_def     "{}             == {x. False}"
    2.14    insert_def    "insert a B     == {x.x=a} Un B"
    2.15 -  range_def     "range(f)       == {y. ? x. y=f(x)}"
    2.16    image_def     "f``A           == {y. ? x:A. y=f(x)}"
    2.17    inj_def       "inj(f)         == ! x y. f(x)=f(y) --> x=y"
    2.18    inj_onto_def  "inj_onto f A   == ! x:A. ! y:A. f(x)=f(y) --> x=y"