775 val (oracles,terms) = List.partition (fn (Elem("oracle",_,_)) => true | _ => false) chldr |
775 val (oracles,terms) = List.partition (fn (Elem("oracle",_,_)) => true | _ => false) chldr |
776 val ors = map (fn (Elem("oracle",[("n",name)],[])) => name | xml => raise ERR "x2p" "bad oracle") oracles |
776 val ors = map (fn (Elem("oracle",[("n",name)],[])) => name | xml => raise ERR "x2p" "bad oracle") oracles |
777 val (c,asl) = case terms of |
777 val (c,asl) = case terms of |
778 [] => raise ERR "x2p" "Bad oracle description" |
778 [] => raise ERR "x2p" "Bad oracle description" |
779 | (hd::tl) => (hd,tl) |
779 | (hd::tl) => (hd,tl) |
780 val tg = foldr (fn (oracle,tg) => Tag.merge (Tag.read oracle) tg) Tag.empty_tag ors |
780 val tg = List.foldr (fn (oracle,tg) => Tag.merge (Tag.read oracle) tg) Tag.empty_tag ors |
781 in |
781 in |
782 mk_proof (POracle(tg,map xml_to_term asl,xml_to_term c)) |
782 mk_proof (POracle(tg,map xml_to_term asl,xml_to_term c)) |
783 end |
783 end |
784 | x2p (Elem("pspec",[("i",is)],[prf])) = |
784 | x2p (Elem("pspec",[("i",is)],[prf])) = |
785 let |
785 let |
1838 then ty2 |
1838 then ty2 |
1839 else ty |
1839 else ty |
1840 | inst_type ty1 ty2 (ty as Type(name,tys)) = |
1840 | inst_type ty1 ty2 (ty as Type(name,tys)) = |
1841 Type(name,map (inst_type ty1 ty2) tys) |
1841 Type(name,map (inst_type ty1 ty2) tys) |
1842 in |
1842 in |
1843 foldr (fn (v,th) => |
1843 List.foldr (fn (v,th) => |
1844 let |
1844 let |
1845 val cdom = fst (dom_rng (fst (dom_rng cty))) |
1845 val cdom = fst (dom_rng (fst (dom_rng cty))) |
1846 val vty = type_of v |
1846 val vty = type_of v |
1847 val newcty = inst_type cdom vty cty |
1847 val newcty = inst_type cdom vty cty |
1848 val cc = cterm_of thy (Const(cname,newcty)) |
1848 val cc = cterm_of thy (Const(cname,newcty)) |
1850 mk_COMB (mk_REFL cc) (mk_ABS v th thy) thy |
1850 mk_COMB (mk_REFL cc) (mk_ABS v th thy) thy |
1851 end) th vlist' |
1851 end) th vlist' |
1852 end |
1852 end |
1853 | SOME _ => raise ERR "GEN_ABS" "Bad constant" |
1853 | SOME _ => raise ERR "GEN_ABS" "Bad constant" |
1854 | NONE => |
1854 | NONE => |
1855 foldr (fn (v,th) => mk_ABS v th thy) th vlist' |
1855 List.foldr (fn (v,th) => mk_ABS v th thy) th vlist' |
1856 val res = HOLThm(rens_of info',th1) |
1856 val res = HOLThm(rens_of info',th1) |
1857 val _ = message "RESULT:" |
1857 val _ = message "RESULT:" |
1858 val _ = if_debug pth res |
1858 val _ = if_debug pth res |
1859 in |
1859 in |
1860 (thy,res) |
1860 (thy,res) |
2018 val _ = ImportRecorder.add_consts consts |
2018 val _ = ImportRecorder.add_consts consts |
2019 in |
2019 in |
2020 Sign.add_consts_i consts thy' |
2020 Sign.add_consts_i consts thy' |
2021 end |
2021 end |
2022 |
2022 |
2023 val thy1 = foldr (fn(name,thy)=> |
2023 val thy1 = List.foldr (fn(name,thy)=> |
2024 snd (get_defname thyname name thy)) thy1 names |
2024 snd (get_defname thyname name thy)) thy1 names |
2025 fun new_name name = fst (get_defname thyname name thy1) |
2025 fun new_name name = fst (get_defname thyname name thy1) |
2026 val names' = map (fn name => (new_name name,name,false)) names |
2026 val names' = map (fn name => (new_name name,name,false)) names |
2027 val (thy',res) = SpecificationPackage.add_specification NONE |
2027 val (thy',res) = SpecificationPackage.add_specification NONE |
2028 names' |
2028 names' |
2039 in |
2039 in |
2040 (if defname = newname |
2040 (if defname = newname |
2041 then quotename name |
2041 then quotename name |
2042 else (quotename newname) ^ ": " ^ (quotename name),thy') |
2042 else (quotename newname) ^ ": " ^ (quotename name),thy') |
2043 end |
2043 end |
2044 val (new_names,thy') = foldr (fn(name,(names,thy)) => |
2044 val (new_names,thy') = List.foldr (fn(name,(names,thy)) => |
2045 let |
2045 let |
2046 val (name',thy') = handle_const (name,thy) |
2046 val (name',thy') = handle_const (name,thy) |
2047 in |
2047 in |
2048 (name'::names,thy') |
2048 (name'::names,thy') |
2049 end) ([],thy') names |
2049 end) ([],thy') names |