doc-src/HOL/HOL-rules.txt
author wenzelm
Wed Jul 25 12:38:54 2012 +0200 (2012-07-25)
changeset 48497 ba61aceaa18a
parent 6580 ff2c3ffd38ee
permissions -rw-r--r--
some updates on "Building a repository version of Isabelle";
wenzelm@6580
     1
ruleshell.ML lemmas.ML set.ML fun.ML subset.ML equalities.ML prod.ML sum.ML wf.ML mono.ML fixedpt.ML nat.ML list.ML
wenzelm@6580
     2
----------------------------------------------------------------
wenzelm@6580
     3
ruleshell.ML
wenzelm@6580
     4
wenzelm@6580
     5
\idx{refl}      t = t::'a
wenzelm@6580
     6
\idx{subst}     [| s = t; P(s) |] ==> P(t::'a)
wenzelm@6580
     7
\idx{abs},!!x::'a. f(x)::'b = g(x)) ==> (%x.f(x)) = (%x.g(x)))
wenzelm@6580
     8
\idx{disch}     (P ==> Q) ==> P-->Q
wenzelm@6580
     9
\idx{mp}        [| P-->Q;  P |] ==> Q
wenzelm@6580
    10
wenzelm@6580
    11
\idx{True_def}  True = ((%x.x)=(%x.x))
wenzelm@6580
    12
\idx{All_def}   All  = (%P. P = (%x.True))
wenzelm@6580
    13
\idx{Ex_def}    Ex   = (%P. P(Eps(P)))
wenzelm@6580
    14
\idx{False_def} False = (!P.P)
wenzelm@6580
    15
\idx{not_def}   not  = (%P. P-->False)
wenzelm@6580
    16
\idx{and_def}   op & = (%P Q. !R. (P-->Q-->R) --> R)
wenzelm@6580
    17
\idx{or_def}    op | = (%P Q. !R. (P-->R) --> (Q-->R) --> R)
wenzelm@6580
    18
\idx{Ex1_def}   Ex1 == (%P. ? x. P(x) & (! y. P(y) --> y=x))
wenzelm@6580
    19
wenzelm@6580
    20
\idx{iff}       (P-->Q) --> (Q-->P) --> (P=Q)
wenzelm@6580
    21
\idx{True_or_False}     (P=True) | (P=False)
wenzelm@6580
    22
