src/FOL/ex/NatClass.ML
author wenzelm
Thu, 18 Jun 1998 18:28:45 +0200
changeset 5050 e925308df78b
parent 4091 771b1f6422a8
child 17245 1c519a3cca59
permissions -rw-r--r--
isatool fixgoal;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1459
d12da312eff4 expanded tabs
clasohm
parents: 1246
diff changeset
     1
(*  Title:      FOL/ex/NatClass.ML
1246
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
     2
    ID:         $Id$
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1459
diff changeset
     3
    Author:     Markus Wenzel, TU Muenchen
1246
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
     4
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
     5
This is Nat.ML trivially modified to make it work with NatClass.thy.
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
     6
*)
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
     7
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
     8
open NatClass;
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
     9
5050
e925308df78b isatool fixgoal;
wenzelm
parents: 4091
diff changeset
    10
Goal "Suc(k) ~= (k::'a::nat)";
1246
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    11
by (res_inst_tac [("n","k")] induct 1);
1459
d12da312eff4 expanded tabs
clasohm
parents: 1246
diff changeset
    12
by (rtac notI 1);
d12da312eff4 expanded tabs
clasohm
parents: 1246
diff changeset
    13
by (etac Suc_neq_0 1);
d12da312eff4 expanded tabs
clasohm
parents: 1246
diff changeset
    14
by (rtac notI 1);
d12da312eff4 expanded tabs
clasohm
parents: 1246
diff changeset
    15
by (etac notE 1);
d12da312eff4 expanded tabs
clasohm
parents: 1246
diff changeset
    16
by (etac Suc_inject 1);
1246
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    17
qed "Suc_n_not_n";
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    18
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    19
5050
e925308df78b isatool fixgoal;
wenzelm
parents: 4091
diff changeset
    20
Goal "(k+m)+n = k+(m+n)";
1246
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    21
prths ([induct] RL [topthm()]);  (*prints all 14 next states!*)
1459
d12da312eff4 expanded tabs
clasohm
parents: 1246
diff changeset
    22
by (rtac induct 1);
1246
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    23
back();
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    24
back();
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    25
back();
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    26
back();
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    27
back();
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    28
back();
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    29
5050
e925308df78b isatool fixgoal;
wenzelm
parents: 4091
diff changeset
    30
Goalw [add_def] "0+n = n";
1459
d12da312eff4 expanded tabs
clasohm
parents: 1246
diff changeset
    31
by (rtac rec_0 1);
1246
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    32
qed "add_0";
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    33
5050
e925308df78b isatool fixgoal;
wenzelm
parents: 4091
diff changeset
    34
Goalw [add_def] "Suc(m)+n = Suc(m+n)";
1459
d12da312eff4 expanded tabs
clasohm
parents: 1246
diff changeset
    35
by (rtac rec_Suc 1);
1246
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    36
qed "add_Suc";
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    37
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1459
diff changeset
    38
Addsimps [add_0, add_Suc];
1246
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    39
5050
e925308df78b isatool fixgoal;
wenzelm
parents: 4091
diff changeset
    40
Goal "(k+m)+n = k+(m+n)";
1246
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    41
by (res_inst_tac [("n","k")] induct 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1459
diff changeset
    42
by (Simp_tac 1);
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1459
diff changeset
    43
by (Asm_simp_tac 1);
1246
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    44
qed "add_assoc";
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    45
5050
e925308df78b isatool fixgoal;
wenzelm
parents: 4091
diff changeset
    46
Goal "m+0 = m";
1246
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    47
by (res_inst_tac [("n","m")] induct 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1459
diff changeset
    48
by (Simp_tac 1);
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1459
diff changeset
    49
by (Asm_simp_tac 1);
1246
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    50
qed "add_0_right";
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    51
5050
e925308df78b isatool fixgoal;
wenzelm
parents: 4091
diff changeset
    52
Goal "m+Suc(n) = Suc(m+n)";
1246
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    53
by (res_inst_tac [("n","m")] induct 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1459
diff changeset
    54
by (ALLGOALS (Asm_simp_tac));
1246
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    55
qed "add_Suc_right";
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    56
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    57
val [prem] = goal NatClass.thy "(!!n. f(Suc(n)) = Suc(f(n))) ==> f(i+j) = i+f(j)";
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    58
by (res_inst_tac [("n","i")] induct 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1459
diff changeset
    59
by (Simp_tac 1);
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 2469
diff changeset
    60
by (asm_simp_tac (simpset() addsimps [prem]) 1);
1246
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    61
result();