src/Pure/proofterm.ML
changeset 70557 5d6e9c65ea67
parent 70554 10d41bf28b92
child 70559 c92443e8d724
equal deleted inserted replaced
70556:038ed9b76c2b 70557:5d6e9c65ea67
    59 
    59 
    60   val oracle_ord: oracle * oracle -> order
    60   val oracle_ord: oracle * oracle -> order
    61   val thm_ord: pthm * pthm -> order
    61   val thm_ord: pthm * pthm -> order
    62   val unions_oracles: oracle Ord_List.T list -> oracle Ord_List.T
    62   val unions_oracles: oracle Ord_List.T list -> oracle Ord_List.T
    63   val unions_thms: pthm Ord_List.T list -> pthm Ord_List.T
    63   val unions_thms: pthm Ord_List.T list -> pthm Ord_List.T
    64   val all_oracles_of: proof_body -> oracle Ord_List.T
    64   val all_oracles_of: proof_body list -> oracle Ord_List.T
    65   val approximate_proof_body: proof -> proof_body
    65   val approximate_proof_body: proof -> proof_body
    66   val no_proof_body: proof -> proof_body
    66   val no_proof_body: proof -> proof_body
    67   val no_thm_proofs: proof -> proof
    67   val no_thm_proofs: proof -> proof
    68   val no_body_proofs: proof -> proof
    68   val no_body_proofs: proof -> proof
    69 
    69 
   315 fun thm_ord ((i, _): pthm, (j, _): pthm) = int_ord (j, i);
   315 fun thm_ord ((i, _): pthm, (j, _): pthm) = int_ord (j, i);
   316 
   316 
   317 val unions_oracles = Ord_List.unions oracle_ord;
   317 val unions_oracles = Ord_List.unions oracle_ord;
   318 val unions_thms = Ord_List.unions thm_ord;
   318 val unions_thms = Ord_List.unions thm_ord;
   319 
   319 
   320 val all_oracles_of =
   320 fun all_oracles_of bodies =
   321   let
   321   let
   322     fun collect (PBody {oracles, thms, ...}) =
   322     fun collect (PBody {oracles, thms, ...}) =
   323       (if null oracles then I else apfst (cons oracles)) #>
   323       (if null oracles then I else apfst (cons oracles)) #>
   324       (tap join_thms thms |> fold (fn (i, thm_node) => fn (x, seen) =>
   324       (tap join_thms thms |> fold (fn (i, thm_node) => fn (x, seen) =>
   325         if Inttab.defined seen i then (x, seen)
   325         if Inttab.defined seen i then (x, seen)
   326         else
   326         else
   327           let val body = Future.join (thm_node_body thm_node)
   327           let val body = Future.join (thm_node_body thm_node)
   328           in collect body (x, Inttab.update (i, ()) seen) end));
   328           in collect body (x, Inttab.update (i, ()) seen) end));
   329   in fn body => unions_oracles (#1 (collect body ([], Inttab.empty))) end;
   329   in fold collect bodies ([], Inttab.empty) |> #1 |> unions_oracles end;
   330 
   330 
   331 fun approximate_proof_body prf =
   331 fun approximate_proof_body prf =
   332   let
   332   let
   333     val (oracles, thms) = fold_proof_atoms false
   333     val (oracles, thms) = fold_proof_atoms false
   334       (fn Oracle (s, prop, _) => apfst (cons (s, prop))
   334       (fn Oracle (s, prop, _) => apfst (cons (s, prop))