diff -r b179891dd357 -r c35001872139 src/HOL/Library/code_test.ML --- a/src/HOL/Library/code_test.ML Sat Oct 30 12:03:43 2021 +0200 +++ b/src/HOL/Library/code_test.ML Sat Oct 30 12:26:56 2021 +0200 @@ -32,11 +32,11 @@ (* convert a list of terms into nested tuples and back *) -fun mk_tuples [] = \<^term>\()\ +fun mk_tuples [] = \<^Const>\Unity\ | mk_tuples [t] = t | mk_tuples (t :: ts) = HOLogic.mk_prod (t, mk_tuples ts) -fun dest_tuples (Const (\<^const_name>\Pair\, _) $ l $ r) = l :: dest_tuples r +fun dest_tuples \<^Const_>\Pair _ _ for l r\ = l :: dest_tuples r | dest_tuples t = [t] @@ -164,18 +164,16 @@ (* term preprocessing *) -fun add_eval (Const (\<^const_name>\Trueprop\, _) $ t) = add_eval t - | add_eval (Const (\<^const_name>\HOL.eq\, _) $ lhs $ rhs) = (fn acc => +fun add_eval \<^Const_>\Trueprop for t\ = add_eval t + | add_eval \<^Const_>\HOL.eq _ for lhs rhs\ = (fn acc => acc |> add_eval rhs |> add_eval lhs |> cons rhs |> cons lhs) - | add_eval (Const (\<^const_name>\Not\, _) $ t) = add_eval t - | add_eval (Const (\<^const_name>\Orderings.ord_class.less_eq\, _) $ lhs $ rhs) = (fn acc => - lhs :: rhs :: acc) - | add_eval (Const (\<^const_name>\Orderings.ord_class.less\, _) $ lhs $ rhs) = (fn acc => - lhs :: rhs :: acc) + | add_eval \<^Const_>\Not for t\ = add_eval t + | add_eval \<^Const_>\less_eq _ for lhs rhs\ = (fn acc => lhs :: rhs :: acc) + | add_eval \<^Const_>\less _ for lhs rhs\ = (fn acc => lhs :: rhs :: acc) | add_eval _ = I fun mk_term_of [] = \<^Const>\None \<^typ>\unit \ yxml_of_term\\ @@ -184,9 +182,9 @@ val tuple = mk_tuples ts val T = fastype_of tuple in - \<^term>\Some :: (unit \ yxml_of_term) \ (unit \ yxml_of_term) option\ $ - (absdummy \<^typ>\unit\ (\<^Const>\yxml_string_of_term\ $ - (Const (\<^const_name>\Code_Evaluation.term_of\, T --> \<^Type>\term\) $ tuple))) + \<^Const>\Some \<^typ>\unit \ yxml_of_term\ for + \absdummy \<^Type>\unit\ + \<^Const>\yxml_string_of_term for \<^Const>\Code_Evaluation.term_of T for tuple\\\\ end fun test_terms ctxt ts target = @@ -197,7 +195,7 @@ fun ensure_bool t = (case fastype_of t of - \<^typ>\bool\ => () + \<^Type>\bool\ => () | _ => error (Pretty.string_of (Pretty.block [Pretty.str "Test case not of type bool:", Pretty.brk 1, @@ -253,7 +251,7 @@ val t' = HOLogic.mk_list \<^typ>\bool \ (unit \ yxml_of_term) option\ - [HOLogic.mk_prod (\<^term>\False\, mk_term_of [t])] + [HOLogic.mk_prod (\<^Const>\False\, mk_term_of [t])] val result = dynamic_value_strict ctxt t' target in (case result of [(_, SOME [t])] => t | _ => error "Evaluation failed") end