src/Pure/Isar/proof_data.ML
author wenzelm
Thu, 07 Oct 1999 12:36:53 +0200
changeset 7775 26898fbd19ca
parent 6788 6eaf6856ee4a
child 8143 b0e44ab73631
permissions -rw-r--r--
verbatim / verb markupup commands;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5821
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
     1
(*  Title:      Pure/Isar/proof_data.ML
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
     2
    ID:         $Id$
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
     3
    Author:     Markus Wenzel, TU Muenchen
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
     4
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
     5
Type-safe interface for proof context data.
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
     6
*)
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
     7
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
     8
signature PROOF_DATA_ARGS =
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
     9
sig
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    10
  val name: string
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    11
  type T
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    12
  val init: theory -> T
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    13
  val print: Proof.context -> T -> unit
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    14
end;
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    15
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    16
signature PROOF_DATA =
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    17
sig
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    18
  type T
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    19
  val init: theory -> theory
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    20
  val print: Proof.context -> unit
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    21
  val get: Proof.context -> T
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    22
  val put: T -> Proof.context -> Proof.context
6788
6eaf6856ee4a added get_st;
wenzelm
parents: 6777
diff changeset
    23
  val get_st: Proof.state -> T
6777
175ff298ac0e added put_st;
wenzelm
parents: 5821
diff changeset
    24
  val put_st: T -> Proof.state -> Proof.state
5821
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    25
end;
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    26
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    27
functor ProofDataFun(Args: PROOF_DATA_ARGS): PROOF_DATA =
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    28
struct
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    29
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    30
(*object kind kept private!*)
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    31
val kind = Object.kind Args.name;
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    32
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    33
type T = Args.T;
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    34
exception Data of T;
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    35
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    36
val init =
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    37
  ProofContext.init_data kind
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    38
    (Data o Args.init, fn ctxt => fn (Data x) => Args.print ctxt x);
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    39
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    40
val print = ProofContext.print_data kind;
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    41
val get = ProofContext.get_data kind (fn Data x => x);
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    42
val put = ProofContext.put_data kind Data;
6788
6eaf6856ee4a added get_st;
wenzelm
parents: 6777
diff changeset
    43
val get_st = get o Proof.context_of;
6777
175ff298ac0e added put_st;
wenzelm
parents: 5821
diff changeset
    44
val put_st = Proof.put_data kind Data;
5821
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    45
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    46
end;
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    47
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    48
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    49
(*hide private data access functions*)
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    50
structure ProofContext: PROOF_CONTEXT = ProofContext;
262ce90e4736 Type-safe interface for proof context data.
wenzelm
parents:
diff changeset
    51
structure Proof: PROOF = Proof;