src/HOL/Relation.ML
changeset 7007 b46ccfee8e59
parent 6806 43c081a0858d
child 7014 11ee650edcd2
equal deleted inserted replaced
7006:46048223e0f9 7007:b46ccfee8e59
   205 
   205 
   206 Goalw [Domain_def] "a: Domain(r) = (EX y. (a,y): r)";
   206 Goalw [Domain_def] "a: Domain(r) = (EX y. (a,y): r)";
   207 by (Blast_tac 1);
   207 by (Blast_tac 1);
   208 qed "Domain_iff";
   208 qed "Domain_iff";
   209 
   209 
   210 qed_goal "DomainI" thy "!!a b r. (a,b): r ==> a: Domain(r)"
   210 Goal "(a,b): r ==> a: Domain(r)";
   211  (fn _ => [ (etac (exI RS (Domain_iff RS iffD2)) 1) ]);
   211 by (etac (exI RS (Domain_iff RS iffD2)) 1) ;
   212 
   212 qed "DomainI";
   213 qed_goal "DomainE" thy
   213 
   214     "[| a : Domain(r);  !!y. (a,y): r ==> P |] ==> P"
   214 val prems= Goal "[| a : Domain(r);  !!y. (a,y): r ==> P |] ==> P";
   215  (fn prems=>
   215 by (rtac (Domain_iff RS iffD1 RS exE) 1);
   216   [ (rtac (Domain_iff RS iffD1 RS exE) 1),
   216 by (REPEAT (ares_tac prems 1)) ;
   217     (REPEAT (ares_tac prems 1)) ]);
   217 qed "DomainE";
   218 
   218 
   219 AddIs  [DomainI];
   219 AddIs  [DomainI];
   220 AddSEs [DomainE];
   220 AddSEs [DomainE];
   221 
   221 
   222 Goal "Domain Id = UNIV";
   222 Goal "Domain Id = UNIV";
   296 
   296 
   297 overload_1st_set "Relation.op ^^";
   297 overload_1st_set "Relation.op ^^";
   298 
   298 
   299 qed_goalw "Image_iff" thy [Image_def]
   299 qed_goalw "Image_iff" thy [Image_def]
   300     "b : r^^A = (? x:A. (x,b):r)"
   300     "b : r^^A = (? x:A. (x,b):r)"
   301  (fn _ => [ Blast_tac 1 ]);
   301  (fn _ => [(Blast_tac 1)]);
   302 
   302 
   303 qed_goalw "Image_singleton" thy [Image_def]
   303 qed_goalw "Image_singleton" thy [Image_def]
   304     "r^^{a} = {b. (a,b):r}"
   304     "r^^{a} = {b. (a,b):r}"
   305  (fn _ => [ Blast_tac 1 ]);
   305  (fn _ => [(Blast_tac 1)]);
   306 
   306 
   307 qed_goal "Image_singleton_iff" thy
   307 Goal
   308     "(b : r^^{a}) = ((a,b):r)"
   308     "(b : r^^{a}) = ((a,b):r)";
   309  (fn _ => [ rtac (Image_iff RS trans) 1,
   309 by (rtac (Image_iff RS trans) 1);
   310             Blast_tac 1 ]);
   310 by (Blast_tac 1);
       
   311 qed "Image_singleton_iff";
   311 
   312 
   312 AddIffs [Image_singleton_iff];
   313 AddIffs [Image_singleton_iff];
   313 
   314 
   314 qed_goalw "ImageI" thy [Image_def]
   315 Goalw [Image_def] "[| (a,b): r;  a:A |] ==> b : r^^A";
   315     "!!a b r. [| (a,b): r;  a:A |] ==> b : r^^A"
   316 by (Blast_tac 1);
   316  (fn _ => [ (Blast_tac 1)]);
   317 qed "ImageI";
   317 
   318 
   318 qed_goalw "ImageE" thy [Image_def]
   319 qed_goalw "ImageE" thy [Image_def]
   319     "[| b: r^^A;  !!x.[| (x,b): r;  x:A |] ==> P |] ==> P"
   320     "[| b: r^^A;  !!x.[| (x,b): r;  x:A |] ==> P |] ==> P"
   320  (fn major::prems=>
   321  (fn major::prems=>
   321   [ (rtac (major RS CollectE) 1),
   322   [ (rtac (major RS CollectE) 1),
   325 
   326 
   326 AddIs  [ImageI];
   327 AddIs  [ImageI];
   327 AddSEs [ImageE];
   328 AddSEs [ImageE];
   328 
   329 
   329 
   330 
   330 qed_goal "Image_empty" thy
   331 Goal
   331     "R^^{} = {}"
   332     "R^^{} = {}";
   332  (fn _ => [ Blast_tac 1 ]);
   333 by (Blast_tac 1);
       
   334 qed "Image_empty";
   333 
   335 
   334 Addsimps [Image_empty];
   336 Addsimps [Image_empty];
   335 
   337 
   336 Goal "Id ^^ A = A";
   338 Goal "Id ^^ A = A";
   337 by (Blast_tac 1);
   339 by (Blast_tac 1);
   341 by (Blast_tac 1);
   343 by (Blast_tac 1);
   342 qed "Image_diag";
   344 qed "Image_diag";
   343 
   345 
   344 Addsimps [Image_Id, Image_diag];
   346 Addsimps [Image_Id, Image_diag];
   345 
   347 
   346 qed_goal "Image_Int_subset" thy
   348 Goal "R ^^ (A Int B) <= R ^^ A Int R ^^ B";
   347     "R ^^ (A Int B) <= R ^^ A Int R ^^ B"
   349 by (Blast_tac 1);
   348  (fn _ => [ Blast_tac 1 ]);
   350 qed "Image_Int_subset";
   349 
   351 
   350 qed_goal "Image_Un" thy "R ^^ (A Un B) = R ^^ A Un R ^^ B"
   352 Goal "R ^^ (A Un B) = R ^^ A Un R ^^ B";
   351  (fn _ => [ Blast_tac 1 ]);
   353 by (Blast_tac 1);
   352 
   354 qed "Image_Un";
   353 qed_goal "Image_subset" thy "!!A B r. r <= A Times B ==> r^^C <= B"
   355 
   354  (fn _ =>
   356 Goal "r <= A Times B ==> r^^C <= B";
   355   [ (rtac subsetI 1),
   357 by (rtac subsetI 1);
   356     (REPEAT (eresolve_tac [asm_rl, ImageE, subsetD RS SigmaD2] 1)) ]);
   358 by (REPEAT (eresolve_tac [asm_rl, ImageE, subsetD RS SigmaD2] 1)) ;
       
   359 qed "Image_subset";
   357 
   360 
   358 (*NOT suitable for rewriting*)
   361 (*NOT suitable for rewriting*)
   359 Goal "r^^B = (UN y: B. r^^{y})";
   362 Goal "r^^B = (UN y: B. r^^{y})";
   360 by (Blast_tac 1);
   363 by (Blast_tac 1);
   361 qed "Image_eq_UN";
   364 qed "Image_eq_UN";