List.ML
changeset 13 61b65ffb4186
parent 5 968d2dccf2de
child 20 f4f9946ad741
equal deleted inserted replaced
12:201061643c4b 13:61b65ffb4186
   308 
   308 
   309 goalw List.thy [list_case_def] "list_case(Cons(x,xs),a,f) = f(x,xs)";
   309 goalw List.thy [list_case_def] "list_case(Cons(x,xs),a,f) = f(x,xs)";
   310 by (rtac list_rec_Cons 1);
   310 by (rtac list_rec_Cons 1);
   311 val list_case_Cons = result();
   311 val list_case_Cons = result();
   312 
   312 
       
   313 (** @ - append **)
       
   314 
       
   315 goalw List.thy [append_def] "[]@xs = xs";
       
   316 by (rtac list_rec_Nil 1);
       
   317 val append_Nil = result();
       
   318 
       
   319 goalw List.thy [append_def] "Cons(x,xs)@ys = Cons(x,xs@ys)";
       
   320 by (rtac list_rec_Cons 1);
       
   321 val append_Cons = result();
       
   322 
       
   323 goal List.thy "(xs@ys)@zs = xs@(ys@zs)";
       
   324 by(res_inst_tac [("l","xs")] list_induct 1);
       
   325 by(REPEAT(asm_simp_tac (list_ss addsimps [append_Nil,append_Cons]) 1));
       
   326 val append_assoc = result();
   313 
   327 
   314 (** The functional "map" **)
   328 (** The functional "map" **)
   315 
   329 
   316 goalw List.thy [map_def] "map(f,Nil) = Nil";
   330 goalw List.thy [map_def] "map(f,Nil) = Nil";
   317 by (rtac list_rec_Nil 1);
   331 by (rtac list_rec_Nil 1);