src/HOL/Import/replay.ML
author haftmann
Sat, 03 Mar 2012 21:01:32 +0100
changeset 46784 71d1ed1ed8d8
parent 46201 afdc69f5156e
permissions -rw-r--r--
dropped dead code
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14620
1be590fd2422 Minor cleanup of headers and some speedup of the HOL4 import.
skalberg
parents: 14516
diff changeset
     1
(*  Title:      HOL/Import/replay.ML
1be590fd2422 Minor cleanup of headers and some speedup of the HOL4 import.
skalberg
parents: 14516
diff changeset
     2
    Author:     Sebastian Skalberg (TU Muenchen)
1be590fd2422 Minor cleanup of headers and some speedup of the HOL4 import.
skalberg
parents: 14516
diff changeset
     3
*)
1be590fd2422 Minor cleanup of headers and some speedup of the HOL4 import.
skalberg
parents: 14516
diff changeset
     4
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
     5
structure Replay =  (* FIXME proper signature *)
14516
a183dec876ab Added HOL proof importer.
skalberg
parents:
diff changeset
     6
struct
a183dec876ab Added HOL proof importer.
skalberg
parents:
diff changeset
     7
a183dec876ab Added HOL proof importer.
skalberg
parents:
diff changeset
     8
open ProofKernel
a183dec876ab Added HOL proof importer.
skalberg
parents:
diff changeset
     9
a183dec876ab Added HOL proof importer.
skalberg
parents:
diff changeset
    10
exception REPLAY of string * string
a183dec876ab Added HOL proof importer.
skalberg
parents:
diff changeset
    11
fun ERR f mesg = REPLAY (f,mesg)
a183dec876ab Added HOL proof importer.
skalberg
parents:
diff changeset
    12
fun NY f = raise ERR f "NOT YET!"
a183dec876ab Added HOL proof importer.
skalberg
parents:
diff changeset
    13
a183dec876ab Added HOL proof importer.
skalberg
parents:
diff changeset
    14
