src/Tools/Compute_Oracle/compute.ML
changeset 31322 526e149999cc
parent 30288 a32700e45ab3
child 31971 8c1b845ed105
equal deleted inserted replaced
31321:fe786d4633b9 31322:526e149999cc
   377         fun delete s shyptab = Sorttab.delete s shyptab handle Sorttab.UNDEF _ => shyptab
   377         fun delete s shyptab = Sorttab.delete s shyptab handle Sorttab.UNDEF _ => shyptab
   378         fun delete_term t shyptab = fold delete (Sorts.insert_term t []) shyptab
   378         fun delete_term t shyptab = fold delete (Sorts.insert_term t []) shyptab
   379         fun has_witness s = not (null (Sign.witness_sorts thy [] [s]))
   379         fun has_witness s = not (null (Sign.witness_sorts thy [] [s]))
   380         val shyptab = fold Sorttab.delete (filter has_witness (Sorttab.keys (shyptab))) shyptab
   380         val shyptab = fold Sorttab.delete (filter has_witness (Sorttab.keys (shyptab))) shyptab
   381         val shyps = if Sorttab.is_empty shyptab then [] else Sorttab.keys (fold delete_term (prop::hyps) shyptab)
   381         val shyps = if Sorttab.is_empty shyptab then [] else Sorttab.keys (fold delete_term (prop::hyps) shyptab)
   382         val _ = if not (null shyps) then raise Compute ("dangling sort hypotheses: "^(makestring shyps)) else ()
   382         val _ =
       
   383           if not (null shyps) then
       
   384             raise Compute ("dangling sort hypotheses: " ^
       
   385               commas (map (Syntax.string_of_sort_global thy) shyps))
       
   386           else ()
   383     in
   387     in
   384         Thm.cterm_of thy (fold_rev (fn hyp => fn p => Logic.mk_implies (hyp, p)) hyps prop)
   388         Thm.cterm_of thy (fold_rev (fn hyp => fn p => Logic.mk_implies (hyp, p)) hyps prop)
   385     end)));
   389     end)));
   386 
   390 
   387 fun export_thm thy hyps shyps prop =
   391 fun export_thm thy hyps shyps prop =
   608             val b' = run true b
   612             val b' = run true b
   609         in
   613         in
   610             case match_aterms varsubst b' a' of
   614             case match_aterms varsubst b' a' of
   611                 NONE => 
   615                 NONE => 
   612                 let
   616                 let
   613                     fun mk s = makestring (infer_types (naming_of computer) (encoding_of computer) ty s)
   617                     fun mk s = Syntax.string_of_term_global Pure.thy
       
   618                       (infer_types (naming_of computer) (encoding_of computer) ty s)
   614                     val left = "computed left side: "^(mk a')
   619                     val left = "computed left side: "^(mk a')
   615                     val right = "computed right side: "^(mk b')
   620                     val right = "computed right side: "^(mk b')
   616                 in
   621                 in
   617                     raise Compute ("evaluate_prem: cannot assign computed left to right hand side\n"^left^"\n"^right^"\n")
   622                     raise Compute ("evaluate_prem: cannot assign computed left to right hand side\n"^left^"\n"^right^"\n")
   618                 end
   623                 end