src/HOL/ex/SList.ML
changeset 1808 785a7672962e
parent 1476 608483c2122a
child 1815 cd3ffa5f1e31
equal deleted inserted replaced
1807:3ff66483a8d4 1808:785a7672962e
   284 val [append_Nil3,append_Cons] = list_recs append_def;
   284 val [append_Nil3,append_Cons] = list_recs append_def;
   285 val [mem_Nil, mem_Cons] = list_recs mem_def;
   285 val [mem_Nil, mem_Cons] = list_recs mem_def;
   286 val [map_Nil,map_Cons] = list_recs map_def;
   286 val [map_Nil,map_Cons] = list_recs map_def;
   287 val [list_case_Nil,list_case_Cons] = list_recs list_case_def;
   287 val [list_case_Nil,list_case_Cons] = list_recs list_case_def;
   288 val [filter_Nil,filter_Cons] = list_recs filter_def;
   288 val [filter_Nil,filter_Cons] = list_recs filter_def;
   289 val [list_all_Nil,list_all_Cons] = list_recs list_all_def;
       
   290 
   289 
   291 Addsimps
   290 Addsimps
   292   [null_Nil, ttl_Nil,
   291   [null_Nil, ttl_Nil,
   293    mem_Nil, mem_Cons,
   292    mem_Nil, mem_Cons,
   294    list_case_Nil, list_case_Cons,
   293    list_case_Nil, list_case_Cons,
   295    append_Nil3, append_Cons,
   294    append_Nil3, append_Cons,
   296    map_Nil, map_Cons,
   295    map_Nil, map_Cons,
   297    list_all_Nil, list_all_Cons,
       
   298    filter_Nil, filter_Cons];
   296    filter_Nil, filter_Cons];
   299 
   297 
   300 
   298 
   301 (** @ - append **)
   299 (** @ - append **)
   302 
   300 
   319 
   317 
   320 goal SList.thy "x mem [x:xs.P(x)] = (x mem xs & P(x))";
   318 goal SList.thy "x mem [x:xs.P(x)] = (x mem xs & P(x))";
   321 by(list_ind_tac "xs" 1);
   319 by(list_ind_tac "xs" 1);
   322 by(ALLGOALS(asm_simp_tac (!simpset setloop (split_tac [expand_if]))));
   320 by(ALLGOALS(asm_simp_tac (!simpset setloop (split_tac [expand_if]))));
   323 qed "mem_filter2";
   321 qed "mem_filter2";
   324 
       
   325 (** list_all **)
       
   326 
       
   327 goal SList.thy "(Alls x:xs.True) = True";
       
   328 by(list_ind_tac "xs" 1);
       
   329 by(ALLGOALS Asm_simp_tac);
       
   330 qed "list_all_True2";
       
   331 
       
   332 goal SList.thy "list_all p (xs@ys) = (list_all p xs & list_all p ys)";
       
   333 by(list_ind_tac "xs" 1);
       
   334 by(ALLGOALS Asm_simp_tac);
       
   335 qed "list_all_conj2";
       
   336 
       
   337 goal SList.thy "(Alls x:xs.P(x)) = (!x. x mem xs --> P(x))";
       
   338 by(list_ind_tac "xs" 1);
       
   339 by(ALLGOALS(asm_simp_tac (!simpset setloop (split_tac [expand_if]))));
       
   340 by(fast_tac HOL_cs 1);
       
   341 qed "list_all_mem_conv2";
       
   342 
   322 
   343 
   323 
   344 (** The functional "map" **)
   324 (** The functional "map" **)
   345 
   325 
   346 Addsimps [Rep_map_Nil, Rep_map_Cons, Abs_map_NIL, Abs_map_CONS];
   326 Addsimps [Rep_map_Nil, Rep_map_Cons, Abs_map_NIL, Abs_map_CONS];