src/ZF/ex/Primrec.ML
changeset 2637 e9b203f854ae
parent 2469 b50b8c0eec01
child 3328 480ad4e72662
equal deleted inserted replaced
2636:4b30dbe4a020 2637:e9b203f854ae
    20     nat_typechecks @ list.intrs @ 
    20     nat_typechecks @ list.intrs @ 
    21     [lam_type, list_case_type, drop_type, map_type, apply_type, rec_type];
    21     [lam_type, list_case_type, drop_type, map_type, apply_type, rec_type];
    22 
    22 
    23 (** Useful special cases of evaluation ***)
    23 (** Useful special cases of evaluation ***)
    24 
    24 
    25 simpset := !simpset setsolver (type_auto_tac pr_typechecks);
    25 simpset := !simpset setSolver (type_auto_tac pr_typechecks);
    26 
    26 
    27 goalw Primrec.thy [SC_def]
    27 goalw Primrec.thy [SC_def]
    28     "!!x l. [| x:nat;  l: list(nat) |] ==> SC ` (Cons(x,l)) = succ(x)";
    28     "!!x l. [| x:nat;  l: list(nat) |] ==> SC ` (Cons(x,l)) = succ(x)";
    29 by (Asm_simp_tac 1);
    29 by (Asm_simp_tac 1);
    30 qed "SC";
    30 qed "SC";
    59 (*** Inductive definition of the PR functions ***)
    59 (*** Inductive definition of the PR functions ***)
    60 
    60 
    61 (* c: primrec ==> c: list(nat) -> nat *)
    61 (* c: primrec ==> c: list(nat) -> nat *)
    62 val primrec_into_fun = primrec.dom_subset RS subsetD;
    62 val primrec_into_fun = primrec.dom_subset RS subsetD;
    63 
    63 
    64 simpset := !simpset setsolver (type_auto_tac ([primrec_into_fun] @ 
    64 simpset := !simpset setSolver (type_auto_tac ([primrec_into_fun] @ 
    65 					      pr_typechecks @ primrec.intrs));
    65 					      pr_typechecks @ primrec.intrs));
    66 
    66 
    67 goalw Primrec.thy [ACK_def] "!!i. i:nat ==> ACK(i): primrec";
    67 goalw Primrec.thy [ACK_def] "!!i. i:nat ==> ACK(i): primrec";
    68 by (etac nat_induct 1);
    68 by (etac nat_induct 1);
    69 by (ALLGOALS Asm_simp_tac);
    69 by (ALLGOALS Asm_simp_tac);