src/HOL/Product_Type.ML
changeset 10918 9679326489cd
parent 10832 e33b47e4246d
child 10989 87f8a7644f91
equal deleted inserted replaced
10917:1044648b3f84 10918:9679326489cd
   165 qed "split_paired_Ex";
   165 qed "split_paired_Ex";
   166 Addsimps [split_paired_Ex];
   166 Addsimps [split_paired_Ex];
   167 
   167 
   168 Goalw [split_def] "split c (a,b) = c a b";
   168 Goalw [split_def] "split c (a,b) = c a b";
   169 by (Simp_tac 1);
   169 by (Simp_tac 1);
   170 qed "split";
   170 qed "split_conv";
   171 Addsimps [split];
   171 Addsimps [split_conv];
       
   172 (*bind_thm ("split", split_conv);                  (*for compatibility*)*)
   172 
   173 
   173 (*Subsumes the old split_Pair when f is the identity function*)
   174 (*Subsumes the old split_Pair when f is the identity function*)
   174 Goal "split (%x y. f(x,y)) = f";
   175 Goal "split (%x y. f(x,y)) = f";
   175 by (rtac ext 1);
   176 by (rtac ext 1);
   176 by (pair_tac "x" 1);
   177 by (pair_tac "x" 1);
   198 qed "split_weak_cong";
   199 qed "split_weak_cong";
   199 
   200 
   200 Goal "(%(x,y). f(x,y)) = f";
   201 Goal "(%(x,y). f(x,y)) = f";
   201 by (rtac ext 1);
   202 by (rtac ext 1);
   202 by (split_all_tac 1);
   203 by (split_all_tac 1);
   203 by (rtac split 1);
   204 by (rtac split_conv 1);
   204 qed "split_eta";
   205 qed "split_eta";
   205 
   206 
   206 val prems = Goal "(!!x y. f x y = g(x,y)) ==> (%(x,y). f x y) = g";
   207 val prems = Goal "(!!x y. f x y = g(x,y)) ==> (%(x,y). f x y) = g";
   207 by (asm_simp_tac (simpset() addsimps prems@[split_eta]) 1);
   208 by (asm_simp_tac (simpset() addsimps prems@[split_eta]) 1);
   208 qed "cond_split_eta";
   209 qed "cond_split_eta";
   258 end;
   259 end;
   259 
   260 
   260 Addsimprocs [split_beta_proc,split_eta_proc];
   261 Addsimprocs [split_beta_proc,split_eta_proc];
   261 
   262 
   262 Goal "(%(x,y). P x y) z = P (fst z) (snd z)";
   263 Goal "(%(x,y). P x y) z = P (fst z) (snd z)";
   263 by (stac surjective_pairing 1 THEN rtac split 1);
   264 by (stac surjective_pairing 1 THEN rtac split_conv 1);
   264 qed "split_beta";
   265 qed "split_beta";
   265 
   266 
   266 (*For use with split_tac and the simplifier*)
   267 (*For use with split_tac and the simplifier*)
   267 Goal "R (split c p) = (! x y. p = (x,y) --> R (c x y))";
   268 Goal "R (split c p) = (! x y. p = (x,y) --> R (c x y))";
   268 by (stac surjective_pairing 1);
   269 by (stac surjective_pairing 1);
   269 by (stac split 1);
   270 by (stac split_conv 1);
   270 by (Blast_tac 1);
   271 by (Blast_tac 1);
   271 qed "split_split";
   272 qed "split_split";
   272 
   273 
   273 (* could be done after split_tac has been speeded up significantly:
   274 (* could be done after split_tac has been speeded up significantly:
   274 simpset_ref() := simpset() addsplits [split_split];
   275 simpset_ref() := simpset() addsplits [split_split];
   316 by (REPEAT (resolve_tac (prems@[surjective_pairing]) 1));
   317 by (REPEAT (resolve_tac (prems@[surjective_pairing]) 1));
   317 by (rtac (split_beta RS subst) 1 THEN rtac major 1);
   318 by (rtac (split_beta RS subst) 1 THEN rtac major 1);
   318 qed "splitE2";
   319 qed "splitE2";
   319 
   320 
   320 Goal "split R (a,b) ==> R a b";
   321 Goal "split R (a,b) ==> R a b";
   321 by (etac (split RS iffD1) 1);
   322 by (etac (split_conv RS iffD1) 1);
   322 qed "splitD";
   323 qed "splitD";
   323 
   324 
   324 Goal "z: c a b ==> z: split c (a,b)";
   325 Goal "z: c a b ==> z: split c (a,b)";
   325 by (Asm_simp_tac 1);
   326 by (Asm_simp_tac 1);
   326 qed "mem_splitI";
   327 qed "mem_splitI";
   375 *)
   376 *)
   376 
   377 
   377 (*** prod_fun -- action of the product functor upon functions ***)
   378 (*** prod_fun -- action of the product functor upon functions ***)
   378 
   379 
   379 Goalw [prod_fun_def] "prod_fun f g (a,b) = (f(a),g(b))";
   380 Goalw [prod_fun_def] "prod_fun f g (a,b) = (f(a),g(b))";
   380 by (rtac split 1);
   381 by (rtac split_conv 1);
   381 qed "prod_fun";
   382 qed "prod_fun";
   382 Addsimps [prod_fun];
   383 Addsimps [prod_fun];
   383 
   384 
   384 Goal "prod_fun (f1 o f2) (g1 o g2) = ((prod_fun f1 g1) o (prod_fun f2 g2))";
   385 Goal "prod_fun (f1 o f2) (g1 o g2) = ((prod_fun f1 g1) o (prod_fun f2 g2))";
   385 by (rtac ext 1);
   386 by (rtac ext 1);
   567 by (Blast_tac 1);
   568 by (Blast_tac 1);
   568 qed "Times_Diff_distrib1";
   569 qed "Times_Diff_distrib1";
   569 
   570 
   570 
   571 
   571 (*Attempts to remove occurrences of split, and pair-valued parameters*)
   572 (*Attempts to remove occurrences of split, and pair-valued parameters*)
   572 val remove_split = rewrite_rule [split RS eq_reflection] o split_all;
   573 val remove_split = rewrite_rule [split_conv RS eq_reflection] o split_all;
   573 
   574 
   574 local
   575 local
   575 
   576 
   576 (*In ap_split S T u, term u expects separate arguments for the factors of S,
   577 (*In ap_split S T u, term u expects separate arguments for the factors of S,
   577   with result type T.  The call creates a new term expecting one argument
   578   with result type T.  The call creates a new term expecting one argument