src/HOL/Tools/Sledgehammer/sledgehammer_isar_proof.ML
changeset 57655 dde0e76996ad
parent 57287 68aa585269ac
child 57669 cf20bdc83854
equal deleted inserted replaced
57654:f89c0749533d 57655:dde0e76996ad
   119   | comment_isar_step _ step = step
   119   | comment_isar_step _ step = step
   120 fun comment_isar_proof comment_of = map_isar_steps (comment_isar_step comment_of)
   120 fun comment_isar_proof comment_of = map_isar_steps (comment_isar_step comment_of)
   121 
   121 
   122 fun chain_qs_lfs NONE lfs = ([], lfs)
   122 fun chain_qs_lfs NONE lfs = ([], lfs)
   123   | chain_qs_lfs (SOME l0) lfs =
   123   | chain_qs_lfs (SOME l0) lfs =
   124     if member (op =) lfs l0 then ([Then], lfs |> remove (op =) l0) else ([], lfs)
   124     if member (op =) lfs l0 then ([Then], remove (op =) l0 lfs) else ([], lfs)
       
   125 
   125 fun chain_isar_step lbl (Prove (qs, xs, l, t, subs, (lfs, gfs), meths, comment)) =
   126 fun chain_isar_step lbl (Prove (qs, xs, l, t, subs, (lfs, gfs), meths, comment)) =
   126     let val (qs', lfs) = chain_qs_lfs lbl lfs in
   127     let val (qs', lfs) = chain_qs_lfs lbl lfs in
   127       Prove (qs' @ qs, xs, l, t, map chain_isar_proof subs, (lfs, gfs), meths, comment)
   128       Prove (qs' @ qs, xs, l, t, map chain_isar_proof subs, (lfs, gfs), meths, comment)
   128     end
   129     end
   129   | chain_isar_step _ step = step
   130   | chain_isar_step _ step = step
   130 and chain_isar_steps _ [] = []
   131 and chain_isar_steps _ [] = []
   131   | chain_isar_steps (prev as SOME _) (i :: is) =
   132   | chain_isar_steps prev (i :: is) =
   132     chain_isar_step prev i :: chain_isar_steps (label_of_isar_step i) is
   133     chain_isar_step prev i :: chain_isar_steps (label_of_isar_step i) is
   133   | chain_isar_steps _ (i :: is) = i :: chain_isar_steps (label_of_isar_step i) is
       
   134 and chain_isar_proof (Proof (fix, assms, steps)) =
   134 and chain_isar_proof (Proof (fix, assms, steps)) =
   135   Proof (fix, assms, chain_isar_steps (try (List.last #> fst) assms) steps)
   135   Proof (fix, assms, chain_isar_steps (try (List.last #> fst) assms) steps)
   136 
   136 
   137 fun kill_useless_labels_in_isar_proof proof =
   137 fun kill_useless_labels_in_isar_proof proof =
   138   let
   138   let