src/Pure/proofterm.ML
changeset 70501 23c4f264250c
parent 70500 5d540dbbe5ba
child 70502 b053c9ed0b0a
equal deleted inserted replaced
70500:5d540dbbe5ba 70501:23c4f264250c
    39   type pthm = proof_serial * thm_node
    39   type pthm = proof_serial * thm_node
    40   type oracle = string * term
    40   type oracle = string * term
    41   val proof_of: proof_body -> proof
    41   val proof_of: proof_body -> proof
    42   val map_proof_of: (proof -> proof) -> proof_body -> proof_body
    42   val map_proof_of: (proof -> proof) -> proof_body -> proof_body
    43   val thm_header: proof_serial -> Position.T list -> string -> term -> typ list option -> thm_header
    43   val thm_header: proof_serial -> Position.T list -> string -> term -> typ list option -> thm_header
    44   val thm_body: (proof -> proof) -> proof_body future -> thm_body
    44   val thm_body: proof_body -> thm_body
    45   val thm_body_proof_raw: thm_body -> proof
    45   val thm_body_proof_raw: thm_body -> proof
    46   val thm_body_proof_open: thm_body -> proof
    46   val thm_body_proof_open: thm_body -> proof
    47   val thm_node_name: thm_node -> string
    47   val thm_node_name: thm_node -> string
    48   val thm_node_prop: thm_node -> term
    48   val thm_node_prop: thm_node -> term
    49   val thm_node_body: thm_node -> proof_body future
    49   val thm_node_body: thm_node -> proof_body future
   214   PBody {oracles = oracles, thms = thms, proof = f proof};
   214   PBody {oracles = oracles, thms = thms, proof = f proof};
   215 
   215 
   216 fun thm_header serial pos name prop types : thm_header =
   216 fun thm_header serial pos name prop types : thm_header =
   217   {serial = serial, pos = pos, name = name, prop = prop, types = types};
   217   {serial = serial, pos = pos, name = name, prop = prop, types = types};
   218 
   218 
   219 fun thm_body open_proof body =
   219 fun thm_body body = Thm_Body {open_proof = I, body = Future.value body};
   220   Thm_Body {open_proof = open_proof, body = body};
       
   221 fun thm_body_proof_raw (Thm_Body {body, ...}) = join_proof body;
   220 fun thm_body_proof_raw (Thm_Body {body, ...}) = join_proof body;
   222 fun thm_body_proof_open (Thm_Body {open_proof, body}) = open_proof (join_proof body);
   221 fun thm_body_proof_open (Thm_Body {open_proof, body}) = open_proof (join_proof body);
   223 
   222 
   224 fun rep_thm_node (Thm_Node args) = args;
   223 fun rep_thm_node (Thm_Node args) = args;
   225 val thm_node_name = #name o rep_thm_node;
   224 val thm_node_name = #name o rep_thm_node;
   407   fn ([a, b], c) =>
   406   fn ([a, b], c) =>
   408     let
   407     let
   409       val ((d, (e, (f, g)))) =
   408       val ((d, (e, (f, g)))) =
   410         pair (list properties) (pair term (pair (option (list typ)) proof_body)) c;
   409         pair (list properties) (pair term (pair (option (list typ)) proof_body)) c;
   411       val header = thm_header (int_atom a) (map Position.of_properties d) b e f;
   410       val header = thm_header (int_atom a) (map Position.of_properties d) b e f;
   412     in PThm (header, thm_body I (Future.value g)) end]
   411     in PThm (header, thm_body g) end]
   413 and proof_body x =
   412 and proof_body x =
   414   let val (a, b, c) = triple (list (pair string term)) (list pthm) proof x
   413   let val (a, b, c) = triple (list (pair string term)) (list pthm) proof x
   415   in PBody {oracles = a, thms = b, proof = c} end
   414   in PBody {oracles = a, thms = b, proof = c} end
   416 and pthm x =
   415 and pthm x =
   417   let val (a, (b, c, d)) = pair int (triple string term proof_body) x
   416   let val (a, (b, c, d)) = pair int (triple string term proof_body) x
  2084       | _ => new_prf ());
  2083       | _ => new_prf ());
  2085 
  2084 
  2086     val pthm = (i, make_thm_node name prop1 body');
  2085     val pthm = (i, make_thm_node name prop1 body');
  2087 
  2086 
  2088     val header = thm_header i ([pos, Position.thread_data ()]) name prop1 NONE;
  2087     val header = thm_header i ([pos, Position.thread_data ()]) name prop1 NONE;
  2089     val head = PThm (header, thm_body open_proof body');
  2088     val head = PThm (header, Thm_Body {open_proof = open_proof, body = body'});
  2090     val proof =
  2089     val proof =
  2091       if unconstrain then
  2090       if unconstrain then
  2092         proof_combt' (head, (map o Option.map o Term.map_types) (#map_atyps ucontext) args)
  2091         proof_combt' (head, (map o Option.map o Term.map_types) (#map_atyps ucontext) args)
  2093       else
  2092       else
  2094         proof_combP (proof_combt' (head, args),
  2093         proof_combP (proof_combt' (head, args),