\idx{select}    P(x::'a) --> P(Eps(P))
wenzelm@6580
    23
wenzelm@6580
    24
\idx{Inv_def}   Inv = (%(f::'a=>'b) y. @x. f(x)=y)
wenzelm@6580
    25
\idx{o_def}     op o = (%(f::'b=>'c) g (x::'a). f(g(x)))
wenzelm@6580
    26
\idx{Cond_def}  Cond = (%P x y.@z::'a. (P=True --> z=x) & (P=False --> z=y))
wenzelm@6580
    27
wenzelm@6580
    28
----------------------------------------------------------------
wenzelm@6580
    29
lemmas.ML
wenzelm@6580
    30
wenzelm@6580
    31
\idx{sym}    s=t ==> t=s
wenzelm@6580
    32
\idx{trans}    [| r=s; s=t |] ==> r=t
wenzelm@6580
    33
\idx{box_equals}    
wenzelm@6580
    34
    [| a=b;  a=c;  b=d |] ==> c=d  
wenzelm@6580
    35
\idx{ap_term}    s=t ==> f(s)=f(t)
wenzelm@6580
    36
\idx{ap_thm}    s::'a=>'b = t ==> s(x)=t(x)
wenzelm@6580
    37
\idx{cong}    
wenzelm@6580
    38
   [| f = g; x::'a = y |] ==> f(x) = g(y)
wenzelm@6580
    39
\idx{iffI}    
wenzelm@6580
    40
   [| P ==> Q;  Q ==> P |] ==> P=Q
wenzelm@6580
    41
\idx{iffD1}    [| P=Q; Q |] ==> P
wenzelm@6580
    42
\idx{iffE}    
wenzelm@6580
    43
    [| P=Q; [| P --> Q; Q --> P |] ==> R |] ==> R
wenzelm@6580
    44
\idx{eqTrueI}    P ==> P=True 
wenzelm@6580
    45
\idx{eqTrueE}    P=True ==> P 
wenzelm@6580
    46
\idx{allI}    (!!x::'a. P(x)) ==> !x. P(x)
wenzelm@6580
    47
\idx{spec}    !x::'a.P(x) ==> P(x)
wenzelm@6580
    48
\idx{allE}    [| !x.P(x);  P(x) ==> R |] ==> R
wenzelm@6580
    49
\idx{all_dupE}    
wenzelm@6580
    50
    [| ! x.P(x);  [| P(x); ! x.P(x) |] ==> R 
wenzelm@6580
    51
    |] ==> R
wenzelm@6580
    52
\idx{FalseE}    False ==> P
wenzelm@6580
    53
\idx{False_neq_True}    False=True ==> P
wenzelm@6580
    54
\idx{notI}    (P ==> False) ==> ~P
wenzelm@6580
    55
\idx{notE}    [| ~P;  P |] ==> R
wenzelm@6580
    56
\idx{impE}    [| P-->Q;  P;  Q ==> R |] ==> R
wenzelm@6580
    57
\idx{rev_mp}    [| P;  P --> Q |] ==> Q
wenzelm@6580
    58
\idx{contrapos}    [| ~Q;  P==>Q |] ==> ~P
wenzelm@6580
    59
\idx{exI}    P(x) ==> ? x::'a.P(x)
wenzelm@6580
    60
\idx{exE}    [| ? x::'a.P(x); !!x. P(x) ==> Q |] ==> Q
wenzelm@6580
    61
wenzelm@6580
    62
\idx{conjI}    [| P; Q |] ==> P&Q
wenzelm@6580
    63
\idx{conjunct1}    [| P & Q |] ==> P
wenzelm@6580
    64
\idx{conjunct2}    [| P & Q |] ==> Q 
wenzelm@6580
    65
\idx{conjE}    [| P&Q;  [| P; Q |] ==> R |] ==> R
wenzelm@6580
    66
\idx{disjI1}    P ==> P|Q
wenzelm@6580
    67
\idx{disjI2}    Q ==> P|Q
wenzelm@6580
    68
\idx{disjE}    [| P | Q; P ==> R; Q ==> R |] ==> R
wenzelm@6580
    69
\idx{ccontr}    (~P ==> False) ==> P
wenzelm@6580
    70
\idx{classical}    (~P ==> P) ==> P
wenzelm@6580
    71
\idx{notnotD}    ~~P ==> P
wenzelm@6580
    72
\idx{ex1I}    
wenzelm@6580
    73
    [| P(a);  !!x. P(x) ==> x=a |] ==> ?! x. P(x)
wenzelm@6580
    74
\idx{ex1E}    
wenzelm@6580
    75
    [| ?! x.P(x);  !!x. [| P(x);  ! y. P(y) --> y=x |] ==> R |] ==> R
wenzelm@6580
    76
\idx{select_equality}    
wenzelm@6580
    77
    [| P(a);  !!x. P(x) ==> x=a |] ==> (@x.P(x)) = a
wenzelm@6580
    78
\idx{disjCI}    (~Q ==> P) ==> P|Q
wenzelm@6580
    79
\idx{excluded_middle}    ~P | P
wenzelm@6580
    80
\idx{impCE}    [| P-->Q; ~P ==> R; Q ==> R |] ==> R 
wenzelm@6580
    81
\idx{iffCE}    
wenzelm@6580
    82
    [| P=Q;  [| P; Q |] ==> R;  [| ~P; ~Q |] ==> R |] ==> R
wenzelm@6580
    83
\idx{exCI}    (! x. ~P(x) ==> P(a)) ==> ? x.P(x)
wenzelm@6580
    84
\idx{swap}    ~P ==> (~Q ==> P) ==> Q
wenzelm@6580
    85
wenzelm@6580
    86
----------------------------------------------------------------
wenzelm@6580
    87
simpdata.ML
wenzelm@6580
    88
wenzelm@6580
    89
\idx{if_True}    Cond(True,x,y) = x
wenzelm@6580
    90
\idx{if_False}    Cond(False,x,y) = y
wenzelm@6580
    91
\idx{if_P}    P ==> Cond(P,x,y) = x
wenzelm@6580
    92
\idx{if_not_P}    ~P ==> Cond(P,x,y) = y
wenzelm@6580
    93
\idx{expand_if}    
wenzelm@6580
    94
    P(Cond(Q,x,y)) = ((Q --> P(x)) & (~Q --> P(y)))
wenzelm@6580
    95
wenzelm@6580
    96
----------------------------------------------------------------
wenzelm@6580
    97
\idx{set.ML}
wenzelm@6580
    98
wenzelm@6580
    99
\idx{CollectI}          [| P(a) |] ==> a : \{x.P(x)\}
wenzelm@6580
   100
\idx{CollectD}          [| a : \{x.P(x)\} |] ==> P(a)
wenzelm@6580
   101
\idx{set_ext}           [| !!x. (x:A) = (x:B) |] ==> A = B
wenzelm@6580
   102
wenzelm@6580
   103
\idx{Ball_def}          Ball(A,P)  == ! x. x:A --> P(x)
wenzelm@6580
   104
\idx{Bex_def}           Bex(A,P)   == ? x. x:A & P(x)
wenzelm@6580
   105
\idx{subset_def}        A <= B     == ! x:A. x:B
wenzelm@6580
   106
\idx{Un_def}            A Un B     == \{x.x:A | x:B\}
wenzelm@6580
   107
\idx{Int_def}           A Int B    == \{x.x:A & x:B\}
wenzelm@6580
   108
\idx{Compl_def}         Compl(A)   == \{x. ~x:A\}
wenzelm@6580
   109
\idx{Inter_def}         Inter(S)   == \{x. ! A:S. x:A\}
wenzelm@6580
   110
\idx{Union_def}         Union(S)   == \{x. ? A:S. x:A\}
wenzelm@6580
   111
\idx{INTER_def}         INTER(A,B) == \{y. ! x:A. y: B(x)\}
wenzelm@6580
   112
\idx{UNION_def}         UNION(A,B) == \{y. ? x:A. y: B(x)\}
wenzelm@6580
   113
\idx{mono_def}          mono(f)    == (!A B. A <= B --> f(A) <= f(B))
wenzelm@6580
   114
\idx{image_def}         f``A       == \{y. ? x:A. y=f(x)\}
wenzelm@6580
   115
\idx{singleton_def}     \{a\}      == \{x.x=a\}
wenzelm@6580
   116
\idx{range_def}         range(f)   == \{y. ? x. y=f(x)\}
wenzelm@6580
   117
\idx{One_One_def}       One_One(f) == ! x y. f(x)=f(y) --> x=y
wenzelm@6580
   118
\idx{One_One_on_def}    One_One_on(f,A) == !x y. x:A --> y:A --> f(x)=f(y) --> x=y
wenzelm@6580
   119
\idx{Onto_def}          Onto(f) == ! y. ? x. y=f(x)
wenzelm@6580
   120
wenzelm@6580
   121
wenzelm@6580
   122
\idx{Collect_cong}    [| !!x. P(x)=Q(x) |] ==> \{x. P(x)\} = \{x. Q(x)\}
wenzelm@6580
   123
wenzelm@6580
   124
\idx{ballI}    [| !!x. x:A ==> P(x) |] ==> ! x:A. P(x)
wenzelm@6580
   125
\idx{bspec}    [| ! x:A. P(x);  x:A |] ==> P(x)
wenzelm@6580
   126
\idx{ballE}    [| ! x:A. P(x);  P(x) ==> Q;  ~ x:A ==> Q |] ==> Q
wenzelm@6580
   127
wenzelm@6580
   128
\idx{bexI}     [| P(x);  x:A |] ==> ? x:A. P(x)
wenzelm@6580
   129
\idx{bexCI}    [| ! x:A. ~P(x) ==> P(a);  a:A |] ==> ? x:A.P(x)
wenzelm@6580
   130
\idx{bexE}     [| ? x:A. P(x);  !!x. [| x:A; P(x) |] ==> Q  |] ==> Q
wenzelm@6580
   131
wenzelm@6580
   132
\idx{ball_cong}
wenzelm@6580
   133
    [| A=A';  !!x. x:A' ==> P(x) = P'(x) |] ==> 
wenzelm@6580
   134
    (! x:A. P(x)) = (! x:A'. P'(x))
wenzelm@6580
   135
wenzelm@6580
   136
\idx{bex_cong}
wenzelm@6580
   137
    [| A=A';  !!x. x:A' ==> P(x) = P'(x) |] ==> 
wenzelm@6580
   138
    (? x:A. P(x)) = (? x:A'. P'(x))
wenzelm@6580
   139
wenzelm@6580
   140
\idx{subsetI}         (!!x.x:A ==> x:B) ==> A <= B
wenzelm@6580
   141
\idx{subsetD}         [| A <= B;  c:A |] ==> c:B
wenzelm@6580
   142
\idx{subsetCE}        [| A <= B;  ~(c:A) ==> P;  c:B ==> P |] ==> P
wenzelm@6580
   143
wenzelm@6580
   144
\idx{subset_refl}     A <= A
wenzelm@6580
   145
\idx{subset_antisym}  [| A <= B;  B <= A |] ==> A = B
wenzelm@6580
   146
\idx{subset_trans}    [| A<=B;  B<=C |] ==> A<=C
wenzelm@6580
   147
wenzelm@6580
   148
\idx{equalityD1}      A = B ==> A<=B
wenzelm@6580
   149
\idx{equalityD2}      A = B ==> B<=A
wenzelm@6580
   150
\idx{equalityE}       [| A = B;  [| A<=B; B<=A |] ==> P |]  ==>  P
wenzelm@6580
   151
wenzelm@6580
   152
\idx{singletonI}      a : \{a\}
wenzelm@6580
   153
\idx{singletonD}      b : \{a\} ==> b=a
wenzelm@6580
   154
wenzelm@6580
   155
\idx{imageI}    [| x:A |] ==> f(x) : f``A
wenzelm@6580
   156
\idx{imageE}    [| b : f``A;  !!x.[| b=f(x);  x:A |] ==> P |] ==> P
wenzelm@6580
   157
wenzelm@6580
   158
\idx{rangeI}    f(x) : range(f)
wenzelm@6580
   159
\idx{rangeE}    [| b : range(f);  !!x.[| b=f(x) |] ==> P |] ==> P
wenzelm@6580
   160
wenzelm@6580
   161
\idx{UnionI}    [| X:C;  A:X |] ==> A : Union(C)
wenzelm@6580
   162
\idx{UnionE}    [| A : Union(C);  !!X.[| A:X;  X:C |] ==> R |] ==> R
wenzelm@6580
   163
wenzelm@6580
   164
\idx{InterI}    [| !!X. X:C ==> A:X |] ==> A : Inter(C)
wenzelm@6580
   165
\idx{InterD}    [| A : Inter(C);  X:C |] ==> A:X
wenzelm@6580
   166
\idx{InterE}    [| A : Inter(C);  A:X ==> R;  ~ X:C ==> R |] ==> R
wenzelm@6580
   167
wenzelm@6580
   168
\idx{UN_I}    [| a:A;  b: B(a) |] ==> b: (UN x:A. B(x))
wenzelm@6580
   169
\idx{UN_E}    [| b : (UN x:A. B(x));  !!x.[| x:A;  b: B(x) |] ==> R |] ==> R
wenzelm@6580
   170
wenzelm@6580
   171
\idx{INT_I}    (!!x. x:A ==> b: B(x)) ==> b : (INT x:A. B(x))
wenzelm@6580
   172
\idx{INT_D}    [| b : (INT x:A. B(x));  a:A |] ==> b: B(a)
wenzelm@6580
   173
\idx{INT_E}    [| b : (INT x:A. B(x));  b: B(a) ==> R;  ~ a:A ==> R |] ==> R
wenzelm@6580
   174
wenzelm@6580
   175
\idx{UnI1}    c:A ==> c : A Un B
wenzelm@6580
   176
\idx{UnI2}    c:B ==> c : A Un B
wenzelm@6580
   177
\idx{UnCI}    (~c:B ==> c:A) ==> c : A Un B
wenzelm@6580
   178
\idx{UnE}    [| c : A Un B;  c:A ==> P;  c:B ==> P |] ==> P
wenzelm@6580
   179
wenzelm@6580
   180
\idx{IntI}    [| c:A;  c:B |] ==> c : A Int B
wenzelm@6580
   181
\idx{IntD1}    c : A Int B ==> c:A
wenzelm@6580
   182
\idx{IntD2}    c : A Int B ==> c:B
wenzelm@6580
   183
\idx{IntE}    [| c : A Int B;  [| c:A; c:B |] ==> P |] ==> P
wenzelm@6580
   184
wenzelm@6580
   185
\idx{ComplI}    [| c:A ==> False |] ==> c : Compl(A)
wenzelm@6580
   186
\idx{ComplD}    [| c : Compl(A) |] ==> ~c:A
wenzelm@6580
   187
wenzelm@6580
   188
\idx{monoI}    [| !!A B. A <= B ==> f(A) <= f(B) |] ==> mono(f)
wenzelm@6580
   189
\idx{monoD}    [| mono(f);  A <= B |] ==> f(A) <= f(B)
wenzelm@6580
   190
wenzelm@6580
   191
wenzelm@6580
   192
----------------------------------------------------------------
wenzelm@6580
   193
\idx{fun.ML}
wenzelm@6580
   194
wenzelm@6580
   195
\idx{One_OneI}            [| !! x y. f(x) = f(y) ==> x=y |] ==> One_One(f)
wenzelm@6580
   196
\idx{One_One_inverseI}    (!!x. g(f(x)) = x) ==> One_One(f)
wenzelm@6580
   197
\idx{One_OneD}            [| One_One(f); f(x) = f(y) |] ==> x=y
wenzelm@6580
   198
wenzelm@6580
   199
\idx{Inv_f_f}             One_One(f)   ==> Inv(f,f(x)) = x
wenzelm@6580
   200
\idx{f_Inv_f}             y : range(f) ==> f(Inv(f,y)) = y
wenzelm@6580
   201
wenzelm@6580
   202
\idx{Inv_injective}
wenzelm@6580
   203
    [| Inv(f,x)=Inv(f,y); x: range(f);  y: range(f) |] ==> x=y
wenzelm@6580
   204
wenzelm@6580
   205
\idx{One_One_onI}
wenzelm@6580
   206
    (!! x y. [| f(x) = f(y); x:A; y:A |] ==> x=y) ==> One_One_on(f,A)
wenzelm@6580
   207
wenzelm@6580
   208
\idx{One_One_on_inverseI}
wenzelm@6580
   209
    (!!x. x:A ==> g(f(x)) = x) ==> One_One_on(f,A)
wenzelm@6580
   210
wenzelm@6580
   211
\idx{One_One_onD}
wenzelm@6580
   212
    [| One_One_on(f,A);  f(x)=f(y);  x:A;  y:A |] ==> x=y
wenzelm@6580
   213
wenzelm@6580
   214
\idx{One_One_on_contraD}
wenzelm@6580
   215
    [| One_One_on(f,A);  ~x=y;  x:A;  y:A |] ==> ~ f(x)=f(y)
wenzelm@6580
   216
wenzelm@6580
   217
wenzelm@6580
   218
----------------------------------------------------------------
wenzelm@6580
   219
\idx{subset.ML}
wenzelm@6580
   220
wenzelm@6580
   221
\idx{Union_upper}     B:A ==> B <= Union(A)
wenzelm@6580
   222
\idx{Union_least}     [| !!X. X:A ==> X<=C |] ==> Union(A) <= C
wenzelm@6580
   223
wenzelm@6580
   224
\idx{Inter_lower}     B:A ==> Inter(A) <= B
wenzelm@6580
   225
\idx{Inter_greatest}  [| !!X. X:A ==> C<=X |] ==> C <= Inter(A)
wenzelm@6580
   226
wenzelm@6580
   227
\idx{Un_upper1}       A <= A Un B
wenzelm@6580
   228
\idx{Un_upper2}       B <= A Un B
wenzelm@6580
   229
\idx{Un_least}        [| A<=C;  B<=C |] ==> A Un B <= C
wenzelm@6580
   230
wenzelm@6580
   231
\idx{Int_lower1}      A Int B <= A
wenzelm@6580
   232
\idx{Int_lower2}      A Int B <= B
wenzelm@6580
   233
\idx{Int_greatest}    [| C<=A;  C<=B |] ==> C <= A Int B
wenzelm@6580
   234
wenzelm@6580
   235
wenzelm@6580
   236
----------------------------------------------------------------
wenzelm@6580
   237
\idx{equalities.ML}
wenzelm@6580
   238
wenzelm@6580
   239
\idx{Int_absorb}        A Int A = A
wenzelm@6580
   240
\idx{Int_commute}       A Int B  =  B Int A
wenzelm@6580
   241
\idx{Int_assoc}         (A Int B) Int C  =  A Int (B Int C)
wenzelm@6580
   242
\idx{Int_Un_distrib}    (A Un B) Int C  =  (A Int C) Un (B Int C)
wenzelm@6580
   243
wenzelm@6580
   244
\idx{Un_absorb}         A Un A = A
wenzelm@6580
   245
\idx{Un_commute}        A Un B  =  B Un A
wenzelm@6580
   246
\idx{Un_assoc}          (A Un B) Un C  =  A Un (B Un C)
wenzelm@6580
   247
\idx{Un_Int_distrib}    (A Int B) Un C  =  (A Un C) Int (B Un C)
wenzelm@6580
   248
wenzelm@6580
   249
\idx{Compl_disjoint}    A Int Compl(A) = \{x.False\}
wenzelm@6580
   250
\idx{Compl_partition    A Un Compl(A) = \{x.True\}
wenzelm@6580
   251
\idx{double_complement} Compl(Compl(A)) = A
wenzelm@6580
   252
wenzelm@6580
   253
wenzelm@6580
   254
\idx{Compl_Un}          Compl(A Un B) = Compl(A) Int Compl(B)
wenzelm@6580
   255
\idx{Compl_Int}         Compl(A Int B) = Compl(A) Un Compl(B)
wenzelm@6580
   256
wenzelm@6580
   257
\idx{Union_Un_distrib}  Union(A Un B) = Union(A) Un Union(B)
wenzelm@6580
   258
\idx{Int_Union_image}   A Int Union(B) = (UN C:B. A Int C)
wenzelm@6580
   259
\idx{Un_Union_image}    (UN x:C. A(x) Un B(x)) = Union(A``C)  Un  Union(B``C)
wenzelm@6580
   260
wenzelm@6580
   261
\idx{Inter_Un_distrib}  Inter(A Un B) = Inter(A) Int Inter(B)
wenzelm@6580
   262
\idx{Un_Inter_image}    A Un Inter(B) = (INT C:B. A Un C)
wenzelm@6580
   263
\idx{Int_Inter_image}   (INT x:C. A(x) Int B(x)) = Inter(A``C) Int Inter(B``C)
wenzelm@6580
   264
wenzelm@6580
   265
wenzelm@6580
   266
----------------------------------------------------------------
wenzelm@6580
   267
prod.ML
wenzelm@6580
   268
wenzelm@6580
   269
      mixfix = [ Delimfix((1<_,/_>), ['a,'b] => ('a,'b)prod, Pair),
wenzelm@6580
   270
                 TInfixl(*, prod, 20) ],
wenzelm@6580
   271
thy = extend_theory Set.thy Prod
wenzelm@6580
   272
  [([prod],([[term],[term]],term))],
wenzelm@6580
   273
   ([fst],              'a * 'b => 'a),
wenzelm@6580
   274
   ([snd],              'a * 'b => 'b),
wenzelm@6580
   275
   ([split],            ['a * 'b, ['a,'b]=>'c] => 'c)],
wenzelm@6580
   276
\idx{fst_def}             fst(p) == @a. ? b. p = <a,b>),
wenzelm@6580
   277
\idx{snd_def}             snd(p) == @b. ? a. p = <a,b>),
wenzelm@6580
   278
\idx{split_def}           split(p,c) == c(fst(p),snd(p)))
wenzelm@6580
   279
wenzelm@6580
   280
\idx{Pair_inject}  [| <a, b> = <a',b'>;  [| a=a';  b=b' |] ==> R |] ==> R
wenzelm@6580
   281
wenzelm@6580
   282
\idx{fst_conv}     fst(<a,b>) = a
wenzelm@6580
   283
\idx{snd_conv}     snd(<a,b>) = b
wenzelm@6580
   284
\idx{split_conv}   split(<a,b>, c) = c(a,b)
wenzelm@6580
   285
wenzelm@6580
   286
\idx{surjective_pairing}    p = <fst(p),snd(p)>
wenzelm@6580
   287
wenzelm@6580
   288
----------------------------------------------------------------
wenzelm@6580
   289
sum.ML
wenzelm@6580
   290
wenzelm@6580
   291
      mixfix = [TInfixl(+, sum, 10)],
wenzelm@6580
   292
thy = extend_theory Prod.thy sum
wenzelm@6580
   293
  [([sum], ([[term],[term]],term))],
wenzelm@6580
   294
 [Inl],              'a => 'a+'b),
wenzelm@6580
   295
 [Inr],              'b => 'a+'b),
wenzelm@6580
   296
 [when],             ['a+'b, 'a=>'c, 'b=>'c] =>'c)],
wenzelm@6580
   297
\idx{when_def}    when == (%p f g. @z.  (!x. p=Inl(x) --> z=f(x))
wenzelm@6580
   298
                                    & (!y. p=Inr(y) --> z=g(y))))
wenzelm@6580
   299
wenzelm@6580
   300
\idx{Inl_not_Inr}    ~ (Inl(a) = Inr(b))
wenzelm@6580
   301
wenzelm@6580
   302
\idx{One_One_Inl}    One_One(Inl)
wenzelm@6580
   303
wenzelm@6580
   304
\idx{One_One_Inr}    One_One(Inr)
wenzelm@6580
   305
wenzelm@6580
   306
\idx{when_Inl_conv}    when(Inl(x), f, g) = f(x)
wenzelm@6580
   307
wenzelm@6580
   308
\idx{when_Inr_conv}    when(Inr(x), f, g) = g(x)
wenzelm@6580
   309
wenzelm@6580
   310
\idx{sumE}
wenzelm@6580
   311
    [| !!x::'a. P(Inl(x));  !!y::'b. P(Inr(y)) 
wenzelm@6580
   312
    |] ==> P(s)
wenzelm@6580
   313
wenzelm@6580
   314
\idx{surjective_sum}    when(s, %x::'a. f(Inl(x)), %y::'b. f(Inr(y))) = f(s)
wenzelm@6580
   315
wenzelm@6580
   316
wenzelm@6580
   317
????????????????????????????????????????????????????????????????
wenzelm@6580
   318
trancl?
wenzelm@6580
   319
wenzelm@6580
   320
----------------------------------------------------------------
wenzelm@6580
   321
nat.ML
wenzelm@6580
   322
wenzelm@6580
   323
  Sext\{mixfix=[Delimfix(0, nat, 0),
wenzelm@6580
   324
               Infixl(<,[nat,nat] => bool,50)],
wenzelm@6580
   325
thy = extend_theory Trancl.thy Nat
wenzelm@6580
   326
[nat], ([],term))
wenzelm@6580
   327
[nat_case],          [nat, 'a, nat=>'a] =>'a),
wenzelm@6580
   328
[pred_nat],nat*nat) set),
wenzelm@6580
   329
[nat_rec],           [nat, 'a, [nat, 'a]=>'a] => 'a)
wenzelm@6580
   330
wenzelm@6580
   331
\idx{nat_case_def}        nat_case == (%n a f. @z.  (n=0 --> z=a)  
wenzelm@6580
   332
                                          & (!x. n=Suc(x) --> z=f(x)))),
wenzelm@6580
   333
\idx{pred_nat_def}        pred_nat == \{p. ? n. p = <n, Suc(n)>\} ),
wenzelm@6580
   334
\idx{less_def} m<n == <m,n>:trancl(pred_nat)),
wenzelm@6580
   335
\idx{nat_rec_def} 
wenzelm@6580
   336
   nat_rec(n,c,d) == wfrec(trancl(pred_nat), 
wenzelm@6580
   337
                        %rec l. nat_case(l, c, %m. d(m,rec(m))), 
wenzelm@6580
   338
                        n) )
wenzelm@6580
   339
wenzelm@6580
   340
\idx{nat_induct}    [| P(0); !!k. [| P(k) |] ==> P(Suc(k)) |]  ==> P(n)
wenzelm@6580
   341
wenzelm@6580
   342
wenzelm@6580
   343
\idx{Suc_not_Zero}    ~ (Suc(m) = 0)
wenzelm@6580
   344
\idx{One_One_Suc}    One_One(Suc)
wenzelm@6580
   345
\idx{n_not_Suc_n}    ~(n=Suc(n))
wenzelm@6580
   346
wenzelm@6580
   347
\idx{nat_case_0_conv}    nat_case(0, a, f) = a
wenzelm@6580
   348
wenzelm@6580
   349
\idx{nat_case_Suc_conv}    nat_case(Suc(k), a, f) = f(k)
wenzelm@6580
   350
wenzelm@6580
   351
\idx{pred_natI}    <n, Suc(n)> : pred_nat
wenzelm@6580
   352
\idx{pred_natE}
wenzelm@6580
   353
    [| p : pred_nat;  !!x n. [| p = <n, Suc(n)> |] ==> R 
wenzelm@6580
   354
    |] ==> R
wenzelm@6580
   355
wenzelm@6580
   356
\idx{wf_pred_nat}    wf(pred_nat)
wenzelm@6580
   357
wenzelm@6580
   358
\idx{nat_rec_0_conv}    nat_rec(0,c,h) = c
wenzelm@6580
   359
wenzelm@6580
   360
\idx{nat_rec_Suc_conv}    nat_rec(Suc(n), c, h) = h(n, nat_rec(n,c,h))
wenzelm@6580
   361
wenzelm@6580
   362
wenzelm@6580
   363
(*** Basic properties of less than ***)
wenzelm@6580
   364
\idx{less_trans}     [| i<j;  j<k |] ==> i<k
wenzelm@6580
   365
\idx{lessI}          n < Suc(n)
wenzelm@6580
   366
\idx{zero_less_Suc}  0 < Suc(n)
wenzelm@6580
   367
wenzelm@6580
   368
\idx{less_not_sym}   n<m --> ~m<n 
wenzelm@6580
   369
\idx{less_not_refl}  ~ (n<n)
wenzelm@6580
   370
\idx{not_less0}      ~ (n<0)
wenzelm@6580
   371
wenzelm@6580
   372
\idx{Suc_less_eq}    (Suc(m) < Suc(n)) = (m<n)
wenzelm@6580
   373
\idx{less_induct}    [| !!n. [| ! m. m<n --> P(m) |] ==> P(n) |]  ==>  P(n)
wenzelm@6580
   374
wenzelm@6580
   375
\idx{less_linear}    m<n | m=n | n<m
wenzelm@6580
   376
wenzelm@6580
   377
wenzelm@6580
   378
----------------------------------------------------------------
wenzelm@6580
   379
list.ML
wenzelm@6580
   380
wenzelm@6580
   381
 [([list], ([[term]],term))],
wenzelm@6580
   382
  ([Nil],       'a list),
wenzelm@6580
   383
  ([Cons],      ['a, 'a list] => 'a list),
wenzelm@6580
   384
  ([list_rec],        ['a list, 'b, ['a ,'a list, 'b]=>'b] => 'b),
wenzelm@6580
   385
  ([list_all],        ('a => bool) => ('a list => bool)),
wenzelm@6580
   386
  ([map],               ('a=>'b) => ('a list => 'b list))
wenzelm@6580
   387
wenzelm@6580
   388
\idx{map_def}     map(f,xs) == list_rec(xs, Nil, %x l r. Cons(f(x), r)) )
wenzelm@6580
   389
wenzelm@6580
   390
\idx{list_induct}
wenzelm@6580
   391
    [| P(Nil);   
wenzelm@6580
   392
       !!x xs. [| P(xs) |] ==> P(Cons(x,xs)) |]  ==> P(l)
wenzelm@6580
   393
wenzelm@6580
   394
\idx{Cons_not_Nil}   ~ Cons(x,xs) = Nil
wenzelm@6580
   395
\idx{Cons_Cons_eq}   (Cons(x,xs)=Cons(y,ys)) = (x=y & xs=ys)
wenzelm@6580
   396
wenzelm@6580
   397
\idx{list_rec_Nil_conv}    list_rec(Nil,c,h) = c
wenzelm@6580
   398
\idx{list_rec_Cons_conv}   list_rec(Cons(a,l), c, h) = 
wenzelm@6580
   399
                               h(a, l, list_rec(l,c,h))
wenzelm@6580
   400
wenzelm@6580
   401
\idx{map_Nil_conv}   map(f,Nil) = Nil
wenzelm@6580
   402
\idx{map_Cons_conv}  map(f, Cons(x,xs)) = Cons(f(x), map(f,xs))
wenzelm@6580
   403