src/HOL/AxClasses/Tutorial/Group.ML
author wenzelm
Wed, 03 Feb 1999 16:42:40 +0100
changeset 6188 c40e5ac04e3e
parent 5711 5a1cd4b4b20e
permissions -rw-r--r--
added is_draft; renamed sig to PRIVATE_THEORY;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1247
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
     1
(*  Title:      HOL/AxClasses/Tutorial/Group.ML
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
     2
    ID:         $Id$
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
     3
    Author:     Markus Wenzel, TU Muenchen
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
     4
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
     5
Some basic theorems of group theory.
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
     6
*)
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
     7
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
     8
fun sub r = standard (r RS subst);
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
     9
fun ssub r = standard (r RS ssubst);
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
    10
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
    11
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 2907
diff changeset
    12
Goal "x <*> inverse x = (1::'a::group)";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    13
by (rtac (sub left_unit) 1);
1247
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
    14
back();
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    15
by (rtac (sub assoc) 1);
2907
0e272e4c7cb2 inv -> inverse
nipkow
parents: 1465
diff changeset
    16
by (rtac (sub left_inverse) 1);
1247
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
    17
back();
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
    18
back();
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    19
by (rtac (ssub assoc) 1);
1247
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
    20
back();
2907
0e272e4c7cb2 inv -> inverse
nipkow
parents: 1465
diff changeset
    21
by (rtac (ssub left_inverse) 1);
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    22
by (rtac (ssub assoc) 1);
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    23
by (rtac (ssub left_unit) 1);
2907
0e272e4c7cb2 inv -> inverse
nipkow
parents: 1465
diff changeset
    24
by (rtac (ssub left_inverse) 1);
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    25
by (rtac refl 1);
2907
0e272e4c7cb2 inv -> inverse
nipkow
parents: 1465
diff changeset
    26
qed "right_inverse";
1247
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
    27
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
    28
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 2907
diff changeset
    29
Goal "x <*> 1 = (x::'a::group)";
2907
0e272e4c7cb2 inv -> inverse
nipkow
parents: 1465
diff changeset
    30
by (rtac (sub left_inverse) 1);
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    31
by (rtac (sub assoc) 1);
2907
0e272e4c7cb2 inv -> inverse
nipkow
parents: 1465
diff changeset
    32
by (rtac (ssub right_inverse) 1);
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    33
by (rtac (ssub left_unit) 1);
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    34
by (rtac refl 1);
1247
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
    35
qed "right_unit";
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
    36
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
    37
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 2907
diff changeset
    38
Goal "e <*> x = x --> e = (1::'a::group)";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    39
by (rtac impI 1);
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    40
by (rtac (sub right_unit) 1);
1247
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
    41
back();
2907
0e272e4c7cb2 inv -> inverse
nipkow
parents: 1465
diff changeset
    42
by (res_inst_tac [("x", "x")] (sub right_inverse) 1);
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    43
by (rtac (sub assoc) 1);
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    44
by (rtac arg_cong 1);
1247
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
    45
back();
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    46
by (assume_tac 1);
1247
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
    47
qed "strong_one_unit";
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
    48
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
    49
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 2907
diff changeset
    50
Goal "EX! e. ALL x. e <*> x = (x::'a::group)";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    51
by (rtac ex1I 1);
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    52
by (rtac allI 1);
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    53
by (rtac left_unit 1);
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    54
by (rtac mp 1);
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    55
by (rtac strong_one_unit 1);
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    56
by (etac allE 1);
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    57
by (assume_tac 1);
1247
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
    58
qed "ex1_unit";
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
    59
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
    60
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 2907
diff changeset
    61
Goal "ALL x. EX! e. e <*> x = (x::'a::group)";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    62
by (rtac allI 1);
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    63
by (rtac ex1I 1);
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    64
by (rtac left_unit 1);
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    65
by (rtac (strong_one_unit RS mp) 1);
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    66
by (assume_tac 1);
1247
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
    67
qed "ex1_unit'";
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
    68
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
    69
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 2907
diff changeset
    70
Goal "y <*> x = 1 --> y = inverse (x::'a::group)";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    71
by (rtac impI 1);
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    72
by (rtac (sub right_unit) 1);
1247
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
    73
back();
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
    74
back();
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    75
by (rtac (sub right_unit) 1);
2907
0e272e4c7cb2 inv -> inverse
nipkow
parents: 1465
diff changeset
    76
by (res_inst_tac [("x", "x")] (sub right_inverse) 1);
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    77
by (rtac (sub assoc) 1);
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    78
by (rtac (sub assoc) 1);
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    79
by (rtac arg_cong 1);
1247
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
    80
back();
2907
0e272e4c7cb2 inv -> inverse
nipkow
parents: 1465
diff changeset
    81
by (rtac (ssub left_inverse) 1);
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    82
by (assume_tac 1);
2907
0e272e4c7cb2 inv -> inverse
nipkow
parents: 1465
diff changeset
    83
qed "one_inverse";
1247
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
    84
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
    85
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 2907
diff changeset
    86
Goal "ALL x. EX! y. y <*> x = (1::'a::group)";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    87
by (rtac allI 1);
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    88
by (rtac ex1I 1);
2907
0e272e4c7cb2 inv -> inverse
nipkow
parents: 1465
diff changeset
    89
by (rtac left_inverse 1);
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    90
by (rtac mp 1);
2907
0e272e4c7cb2 inv -> inverse
nipkow
parents: 1465
diff changeset
    91
by (rtac one_inverse 1);
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    92
by (assume_tac 1);
2907
0e272e4c7cb2 inv -> inverse
nipkow
parents: 1465
diff changeset
    93
qed "ex1_inverse";
1247
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
    94
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
    95
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 2907
diff changeset
    96
Goal "inverse (x <*> y) = inverse y <*> inverse (x::'a::group)";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    97
by (rtac sym 1);
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
    98
by (rtac mp 1);
2907
0e272e4c7cb2 inv -> inverse
nipkow
parents: 1465
diff changeset
    99
by (rtac one_inverse 1);
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
   100
by (rtac (ssub assoc) 1);
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
   101
by (rtac (sub assoc) 1);
1247
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
   102
back();
2907
0e272e4c7cb2 inv -> inverse
nipkow
parents: 1465
diff changeset
   103
by (rtac (ssub left_inverse) 1);
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
   104
by (rtac (ssub left_unit) 1);
2907
0e272e4c7cb2 inv -> inverse
nipkow
parents: 1465
diff changeset
   105
by (rtac (ssub left_inverse) 1);
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
   106
by (rtac refl 1);
2907
0e272e4c7cb2 inv -> inverse
nipkow
parents: 1465
diff changeset
   107
qed "inverse_product";
1247
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
   108
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
   109
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 2907
diff changeset
   110
Goal "inverse (inverse x) = (x::'a::group)";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
   111
by (rtac sym 1);
2907
0e272e4c7cb2 inv -> inverse
nipkow
parents: 1465
diff changeset
   112
by (rtac (one_inverse RS mp) 1);
0e272e4c7cb2 inv -> inverse
nipkow
parents: 1465
diff changeset
   113
by (rtac (ssub right_inverse) 1);
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1247
diff changeset
   114
by (rtac refl 1);
2907
0e272e4c7cb2 inv -> inverse
nipkow
parents: 1465
diff changeset
   115
qed "inverse_inv";
1247
18b1441fb603 Various axiomatic type class demos;
wenzelm
parents:
diff changeset
   116