fun replay_proof int_thms thyname thmname prf thy =
a183dec876ab Added HOL proof importer.
skalberg
parents:
diff changeset
    15
    let
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
    16
        fun rp (PRefl tm) thy = ProofKernel.REFL tm thy
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    17
          | rp (PInstT(p,lambda)) thy =
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    18
            let
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    19
                val (thy',th) = rp' p thy
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    20
            in
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
    21
                ProofKernel.INST_TYPE lambda th thy'
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    22
            end
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    23
          | rp (PSubst(prfs,ctxt,prf)) thy =
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    24
            let
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    25
                val (thy',ths) = fold_rev (fn p => fn (thy, ths) =>
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    26
                                           let
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    27
                                               val (thy',th) = rp' p thy
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    28
                                           in
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    29
                                               (thy',th::ths)
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    30
                                           end) prfs (thy,[])
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    31
                val (thy'',th) = rp' prf thy'
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    32
            in
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
    33
                ProofKernel.SUBST ths ctxt th thy''
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    34
            end
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    35
          | rp (PAbs(prf,v)) thy =
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    36
            let
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    37
                val (thy',th) = rp' prf thy
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    38
            in
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
    39
                ProofKernel.ABS v th thy'
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    40
            end
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    41
          | rp (PDisch(prf,tm)) thy =
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    42
            let
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    43
                val (thy',th) = rp' prf thy
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    44
            in
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
    45
                ProofKernel.DISCH tm th thy'
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    46
            end
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    47
          | rp (PMp(prf1,prf2)) thy =
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    48
            let
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    49
                val (thy1,th1) = rp' prf1 thy
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    50
                val (thy2,th2) = rp' prf2 thy1
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    51
            in
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
    52
                ProofKernel.MP th1 th2 thy2
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    53
            end
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
    54
          | rp (PHyp tm) thy = ProofKernel.ASSUME tm thy
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    55
          | rp (PDef(seg,name,rhs)) thy =
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
    56
            (case ProofKernel.get_def seg name rhs thy of
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    57
                 (thy',SOME res) => (thy',res)
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    58
               | (thy',NONE) => 
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    59
                 if seg = thyname
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
    60
                 then ProofKernel.new_definition seg name rhs thy'
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    61
                 else raise ERR "replay_proof" ("Too late for term definition: "^seg^" != "^thyname))
46784
71d1ed1ed8d8 dropped dead code
haftmann
parents: 46201
diff changeset
    62
          | rp (POracle _) thy = NY "ORACLE"
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    63
          | rp (PSpec(prf,tm)) thy =
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    64
            let
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    65
                val (thy',th) = rp' prf thy
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    66
            in
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
    67
                ProofKernel.SPEC tm th thy'
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    68
            end
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    69
          | rp (PInst(prf,theta)) thy =
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    70
            let
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    71
                val (thy',th) = rp' prf thy
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    72
            in
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
    73
                ProofKernel.INST theta th thy'
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    74
            end
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    75
          | rp (PGen(prf,v)) thy =
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    76
            let
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    77
                val (thy',th) = rp' prf thy
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
    78
                val p = ProofKernel.GEN v th thy'
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    79
            in
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    80
                p
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    81
            end
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    82
          | rp (PGenAbs(prf,opt,vl)) thy =
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    83
            let
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    84
                val (thy',th) = rp' prf thy
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    85
            in
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
    86
                ProofKernel.GEN_ABS opt vl th thy'
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    87
            end
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    88
          | rp (PImpAS(prf1,prf2)) thy =
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    89
            let
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    90
                val (thy1,th1) = rp' prf1 thy
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    91
                val (thy2,th2) = rp' prf2 thy1
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    92
            in
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
    93
                ProofKernel.IMP_ANTISYM th1 th2 thy2
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    94
            end
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    95
          | rp (PSym prf) thy =
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    96
            let
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    97
                val (thy1,th) = rp' prf thy
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
    98
            in
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
    99
                ProofKernel.SYM th thy1
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   100
            end
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   101
          | rp (PTrans(prf1,prf2)) thy =
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   102
            let
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   103
                val (thy1,th1) = rp' prf1 thy
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   104
                val (thy2,th2) = rp' prf2 thy1
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   105
            in
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
   106
                ProofKernel.TRANS th1 th2 thy2
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   107
            end
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   108
          | rp (PComb(prf1,prf2)) thy =
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   109
            let
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   110
                val (thy1,th1) = rp' prf1 thy
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   111
                val (thy2,th2) = rp' prf2 thy1
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   112
            in
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
   113
                ProofKernel.COMB th1 th2 thy2
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   114
            end
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   115
          | rp (PEqMp(prf1,prf2)) thy =
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   116
            let
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   117
                val (thy1,th1) = rp' prf1 thy
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   118
                val (thy2,th2) = rp' prf2 thy1
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   119
            in
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
   120
                ProofKernel.EQ_MP th1 th2 thy2
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   121
            end
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   122
          | rp (PEqImp prf) thy =
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   123
            let
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   124
                val (thy',th) = rp' prf thy
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   125
            in
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
   126
                ProofKernel.EQ_IMP_RULE th thy'
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   127
            end
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   128
          | rp (PExists(prf,ex,wit)) thy =
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   129
            let
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   130
                val (thy',th) = rp' prf thy
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   131
            in
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
   132
                ProofKernel.EXISTS ex wit th thy'
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   133
            end
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   134
          | rp (PChoose(v,prf1,prf2)) thy =
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   135
            let
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   136
                val (thy1,th1) = rp' prf1 thy
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   137
                val (thy2,th2) = rp' prf2 thy1
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   138
            in
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
   139
                ProofKernel.CHOOSE v th1 th2 thy2
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   140
            end
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   141
          | rp (PConj(prf1,prf2)) thy =
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   142
            let
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   143
                val (thy1,th1) = rp' prf1 thy
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   144
                val (thy2,th2) = rp' prf2 thy1
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   145
            in
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
   146
                ProofKernel.CONJ th1 th2 thy2
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   147
            end
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   148
          | rp (PConjunct1 prf) thy =
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   149
            let
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   150
                val (thy',th) = rp' prf thy
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   151
            in
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
   152
                ProofKernel.CONJUNCT1 th thy'
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   153
            end
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   154
          | rp (PConjunct2 prf) thy =
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   155
            let
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   156
                val (thy',th) = rp' prf thy
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   157
            in
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
   158
                ProofKernel.CONJUNCT2 th thy'
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   159
            end
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   160
          | rp (PDisj1(prf,tm)) thy =
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   161
            let
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   162
                val (thy',th) = rp' prf thy
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   163
            in
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
   164
                ProofKernel.DISJ1 th tm thy'
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   165
            end
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   166
          | rp (PDisj2(prf,tm)) thy =
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   167
            let
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   168
                val (thy',th) = rp' prf thy
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   169
            in
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
   170
                ProofKernel.DISJ2 tm th thy'
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   171
            end
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   172
          | rp (PDisjCases(prf,prf1,prf2)) thy =
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   173
            let
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   174
                val (thy',th)  = rp' prf  thy
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   175
                val (thy1,th1) = rp' prf1 thy'
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   176
                val (thy2,th2) = rp' prf2 thy1
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   177
            in
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
   178
                ProofKernel.DISJ_CASES th th1 th2 thy2
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   179
            end
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   180
          | rp (PNotI prf) thy =
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   181
            let
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   182
                val (thy',th) = rp' prf thy
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   183
            in
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
   184
                ProofKernel.NOT_INTRO th thy'
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   185
            end
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   186
          | rp (PNotE prf) thy =
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   187
            let
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   188
                val (thy',th) = rp' prf thy
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   189
            in
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
   190
                ProofKernel.NOT_ELIM th thy'
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   191
            end
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   192
          | rp (PContr(prf,tm)) thy =
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   193
            let
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   194
                val (thy',th) = rp' prf thy
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   195
            in
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
   196
                ProofKernel.CCONTR tm th thy'
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   197
            end
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   198
          | rp (PTmSpec _) _ = raise ERR "rp" "Shouldn't reach here (PTmSpec)"
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   199
          | rp (PTyDef _) _ = raise ERR "rp" "Shouldn't reach here (PTyDef)"
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   200
          | rp (PTyIntro _) _ = raise ERR "rp" "Shouldn't reach here (PTyIntro)"
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   201
          | rp PDisk _ = raise ERR "rp" "Shouldn't reach here (PDisk)"
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   202
          | rp _ _ = raise ERR "rp" "What the hell is this? Which case did I forget?"
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   203
        and rp' p thy =
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   204
            let
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   205
                val pc = content_of p
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   206
            in
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   207
                case pc of
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   208
                    PDisk => (case disk_info_of p of
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   209
                                  SOME(thyname',thmname) =>
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   210
                                  (case Int.fromString thmname of
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   211
                                       SOME i =>
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   212
                                       if thyname' = thyname
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   213
                                       then
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   214
                                           (case Array.sub(int_thms,i-1) of
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   215
                                                NONE =>
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   216
                                                let
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   217
                                                    val (thy',th) = rp' (snd (import_proof thyname' thmname thy) thy) thy
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   218
                                                    val _ = Array.update(int_thms,i-1,SOME th)
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   219
                                                in
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   220
                                                    (thy',th)
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   221
                                                end
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   222
                                              | SOME th => (thy,th))
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   223
                                       else raise ERR "replay_proof" ("Library " ^ thyname' ^ " should be built before " ^ thyname ^ " (" ^ thmname ^ ")")
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   224
                                     | NONE => 
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
   225
                                       (case ProofKernel.get_thm thyname' thmname thy of
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   226
                                            (thy',SOME res) => (thy',res)
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   227
                                          | (thy',NONE) => 
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   228
                                            if thyname' = thyname
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   229
                                            then
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   230
                                                let
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   231
                                                    val _ = writeln ("Found no " ^ thmname ^ " theorem, replaying...")
46201
afdc69f5156e eliminated dead code;
wenzelm
parents: 43918
diff changeset
   232
                                                    val (_, prf) = import_proof thyname' thmname thy'
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   233
                                                    val prf = prf thy'
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   234
                                                    val (thy',th) = replay_proof int_thms thyname' thmname prf thy'
17322
781abf7011e6 Added HOLLight support to importer.
obua
parents: 15574
diff changeset
   235
                                                    val _ = writeln ("Successfully finished replaying "^thmname^" !")
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   236
                                                in
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   237
                                                    case content_of prf of
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   238
                                                        PTmSpec _ => (thy',th)
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   239
                                                      | PTyDef  _ => (thy',th)
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   240
                                                      | PTyIntro _ => (thy',th)
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
   241
                                                      | _ => ProofKernel.store_thm thyname' thmname th thy'
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   242
                                                end
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   243
                                            else raise ERR "replay_proof" ("Library " ^ thyname' ^ " should be built before " ^ thyname ^ " (" ^ thmname ^ ")")))
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   244
                                | NONE => raise ERR "rp'.PDisk" "Not enough information")
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   245
                  | PAxm(name,c) =>
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
   246
                    (case ProofKernel.get_axiom thyname name thy of
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   247
                            (thy',SOME res) => (thy',res)
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
   248
                          | (thy',NONE) => ProofKernel.new_axiom name c thy')
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   249
                  | PTmSpec(seg,names,prf') =>
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   250
                    let
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   251
                        val (thy',th) = rp' prf' thy
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   252
                    in
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
   253
                        ProofKernel.new_specification seg thmname names th thy'
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   254
                    end
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   255
                  | PTyDef(seg,name,prf') =>
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   256
                    let
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   257
                        val (thy',th) = rp' prf' thy
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   258
                    in
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
   259
                        ProofKernel.new_type_definition seg thmname name th thy'
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   260
                    end
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   261
                  | PTyIntro(seg,name,abs_name,rep_name,P,t,prf') =>
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   262
                    let
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   263
                        val (thy',th) = rp' prf' thy
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   264
                    in
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
   265
                        ProofKernel.type_introduction seg thmname name abs_name rep_name (P,t) th thy'
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   266
                    end
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   267
                  | _ => rp pc thy
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   268
            end
14516
a183dec876ab Added HOL proof importer.
skalberg
parents:
diff changeset
   269
    in
43918
6ca79a354c51 HOL/Import reorganization/cleaning. Factor 9 speedup. Remove Import XML parser in favor of much faster of Isabelle's XML parser. Remove ImportRecording since we can use Isabelle images.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 41522
diff changeset
   270
        rp' prf thy
6ca79a354c51 HOL/Import reorganization/cleaning. Factor 9 speedup. Remove Import XML parser in favor of much faster of Isabelle's XML parser. Remove ImportRecording since we can use Isabelle images.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 41522
diff changeset
   271
    end
14516
a183dec876ab Added HOL proof importer.
skalberg
parents:
diff changeset
   272
a183dec876ab Added HOL proof importer.
skalberg
parents:
diff changeset
   273
fun setup_int_thms thyname thy =
a183dec876ab Added HOL proof importer.
skalberg
parents:
diff changeset
   274
    let
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   275
        val fname =
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
   276
            case ProofKernel.get_proof_dir thyname thy of
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   277
                SOME p => OS.Path.joinDirFile {dir=p,file=OS.Path.joinBaseExt{base = "facts",ext=SOME "lst"}}
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   278
              | NONE => error "Cannot find proof files"
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   279
        val is = TextIO.openIn fname
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   280
        val (num_int_thms,facts) =
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   281
            let
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   282
                fun get_facts facts =
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   283
                    case TextIO.inputLine is of
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   284
                        NONE => (case facts of
41164
6854e9a40edc avoid ML structure aliases (especially single-letter abbreviations);
wenzelm
parents: 39557
diff changeset
   285
                                   i::facts => (the (Int.fromString i),map ProofKernel.protect_factname (rev facts))
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   286
                                 | _ => raise ERR "replay_thm" "Bad facts.lst file")
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   287
                      | SOME fact => get_facts ((String.substring(fact,0,String.size fact -1 ))::facts)
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   288
            in
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   289
                get_facts []
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   290
            end
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   291
        val _ = TextIO.closeIn is
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   292
        val int_thms = Array.array(num_int_thms,NONE:thm option)
14516
a183dec876ab Added HOL proof importer.
skalberg
parents:
diff changeset
   293
    in
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   294
        (int_thms,facts)
14516
a183dec876ab Added HOL proof importer.
skalberg
parents:
diff changeset
   295
    end
a183dec876ab Added HOL proof importer.
skalberg
parents:
diff changeset
   296
a183dec876ab Added HOL proof importer.
skalberg
parents:
diff changeset
   297
fun import_single_thm thyname int_thms thmname thy =
a183dec876ab Added HOL proof importer.
skalberg
parents:
diff changeset
   298
    let
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   299
        fun replay_fact (thmname,thy) =
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   300
            let
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   301
                val prf = mk_proof PDisk
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   302
                val _ = set_disk_info_of prf thyname thmname
17594
98be710dabc4 replay type_introduction fix
obua
parents: 17592
diff changeset
   303
                val _ = writeln ("Replaying "^thmname^" ...")
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   304
                val p = fst (replay_proof int_thms thyname thmname prf thy)
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   305
            in
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   306
                p
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   307
            end
14516
a183dec876ab Added HOL proof importer.
skalberg
parents:
diff changeset
   308
    in
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   309
        replay_fact (thmname,thy)
14516
a183dec876ab Added HOL proof importer.
skalberg
parents:
diff changeset
   310
    end
a183dec876ab Added HOL proof importer.
skalberg
parents:
diff changeset
   311
a183dec876ab Added HOL proof importer.
skalberg
parents:
diff changeset
   312
fun import_thms thyname int_thms thmnames thy =
a183dec876ab Added HOL proof importer.
skalberg
parents:
diff changeset
   313
    let
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   314
        fun replay_fact thmname thy = 
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   315
            let
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   316
                val prf = mk_proof PDisk        
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   317
                val _ = set_disk_info_of prf thyname thmname
17594
98be710dabc4 replay type_introduction fix
obua
parents: 17592
diff changeset
   318
                val _ = writeln ("Replaying "^thmname^" ...")
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   319
                val p = fst (replay_proof int_thms thyname thmname prf thy)
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   320
            in
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   321
                p
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   322
            end
43918
6ca79a354c51 HOL/Import reorganization/cleaning. Factor 9 speedup. Remove Import XML parser in favor of much faster of Isabelle's XML parser. Remove ImportRecording since we can use Isabelle images.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 41522
diff changeset
   323
        val res_thy = fold replay_fact thmnames thy
14516
a183dec876ab Added HOL proof importer.
skalberg
parents:
diff changeset
   324
    in
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   325
        res_thy
14516
a183dec876ab Added HOL proof importer.
skalberg
parents:
diff changeset
   326
    end
a183dec876ab Added HOL proof importer.
skalberg
parents:
diff changeset
   327
a183dec876ab Added HOL proof importer.
skalberg
parents:
diff changeset
   328
fun import_thm thyname thmname thy =
a183dec876ab Added HOL proof importer.
skalberg
parents:
diff changeset
   329
    let
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   330
        val int_thms = fst (setup_int_thms thyname thy)
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   331
        fun replay_fact (thmname,thy) =
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   332
            let
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   333
                val prf = mk_proof PDisk        
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   334
                val _ = set_disk_info_of prf thyname thmname        
17594
98be710dabc4 replay type_introduction fix
obua
parents: 17592
diff changeset
   335
                val _ = writeln ("Replaying "^thmname^" ...")
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   336
                val p = fst (replay_proof int_thms thyname thmname prf thy)
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   337
            in 
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   338
                p
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   339
            end
14516
a183dec876ab Added HOL proof importer.
skalberg
parents:
diff changeset
   340
    in
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 31723
diff changeset
   341
        replay_fact (thmname,thy)
14516
a183dec876ab Added HOL proof importer.
skalberg
parents:
diff changeset
   342
    end
a183dec876ab Added HOL proof importer.
skalberg
parents:
diff changeset
   343
17959
8db36a108213 OldGoals;
wenzelm
parents: 17594
diff changeset
   344
end