List.ML
changeset 5 968d2dccf2de
parent 0 7949f97df77a
child 13 61b65ffb4186
equal deleted inserted replaced
4:d199410f1db1 5:968d2dccf2de
    94 by (etac Abs_List_inverse 1);
    94 by (etac Abs_List_inverse 1);
    95 val inj_onto_Abs_List = result();
    95 val inj_onto_Abs_List = result();
    96 
    96 
    97 (** Distinctness of constructors **)
    97 (** Distinctness of constructors **)
    98 
    98 
    99 goalw List.thy [NIL_def,CONS_def] "~ CONS(M,N) = NIL";
    99 goalw List.thy [NIL_def,CONS_def] "CONS(M,N) ~= NIL";
   100 by (rtac In1_not_In0 1);
   100 by (rtac In1_not_In0 1);
   101 val CONS_not_NIL = result();
   101 val CONS_not_NIL = result();
   102 val NIL_not_CONS = standard (CONS_not_NIL RS not_sym);
   102 val NIL_not_CONS = standard (CONS_not_NIL RS not_sym);
   103 
   103 
   104 val CONS_neq_NIL = standard (CONS_not_NIL RS notE);
   104 val CONS_neq_NIL = standard (CONS_not_NIL RS notE);
   105 val NIL_neq_CONS = sym RS CONS_neq_NIL;
   105 val NIL_neq_CONS = sym RS CONS_neq_NIL;
   106 
   106 
   107 goalw List.thy [Nil_def,Cons_def] "~ Cons(x,xs) = Nil";
   107 goalw List.thy [Nil_def,Cons_def] "Cons(x,xs) ~= Nil";
   108 by (rtac (CONS_not_NIL RS (inj_onto_Abs_List RS inj_onto_contraD)) 1);
   108 by (rtac (CONS_not_NIL RS (inj_onto_Abs_List RS inj_onto_contraD)) 1);
   109 by (REPEAT (resolve_tac [rangeI, NIL_I, CONS_I, Rep_List] 1));
   109 by (REPEAT (resolve_tac [rangeI, NIL_I, CONS_I, Rep_List] 1));
   110 val Cons_not_Nil = result();
   110 val Cons_not_Nil = result();
   111 
   111 
   112 val Nil_not_Cons = standard (Cons_not_Nil RS not_sym);
   112 val Nil_not_Cons = standard (Cons_not_Nil RS not_sym);
   150 val list_free_simps = [Cons_not_Nil, Nil_not_Cons, Cons_Cons_eq,
   150 val list_free_simps = [Cons_not_Nil, Nil_not_Cons, Cons_Cons_eq,
   151 		       CONS_not_NIL, NIL_not_CONS, CONS_CONS_eq,
   151 		       CONS_not_NIL, NIL_not_CONS, CONS_CONS_eq,
   152 		       NIL_I, CONS_I];
   152 		       NIL_I, CONS_I];
   153 val list_free_ss = HOL_ss  addsimps  list_free_simps;
   153 val list_free_ss = HOL_ss  addsimps  list_free_simps;
   154 
   154 
   155 goal List.thy "!!N. N: List(A) ==> !M. ~ N = CONS(M,N)";
   155 goal List.thy "!!N. N: List(A) ==> !M. N ~= CONS(M,N)";
   156 by (etac List_induct 1);
   156 by (etac List_induct 1);
   157 by (ALLGOALS (asm_simp_tac list_free_ss));
   157 by (ALLGOALS (asm_simp_tac list_free_ss));
   158 val not_CONS_self = result();
   158 val not_CONS_self = result();
   159 
   159 
   160 goal List.thy "!x. ~ l=Cons(x,l)";
   160 goal List.thy "!x. l ~= Cons(x,l)";
   161 by (list_ind_tac "l" 1);
   161 by (list_ind_tac "l" 1);
   162 by (ALLGOALS (asm_simp_tac list_free_ss));
   162 by (ALLGOALS (asm_simp_tac list_free_ss));
   163 val not_Cons_self = result();
   163 val not_Cons_self = result();
   164 
   164 
   165 
   165