(* Title: HOL/Library/LaTeXsugar.thyAuthor: Author:GerwinKlein,TobiasNipkow,Norbertjava.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 2 Copyright2005NICTAandTUM
*)
setup \<open>
Document_Output.antiquotation_pretty_source_embedded \<^binding>\<open>const_typ\<close>
(Scan.lift Parse.embedded_inner_syntax)
(fn ctxt => fn c => let val tc = Proof_Context.read_const {proper = false, strict = false} ctxt c in
Pretty.block [Document_Output.pretty_term ctxt tc, Pretty.str " ::",
Pretty.brk 1, Syntax.pretty_typ ctxt (fastype_of tc)]
end)
\<close>
setup\<open> let
fun dummy_pats (wrap $ (eq $ lhs $ rhs)) = let
val rhs_vars = Term.add_vars rhs [];
fun dummy (v as Var (ixn as (_, T))) = if member ((=) ) rhs_vars ixn then v else Const (\<^const_name>\<open>DUMMY\<close>, T)
| dummy (t $ u) = dummy t $ dummy u
| dummy (Abs (n, T, b)) = Abs (n, T, dummy b)
| dummy t = t;
in wrap $ (eq $ dummy lhs $ rhs) end
in
Term_Style.setup \<^binding>\<open>dummy_pats\<close> (Scan.succeed (K dummy_pats))
end
\<close>
setup \<open> let
fun eta_expand Ts t xs = case t of
Abs(x,T,t) => let val (t', xs') = eta_expand (T::Ts) t xs
in (Abs (x, T, t'), xs') end
| _ => let
val (a,ts) = strip_comb t (* assume a atomic *)
val (ts',xs') = fold_map (eta_expand Ts) ts xs
val t' = list_comb (a, ts');
val Bs = binder_types (fastype_of1 (Ts,t));
val n = Int.min (length Bs, length xs');
val bs = map Bound ((n - 1) downto 0);
val xBs = ListPair.zip (xs',Bs);
val xs'' = drop n xs';
val t'' = fold_rev Term.abs xBs (list_comb(t', bs))
in (t'', xs'') end
val style_eta_expand =
(Scan.repeat Args.name) >> (fn xs => fn ctxt => fn t => fst (eta_expand [] t xs))
in Term_Style.setup \<^binding>\<open>eta_expand\<close> style_eta_expand end
\<close>
end
(*>*)
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.22Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.