# HG changeset patch # User wenzelm # Date 1632861952 -7200 # Node ID bd9a5e128c31c33653d29554180ba1c28e9b7d84 # Parent 90c99974f6485ea3ffa0760b228f4fa8c35bab67# Parent 107941e8fa0140ac95aebeb3c6dc2a12802de30e merged diff -r 90c99974f648 -r bd9a5e128c31 NEWS --- a/NEWS Tue Sep 28 20:58:04 2021 +0200 +++ b/NEWS Tue Sep 28 22:45:52 2021 +0200 @@ -279,12 +279,20 @@ \<^Type>\c\ \<^Type>\c T \\ \ \same with type arguments\ - \<^Type>_fn\c T \\ \ \fn abstraction, failure via exception TYPE\ + \<^Type_fn>\c T \\ \ \fn abstraction, failure via exception TYPE\ \<^Const>\c\ \<^Const>\c T \\ \ \same with type arguments\ \<^Const>\c for t \\ \ \same with term arguments\ \<^Const_>\c \\ \ \same for patterns: case, let, fn\ - \<^Const>_fn\c T \\ \ \fn abstraction, failure via exception TERM\ + \<^Const_fn>\c T \\ \ \fn abstraction, failure via exception TERM\ + +The type/term arguments refer to nested ML source, which may contain +antiquotations recursively. The following argument syntax is supported: + + - an underscore (dummy pattern) + - an atomic item of "embedded" syntax, e.g. identifier or cartouche + - an antiquotation in control-symbol/cartouche form, e.g. \<^Type>\c\ + as short form of \\<^Type>\c\\. Examples in HOL: diff -r 90c99974f648 -r bd9a5e128c31 src/CCL/Wfd.thy --- a/src/CCL/Wfd.thy Tue Sep 28 20:58:04 2021 +0200 +++ b/src/CCL/Wfd.thy Tue Sep 28 22:45:52 2021 +0200 @@ -441,7 +441,7 @@ fun is_rigid_prog t = (case (Logic.strip_assums_concl t) of - \<^Const_>\Trueprop for \\<^Const_>\mem _ for a _\\\ => null (Term.add_vars a []) + \<^Const_>\Trueprop for \<^Const_>\mem _ for a _\\ => null (Term.add_vars a []) | _ => false) in diff -r 90c99974f648 -r bd9a5e128c31 src/FOLP/IFOLP.thy --- a/src/FOLP/IFOLP.thy Tue Sep 28 20:58:04 2021 +0200 +++ b/src/FOLP/IFOLP.thy Tue Sep 28 22:45:52 2021 +0200 @@ -612,7 +612,7 @@ structure Hypsubst = Hypsubst ( (*Take apart an equality judgement; otherwise raise Match!*) - fun dest_eq \<^Const_>\Proof for \\<^Const_>\eq _ for t u\\ _\ = (t, u); + fun dest_eq \<^Const_>\Proof for \<^Const_>\eq _ for t u\ _\ = (t, u); val imp_intr = @{thm impI} diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/HOL.thy --- a/src/HOL/HOL.thy Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/HOL.thy Tue Sep 28 22:45:52 2021 +0200 @@ -888,7 +888,7 @@ structure Blast = Blast ( structure Classical = Classical - val Trueprop_const = dest_Const \<^const>\Trueprop\ + val Trueprop_const = dest_Const \<^Const>\Trueprop\ val equality_name = \<^const_name>\HOL.eq\ val not_name = \<^const_name>\Not\ val notE = @{thm notE} @@ -1549,7 +1549,7 @@ {lhss = [\<^term>\induct_false \ PROP P \ PROP Q\], proc = fn _ => fn _ => fn ct => (case Thm.term_of ct of - _ $ (P as _ $ \<^const>\induct_false\) $ (_ $ Q $ _) => + _ $ (P as _ $ \<^Const_>\induct_false\) $ (_ $ Q $ _) => if P <> Q then SOME Drule.swap_prems_eq else NONE | _ => NONE)}, Simplifier.make_simproc \<^context> "induct_equal_conj_curry" @@ -1558,11 +1558,11 @@ (case Thm.term_of ct of _ $ (_ $ P) $ _ => let - fun is_conj (\<^const>\induct_conj\ $ P $ Q) = + fun is_conj \<^Const_>\induct_conj for P Q\ = is_conj P andalso is_conj Q - | is_conj (Const (\<^const_name>\induct_equal\, _) $ _ $ _) = true - | is_conj \<^const>\induct_true\ = true - | is_conj \<^const>\induct_false\ = true + | is_conj \<^Const_>\induct_equal _ for _ _\ = true + | is_conj \<^Const_>\induct_true\ = true + | is_conj \<^Const_>\induct_false\ = true | is_conj _ = false in if is_conj P then SOME @{thm induct_conj_curry} else NONE end | _ => NONE)}] diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/HOLCF/Tools/holcf_library.ML --- a/src/HOL/HOLCF/Tools/holcf_library.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/HOLCF/Tools/holcf_library.ML Tue Sep 28 22:45:52 2021 +0200 @@ -58,7 +58,7 @@ let val T = Term.range_type (Term.fastype_of t) val UNIV_const = \<^term>\UNIV :: nat set\ - in \<^Const>\lub T for \\<^Const>\image \\<^Type>\nat\\ T for t UNIV_const\\\ end + in \<^Const>\lub T for \<^Const>\image \<^Type>\nat\ T for t UNIV_const\\ end (*** Continuous function space ***) diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Hoare/hoare_tac.ML --- a/src/HOL/Hoare/hoare_tac.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Hoare/hoare_tac.ML Tue Sep 28 22:45:52 2021 +0200 @@ -49,7 +49,7 @@ Abs (_, T, _) => T | Const (_, Type (_, [_, Type (_, [T, _])])) $ _ => T); in - \<^Const>\case_prod T T2 \\<^Type>\bool\\ for \absfree (x, T) z\\ + \<^Const>\case_prod T T2 \<^Type>\bool\ for \absfree (x, T) z\\ end; (** maps [x1,...,xn] to (x1,...,xn) and types**) diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Library/Pattern_Aliases.thy --- a/src/HOL/Library/Pattern_Aliases.thy Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Library/Pattern_Aliases.thy Tue Sep 28 22:45:52 2021 +0200 @@ -97,7 +97,7 @@ fun check_pattern_syntax t = case strip_all t of - (vars, \<^const>\Trueprop\ $ (Const (\<^const_name>\HOL.eq\, _) $ lhs $ rhs)) => + (vars, \<^Const>\Trueprop\ $ (Const (\<^const_name>\HOL.eq\, _) $ lhs $ rhs)) => let fun go (Const (\<^const_name>\as\, _) $ pat $ var, rhs) = let @@ -126,7 +126,7 @@ fun uncheck_pattern_syntax ctxt t = case strip_all t of - (vars, \<^const>\Trueprop\ $ (Const (\<^const_name>\HOL.eq\, _) $ lhs $ rhs)) => + (vars, \<^Const>\Trueprop\ $ (Const (\<^const_name>\HOL.eq\, _) $ lhs $ rhs)) => let (* restricted to going down abstractions; ignores eta-contracted rhs *) fun go lhs (rhs as Const (\<^const_name>\Let\, _) $ pat $ Abs (name, typ, t)) ctxt frees = diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Library/code_lazy.ML --- a/src/HOL/Library/code_lazy.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Library/code_lazy.ML Tue Sep 28 22:45:52 2021 +0200 @@ -378,8 +378,8 @@ ||>> fold_map (mk_name ("case_" ^ short_type_name ^ "_lazy_") "") ctr_names val mk_Lazy_delay_eq = - (#const lazy_ctr_def $ mk_delay (Bound 0), Rep_lazy $ (Bound 0 $ \<^const>\Unity\)) - |> mk_eq |> all_abs [\<^typ>\unit\ --> lazy_type] + (#const lazy_ctr_def $ mk_delay (Bound 0), Rep_lazy $ (Bound 0 $ \<^Const>\Unity\)) + |> mk_eq |> all_abs [\<^Type>\unit\ --> lazy_type] val (Lazy_delay_thm, lthy8a) = mk_thm ((Lazy_delay_eq_name, mk_Lazy_delay_eq), [#thm lazy_ctr_def, @{thm force_delay}]) lthy8 diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Library/code_test.ML --- a/src/HOL/Library/code_test.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Library/code_test.ML Tue Sep 28 22:45:52 2021 +0200 @@ -179,15 +179,15 @@ lhs :: rhs :: acc) | add_eval _ = I -fun mk_term_of [] = \<^term>\None :: (unit \ yxml_of_term) option\ +fun mk_term_of [] = \<^Const>\None \<^typ>\unit \ yxml_of_term\\ | mk_term_of ts = let 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 --> \<^typ>\term\) $ tuple))) + (absdummy \<^typ>\unit\ (\<^Const>\yxml_string_of_term\ $ + (Const (\<^const_name>\Code_Evaluation.term_of\, T --> \<^Type>\term\) $ tuple))) end fun test_terms ctxt ts target = diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/ATP/atp_problem_generate.ML --- a/src/HOL/Tools/ATP/atp_problem_generate.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/ATP/atp_problem_generate.ML Tue Sep 28 22:45:52 2021 +0200 @@ -773,17 +773,17 @@ fun is_first_order_lambda_free t = (case t of - \<^const>\Not\ $ t1 => is_first_order_lambda_free t1 - | Const (\<^const_name>\All\, _) $ Abs (_, _, t') => is_first_order_lambda_free t' - | Const (\<^const_name>\All\, _) $ t1 => is_first_order_lambda_free t1 - | Const (\<^const_name>\Ex\, _) $ Abs (_, _, t') => is_first_order_lambda_free t' - | Const (\<^const_name>\Ex\, _) $ t1 => is_first_order_lambda_free t1 - | \<^const>\HOL.conj\ $ t1 $ t2 => is_first_order_lambda_free t1 andalso is_first_order_lambda_free t2 - | \<^const>\HOL.disj\ $ t1 $ t2 => is_first_order_lambda_free t1 andalso is_first_order_lambda_free t2 - | \<^const>\HOL.implies\ $ t1 $ t2 => - is_first_order_lambda_free t1 andalso is_first_order_lambda_free t2 - | Const (\<^const_name>\HOL.eq\, Type (_, [\<^typ>\bool\, _])) $ t1 $ t2 => - is_first_order_lambda_free t1 andalso is_first_order_lambda_free t2 + \<^Const_>\Not for t1\ => is_first_order_lambda_free t1 + | \<^Const_>\All _ for \Abs (_, _, t')\\ => is_first_order_lambda_free t' + | \<^Const_>\All _ for t1\ => is_first_order_lambda_free t1 + | \<^Const_>\Ex _ for \Abs (_, _, t')\\ => is_first_order_lambda_free t' + | \<^Const_>\Ex _ for t1\ => is_first_order_lambda_free t1 + | \<^Const_>\conj for t1 t2\ => is_first_order_lambda_free t1 andalso is_first_order_lambda_free t2 + | \<^Const_>\disj for t1 t2\ => is_first_order_lambda_free t1 andalso is_first_order_lambda_free t2 + | \<^Const_>\implies for t1 t2\ => + is_first_order_lambda_free t1 andalso is_first_order_lambda_free t2 + | \<^Const_>\HOL.eq \<^Type>\bool\ for t1 t2\ => + is_first_order_lambda_free t1 andalso is_first_order_lambda_free t2 | _ => not (exists_subterm (fn Abs _ => true | _ => false) t)) fun simple_translate_lambdas eta_matters do_lambdas ctxt type_enc t = @@ -793,22 +793,22 @@ let fun trans_first_order Ts t = (case t of - \<^const>\Not\ $ t1 => \<^const>\Not\ $ trans_first_order Ts t1 - | (t0 as Const (\<^const_name>\All\, _)) $ Abs (s, T, t') => + \<^Const_>\Not for t1\ => \<^Const>\Not for \trans_first_order Ts t1\\ + | (t0 as \<^Const_>\All _\) $ Abs (s, T, t') => t0 $ Abs (s, T, trans_first_order (T :: Ts) t') - | (t0 as Const (\<^const_name>\All\, _)) $ t1 => + | (t0 as \<^Const_>\All _\) $ t1 => trans_first_order Ts (t0 $ eta_expand Ts t1 1) - | (t0 as Const (\<^const_name>\Ex\, _)) $ Abs (s, T, t') => + | (t0 as \<^Const_>\Ex _\) $ Abs (s, T, t') => t0 $ Abs (s, T, trans_first_order (T :: Ts) t') - | (t0 as Const (\<^const_name>\Ex\, _)) $ t1 => + | (t0 as \<^Const_>\Ex _\) $ t1 => trans_first_order Ts (t0 $ eta_expand Ts t1 1) - | (t0 as \<^const>\HOL.conj\) $ t1 $ t2 => + | (t0 as \<^Const_>\conj\) $ t1 $ t2 => t0 $ trans_first_order Ts t1 $ trans_first_order Ts t2 - | (t0 as \<^const>\HOL.disj\) $ t1 $ t2 => + | (t0 as \<^Const_>\disj\) $ t1 $ t2 => t0 $ trans_first_order Ts t1 $ trans_first_order Ts t2 - | (t0 as \<^const>\HOL.implies\) $ t1 $ t2 => + | (t0 as \<^Const_>\implies\) $ t1 $ t2 => t0 $ trans_first_order Ts t1 $ trans_first_order Ts t2 - | (t0 as Const (\<^const_name>\HOL.eq\, Type (_, [\<^typ>\bool\, _]))) $ t1 $ t2 => + | (t0 as \<^Const_>\HOL.eq \<^Type>\bool\\) $ t1 $ t2 => t0 $ trans_first_order Ts t1 $ trans_first_order Ts t2 | _ => if not (exists_subterm (fn Abs _ => true | _ => false) t) then t @@ -1381,18 +1381,18 @@ do_formula bs pos1 t1 ##>> do_formula bs pos2 t2 #>> uncurry (mk_aconn c) and do_formula bs pos t = (case t of - \<^const>\Trueprop\ $ t1 => do_formula bs pos t1 - | \<^const>\Not\ $ t1 => do_formula bs (Option.map not pos) t1 #>> mk_anot - | Const (\<^const_name>\All\, _) $ Abs (s, T, t') => do_quant bs AForall pos s T t' - | (t0 as Const (\<^const_name>\All\, _)) $ t1 => + \<^Const_>\Trueprop for t1\ => do_formula bs pos t1 + | \<^Const_>\Not for t1\ => do_formula bs (Option.map not pos) t1 #>> mk_anot + | \<^Const_>\All _ for \Abs (s, T, t')\\ => do_quant bs AForall pos s T t' + | (t0 as \<^Const_>\All _\) $ t1 => do_formula bs pos (t0 $ eta_expand (map (snd o snd) bs) t1 1) - | Const (\<^const_name>\Ex\, _) $ Abs (s, T, t') => do_quant bs AExists pos s T t' - | (t0 as Const (\<^const_name>\Ex\, _)) $ t1 => + | \<^Const_>\Ex _ for \Abs (s, T, t')\\ => do_quant bs AExists pos s T t' + | (t0 as \<^Const_>\Ex _\) $ t1 => do_formula bs pos (t0 $ eta_expand (map (snd o snd) bs) t1 1) - | \<^const>\HOL.conj\ $ t1 $ t2 => do_conn bs AAnd pos t1 pos t2 - | \<^const>\HOL.disj\ $ t1 $ t2 => do_conn bs AOr pos t1 pos t2 - | \<^const>\HOL.implies\ $ t1 $ t2 => do_conn bs AImplies (Option.map not pos) t1 pos t2 - | Const (\<^const_name>\HOL.eq\, Type (_, [\<^typ>\bool\, _])) $ t1 $ t2 => + | \<^Const_>\conj for t1 t2\ => do_conn bs AAnd pos t1 pos t2 + | \<^Const_>\disj for t1 t2\ => do_conn bs AOr pos t1 pos t2 + | \<^Const_>\implies for t1 t2\ => do_conn bs AImplies (Option.map not pos) t1 pos t2 + | \<^Const_>\HOL.eq \<^Type>\bool\ for t1 t2\ => if iff_for_eq then do_conn bs AIff NONE t1 NONE t2 else do_term bs t | _ => do_term bs t) in do_formula [] end @@ -1449,7 +1449,7 @@ |> presimplify_term simp_options ctxt |> HOLogic.dest_Trueprop end - handle TERM _ => \<^const>\True\ + handle TERM _ => \<^Const>\True\ (* Satallax prefers "=" to "<=>" (for definitions) and Metis (CNF) requires "=" for technical reasons. *) @@ -2030,9 +2030,9 @@ end in List.partition (curry (op =) Definition o #role) #>> reorder [] #> op @ end -fun s_not_prop (\<^const>\Trueprop\ $ t) = \<^const>\Trueprop\ $ s_not t - | s_not_prop (\<^const>\Pure.imp\ $ t $ \<^prop>\False\) = t - | s_not_prop t = \<^const>\Pure.imp\ $ t $ \<^prop>\False\ +fun s_not_prop \<^Const_>\Trueprop for t\ = \<^Const>\Trueprop for \s_not t\\ + | s_not_prop \<^Const_>\Pure.imp for t \<^prop>\False\\ = t + | s_not_prop t = \<^Const>\Pure.imp for t \<^prop>\False\\ fun translate_formulas simp_options ctxt prem_role format type_enc lam_trans presimp hyp_ts concl_t facts = diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/ATP/atp_proof_reconstruct.ML --- a/src/HOL/Tools/ATP/atp_proof_reconstruct.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/ATP/atp_proof_reconstruct.ML Tue Sep 28 22:45:52 2021 +0200 @@ -127,7 +127,7 @@ | (u, Const (\<^const_name>\True\, _)) => u | (Const (\<^const_name>\False\, _), v) => s_not v | (u, Const (\<^const_name>\False\, _)) => s_not u - | _ => if u aconv v then \<^const>\True\ else t $ simplify_bool u $ simplify_bool v) + | _ => if u aconv v then \<^Const>\True\ else t $ simplify_bool u $ simplify_bool v) | simplify_bool (t $ u) = simplify_bool t $ simplify_bool u | simplify_bool (Abs (s, T, t)) = Abs (s, T, simplify_bool t) | simplify_bool t = t @@ -351,7 +351,7 @@ error "Isar proof reconstruction failed because the ATP proof contains unparsable \ \material" else if String.isPrefix native_type_prefix s then - \<^const>\True\ (* ignore TPTP type information (needed?) *) + \<^Const>\True\ (* ignore TPTP type information (needed?) *) else if s = tptp_equal then list_comb (Const (\<^const_name>\HOL.eq\, Type_Infer.anyT \<^sort>\type\), map (do_term [] NONE) us) @@ -372,7 +372,7 @@ (nth us (length us - 2)) end else if s' = type_guard_name then - \<^const>\True\ (* ignore type predicates *) + \<^Const>\True\ (* ignore type predicates *) else let val new_skolem = String.isPrefix new_skolem_const_prefix s'' @@ -436,7 +436,7 @@ fun term_of_atom ctxt format type_enc textual sym_tab pos (u as ATerm ((s, _), _)) = if String.isPrefix class_prefix s then add_type_constraint pos (type_constraint_of_term ctxt u) - #> pair \<^const>\True\ + #> pair \<^Const>\True\ else pair (term_of_atp ctxt format type_enc textual sym_tab (SOME \<^typ>\bool\) u) @@ -617,8 +617,8 @@ fun repair_waldmeister_endgame proof = let - fun repair_tail (name, _, \<^const>\Trueprop\ $ t, rule, deps) = - (name, Negated_Conjecture, \<^const>\Trueprop\ $ s_not t, rule, deps) + fun repair_tail (name, _, \<^Const>\Trueprop for t\, rule, deps) = + (name, Negated_Conjecture, \<^Const>\Trueprop for \s_not t\\, rule, deps) fun repair_body [] = [] | repair_body ((line as ((num, _), _, _, _, _)) :: lines) = if num = waldmeister_conjecture_num then map repair_tail (line :: lines) diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/ATP/atp_util.ML --- a/src/HOL/Tools/ATP/atp_util.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/ATP/atp_util.ML Tue Sep 28 22:45:52 2021 +0200 @@ -261,43 +261,39 @@ (* Simple simplifications to ensure that sort annotations don't leave a trail of spurious "True"s. *) -fun s_not (Const (\<^const_name>\All\, T) $ Abs (s, T', t')) = - Const (\<^const_name>\Ex\, T) $ Abs (s, T', s_not t') - | s_not (Const (\<^const_name>\Ex\, T) $ Abs (s, T', t')) = - Const (\<^const_name>\All\, T) $ Abs (s, T', s_not t') - | s_not (\<^const>\HOL.implies\ $ t1 $ t2) = \<^const>\HOL.conj\ $ t1 $ s_not t2 - | s_not (\<^const>\HOL.conj\ $ t1 $ t2) = - \<^const>\HOL.disj\ $ s_not t1 $ s_not t2 - | s_not (\<^const>\HOL.disj\ $ t1 $ t2) = - \<^const>\HOL.conj\ $ s_not t1 $ s_not t2 - | s_not (\<^const>\False\) = \<^const>\True\ - | s_not (\<^const>\True\) = \<^const>\False\ - | s_not (\<^const>\Not\ $ t) = t - | s_not t = \<^const>\Not\ $ t +fun s_not \<^Const_>\All T for \Abs (s, T', t')\\ = \<^Const>\Ex T for \Abs (s, T', s_not t')\\ + | s_not \<^Const_>\Ex T for \Abs (s, T', t')\\ = \<^Const>\All T for \Abs (s, T', s_not t')\\ + | s_not \<^Const_>\implies for t1 t2\ = \<^Const>\conj for t1 \s_not t2\\ + | s_not \<^Const_>\conj for t1 t2\ = \<^Const>\disj for \s_not t1\ \s_not t2\\ + | s_not \<^Const_>\disj for t1 t2\ = \<^Const>\conj for \s_not t1\ \s_not t2\\ + | s_not \<^Const_>\False\ = \<^Const>\True\ + | s_not \<^Const_>\True\ = \<^Const>\False\ + | s_not \<^Const_>\Not for t\ = t + | s_not t = \<^Const>\Not for t\ -fun s_conj (\<^const>\True\, t2) = t2 - | s_conj (t1, \<^const>\True\) = t1 - | s_conj (\<^const>\False\, _) = \<^const>\False\ - | s_conj (_, \<^const>\False\) = \<^const>\False\ +fun s_conj (\<^Const_>\True\, t2) = t2 + | s_conj (t1, \<^Const_>\True\) = t1 + | s_conj (\<^Const_>\False\, _) = \<^Const>\False\ + | s_conj (_, \<^Const_>\False\) = \<^Const>\False\ | s_conj (t1, t2) = if t1 aconv t2 then t1 else HOLogic.mk_conj (t1, t2) -fun s_disj (\<^const>\False\, t2) = t2 - | s_disj (t1, \<^const>\False\) = t1 - | s_disj (\<^const>\True\, _) = \<^const>\True\ - | s_disj (_, \<^const>\True\) = \<^const>\True\ +fun s_disj (\<^Const_>\False\, t2) = t2 + | s_disj (t1, \<^Const_>\False\) = t1 + | s_disj (\<^Const_>\True\, _) = \<^Const>\True\ + | s_disj (_, \<^Const_>\True\) = \<^Const>\True\ | s_disj (t1, t2) = if t1 aconv t2 then t1 else HOLogic.mk_disj (t1, t2) -fun s_imp (\<^const>\True\, t2) = t2 - | s_imp (t1, \<^const>\False\) = s_not t1 - | s_imp (\<^const>\False\, _) = \<^const>\True\ - | s_imp (_, \<^const>\True\) = \<^const>\True\ +fun s_imp (\<^Const_>\True\, t2) = t2 + | s_imp (t1, \<^Const_>\False\) = s_not t1 + | s_imp (\<^Const_>\False\, _) = \<^Const>\True\ + | s_imp (_, \<^Const_>\True\) = \<^Const>\True\ | s_imp p = HOLogic.mk_imp p -fun s_iff (\<^const>\True\, t2) = t2 - | s_iff (t1, \<^const>\True\) = t1 - | s_iff (\<^const>\False\, t2) = s_not t2 - | s_iff (t1, \<^const>\False\) = s_not t1 - | s_iff (t1, t2) = if t1 aconv t2 then \<^const>\True\ else HOLogic.eq_const HOLogic.boolT $ t1 $ t2 +fun s_iff (\<^Const_>\True\, t2) = t2 + | s_iff (t1, \<^Const_>\True\) = t1 + | s_iff (\<^Const_>\False\, t2) = s_not t2 + | s_iff (t1, \<^Const_>\False\) = s_not t1 + | s_iff (t1, t2) = if t1 aconv t2 then \<^Const>\True\ else HOLogic.eq_const HOLogic.boolT $ t1 $ t2 fun close_form t = fold (fn ((s, i), T) => fn t' => @@ -352,18 +348,15 @@ t fun unextensionalize_def t = - case t of - \<^const>\Trueprop\ $ (Const (\<^const_name>\HOL.eq\, _) $ lhs $ rhs) => - (case strip_comb lhs of - (c as Const (_, T), args) => - if forall is_Var args andalso not (has_duplicates (op =) args) then - \<^const>\Trueprop\ - $ (Const (\<^const_name>\HOL.eq\, T --> T --> \<^typ>\bool\) - $ c $ fold_rev lambda args rhs) - else - t - | _ => t) - | _ => t + (case t of + \<^Const_>\Trueprop for \<^Const_>\HOL.eq _ for lhs rhs\\ => + (case strip_comb lhs of + (c as Const (_, T), args) => + if forall is_Var args andalso not (has_duplicates (op =) args) then + \<^Const>\Trueprop for \<^Const>\HOL.eq T for c \fold_rev lambda args rhs\\\ + else t + | _ => t) + | _ => t) (* Converts an elim-rule into an equivalent theorem that does not have the predicate variable. Leaves other theorems unchanged. We simply instantiate @@ -371,9 +364,8 @@ "Meson_Clausify".) *) fun transform_elim_prop t = case Logic.strip_imp_concl t of - \<^const>\Trueprop\ $ Var (z, \<^typ>\bool\) => - subst_Vars [(z, \<^const>\False\)] t - | Var (z, \<^typ>\prop\) => subst_Vars [(z, \<^prop>\False\)] t + \<^Const_>\Trueprop for \Var (z, \<^typ>\bool\)\\ => subst_Vars [(z, \<^Const>\False\)] t + | Var (z, \<^Type>\prop\) => subst_Vars [(z, \<^prop>\False\)] t | _ => t fun specialize_type thy (s, T) t = diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/Argo/argo_real.ML --- a/src/HOL/Tools/Argo/argo_real.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/Argo/argo_real.ML Tue Sep 28 22:45:52 2021 +0200 @@ -12,25 +12,25 @@ fun trans_type _ \<^Type>\real\ tcx = SOME (Argo_Expr.Real, tcx) | trans_type _ _ _ = NONE -fun trans_term f \<^Const_>\uminus \\<^Type>\real\\ for t\ tcx = +fun trans_term f \<^Const_>\uminus \<^Type>\real\ for t\ tcx = tcx |> f t |>> Argo_Expr.mk_neg |> SOME - | trans_term f \<^Const_>\plus \\<^Type>\real\\ for t1 t2\ tcx = + | trans_term f \<^Const_>\plus \<^Type>\real\ for t1 t2\ tcx = tcx |> f t1 ||>> f t2 |>> uncurry Argo_Expr.mk_add2 |> SOME - | trans_term f \<^Const_>\minus \\<^Type>\real\\ for t1 t2\ tcx = + | trans_term f \<^Const_>\minus \<^Type>\real\ for t1 t2\ tcx = tcx |> f t1 ||>> f t2 |>> uncurry Argo_Expr.mk_sub |> SOME - | trans_term f \<^Const_>\times \\<^Type>\real\\ for t1 t2\ tcx = + | trans_term f \<^Const_>\times \<^Type>\real\ for t1 t2\ tcx = tcx |> f t1 ||>> f t2 |>> uncurry Argo_Expr.mk_mul |> SOME - | trans_term f \<^Const_>\divide \\<^Type>\real\\ for t1 t2\ tcx = + | trans_term f \<^Const_>\divide \<^Type>\real\ for t1 t2\ tcx = tcx |> f t1 ||>> f t2 |>> uncurry Argo_Expr.mk_div |> SOME - | trans_term f \<^Const_>\min \\<^Type>\real\\ for t1 t2\ tcx = + | trans_term f \<^Const_>\min \<^Type>\real\ for t1 t2\ tcx = tcx |> f t1 ||>> f t2 |>> uncurry Argo_Expr.mk_min |> SOME - | trans_term f \<^Const_>\max \\<^Type>\real\\ for t1 t2\ tcx = + | trans_term f \<^Const_>\max \<^Type>\real\ for t1 t2\ tcx = tcx |> f t1 ||>> f t2 |>> uncurry Argo_Expr.mk_max |> SOME - | trans_term f \<^Const_>\abs \\<^Type>\real\\ for t\ tcx = + | trans_term f \<^Const_>\abs \<^Type>\real\ for t\ tcx = tcx |> f t |>> Argo_Expr.mk_abs |> SOME - | trans_term f \<^Const_>\less \\<^Type>\real\\ for t1 t2\ tcx = + | trans_term f \<^Const_>\less \<^Type>\real\ for t1 t2\ tcx = tcx |> f t1 ||>> f t2 |>> uncurry Argo_Expr.mk_lt |> SOME - | trans_term f \<^Const_>\less_eq \\<^Type>\real\\ for t1 t2\ tcx = + | trans_term f \<^Const_>\less_eq \<^Type>\real\ for t1 t2\ tcx = tcx |> f t1 ||>> f t2 |>> uncurry Argo_Expr.mk_le |> SOME | trans_term _ t tcx = (case try HOLogic.dest_number t of @@ -40,12 +40,12 @@ (* reverse translation *) -fun mk_plus t1 t2 = \<^Const>\plus \\<^Type>\real\\ for t1 t2\ +fun mk_plus t1 t2 = \<^Const>\plus \<^Type>\real\ for t1 t2\ fun mk_sum ts = uncurry (fold_rev mk_plus) (split_last ts) -fun mk_times t1 t2 = \<^Const>\times \\<^Type>\real\\ for t1 t2\ -fun mk_divide t1 t2 = \<^Const>\divide \\<^Type>\real\\ for t1 t2\ -fun mk_le t1 t2 = \<^Const>\less_eq \\<^Type>\real\\ for t1 t2\ -fun mk_lt t1 t2 = \<^Const>\less \\<^Type>\real\\ for t1 t2\ +fun mk_times t1 t2 = \<^Const>\times \<^Type>\real\ for t1 t2\ +fun mk_divide t1 t2 = \<^Const>\divide \<^Type>\real\ for t1 t2\ +fun mk_le t1 t2 = \<^Const>\less_eq \<^Type>\real\ for t1 t2\ +fun mk_lt t1 t2 = \<^Const>\less \<^Type>\real\ for t1 t2\ fun mk_real_num i = HOLogic.mk_number \<^Type>\real\ i @@ -54,17 +54,17 @@ in if q = 1 then mk_real_num p else mk_divide (mk_real_num p) (mk_real_num q) end fun term_of _ (Argo_Expr.E (Argo_Expr.Num n, _)) = SOME (mk_number n) - | term_of f (Argo_Expr.E (Argo_Expr.Neg, [e])) = SOME \<^Const>\uminus \\<^Type>\real\\ for \f e\\ + | term_of f (Argo_Expr.E (Argo_Expr.Neg, [e])) = SOME \<^Const>\uminus \<^Type>\real\ for \f e\\ | term_of f (Argo_Expr.E (Argo_Expr.Add, es)) = SOME (mk_sum (map f es)) | term_of f (Argo_Expr.E (Argo_Expr.Sub, [e1, e2])) = - SOME \<^Const>\minus \\<^Type>\real\\ for \f e1\ \f e2\\ + SOME \<^Const>\minus \<^Type>\real\ for \f e1\ \f e2\\ | term_of f (Argo_Expr.E (Argo_Expr.Mul, [e1, e2])) = SOME (mk_times (f e1) (f e2)) | term_of f (Argo_Expr.E (Argo_Expr.Div, [e1, e2])) = SOME (mk_divide (f e1) (f e2)) | term_of f (Argo_Expr.E (Argo_Expr.Min, [e1, e2])) = - SOME \<^Const>\min \\<^Type>\real\\ for \f e1\ \f e2\\ + SOME \<^Const>\min \<^Type>\real\ for \f e1\ \f e2\\ | term_of f (Argo_Expr.E (Argo_Expr.Max, [e1, e2])) = - SOME \<^Const>\max \\<^Type>\real\\ for \f e1\ \f e2\\ - | term_of f (Argo_Expr.E (Argo_Expr.Abs, [e])) = SOME \<^Const>\abs \\<^Type>\real\\ for \f e\\ + SOME \<^Const>\max \<^Type>\real\ for \f e1\ \f e2\\ + | term_of f (Argo_Expr.E (Argo_Expr.Abs, [e])) = SOME \<^Const>\abs \<^Type>\real\ for \f e\\ | term_of f (Argo_Expr.E (Argo_Expr.Le, [e1, e2])) = SOME (mk_le (f e1) (f e2)) | term_of f (Argo_Expr.E (Argo_Expr.Lt, [e1, e2])) = SOME (mk_lt (f e1) (f e2)) | term_of _ _ = NONE @@ -97,10 +97,10 @@ local -fun is_add2 \<^Const_>\plus \\<^Type>\real\\ for _ _\ = true +fun is_add2 \<^Const_>\plus \<^Type>\real\ for _ _\ = true | is_add2 _ = false -fun is_add3 \<^Const_>\plus \\<^Type>\real\\ for _ t\ = is_add2 t +fun is_add3 \<^Const_>\plus \<^Type>\real\ for _ t\ = is_add2 t | is_add3 _ = false val flatten_thm = mk_rewr @{lemma "(a::real) + b + c = a + (b + c)" by simp} diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/Argo/argo_tactic.ML --- a/src/HOL/Tools/Argo/argo_tactic.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/Argo/argo_tactic.ML Tue Sep 28 22:45:52 2021 +0200 @@ -600,7 +600,7 @@ fun unclausify (thm, lits) ls = (case (Thm.prop_of thm, lits) of - (\<^Const_>\Trueprop for \\<^Const_>\False\\\, [(_, ct)]) => + (\<^Const_>\Trueprop for \<^Const_>\False\\, [(_, ct)]) => let val thm = Thm.implies_intr ct thm in (discharge thm unclausify_rule1 handle THM _ => discharge thm unclausify_rule2, ls) end | _ => (thm, Ord_List.union lit_ord lits ls)) diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/BNF/bnf_fp_def_sugar.ML --- a/src/HOL/Tools/BNF/bnf_fp_def_sugar.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/BNF/bnf_fp_def_sugar.ML Tue Sep 28 22:45:52 2021 +0200 @@ -2215,7 +2215,7 @@ let fun mk_goal c cps gcorec n k disc = mk_Trueprop_eq (disc $ (gcorec $ c), - if n = 1 then \<^const>\True\ + if n = 1 then \<^Const>\True\ else Library.foldr1 HOLogic.mk_conj (seq_conds mk_maybe_not n k cps)); val goalss = @{map 6} (map2 oooo mk_goal) cs cpss gcorecs ns kss discss; diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/BNF/bnf_fp_rec_sugar_transfer.ML --- a/src/HOL/Tools/BNF/bnf_fp_rec_sugar_transfer.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/BNF/bnf_fp_rec_sugar_transfer.ML Tue Sep 28 22:45:52 2021 +0200 @@ -42,7 +42,7 @@ let fun instantiate_with_lambda thm = let - val prop as \<^const>\Trueprop\ $ (Const (\<^const_name>\HOL.eq\, _) $ (Var (_, fT) $ _) $ _) = + val prop as \<^Const_>\Trueprop for \\<^Const_>\HOL.eq _ for \Var (_, fT) $ _\ _\\\ = Thm.prop_of thm; val T = range_type fT; val j = Term.maxidx_of_term prop + 1; diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/BNF/bnf_gfp_grec_sugar.ML --- a/src/HOL/Tools/BNF/bnf_gfp_grec_sugar.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/BNF/bnf_gfp_grec_sugar.ML Tue Sep 28 22:45:52 2021 +0200 @@ -385,7 +385,7 @@ val ssig_map_thms = #map_thms ssig_fp_bnf_sugar; val all_algLam_alg_pointfuls = map (mk_pointful ctxt) all_algLam_algs; - val \<^const>\Trueprop\ $ (Const (\<^const_name>\HOL.eq\, _) $ lhs $ rhs) = code_goal; + val \<^Const_>\Trueprop for \<^Const_>\HOL.eq _ for lhs rhs\\ = code_goal; val (fun_t, args) = strip_comb lhs; val closed_rhs = fold_rev lambda args rhs; @@ -447,7 +447,7 @@ val fp_nesting_Ts = map T_of_bnf fp_nesting_bnfs; - fun is_nullary_disc_def (\<^const>\Trueprop\ $ (Const (\<^const_name>\HOL.eq\, _) $ _ + fun is_nullary_disc_def (\<^Const>\Trueprop\ $ (Const (\<^const_name>\HOL.eq\, _) $ _ $ (Const (\<^const_name>\HOL.eq\, _) $ _ $ _))) = true | is_nullary_disc_def (Const (\<^const_name>\Pure.eq\, _) $ _ $ (Const (\<^const_name>\HOL.eq\, _) $ _ $ _)) = true @@ -512,7 +512,7 @@ val goal = mk_Trueprop_eq (fun_t, abs_curried_balanced arg_Ts algrho); fun const_of_transfer thm = - (case Thm.prop_of thm of \<^const>\Trueprop\ $ (_ $ cst $ _) => cst); + (case Thm.prop_of thm of \<^Const>\Trueprop\ $ (_ $ cst $ _) => cst); val eq_algrho = Goal.prove (*no sorry*) ctxt [] [] goal (fn {context = ctxt, prems = _} => @@ -590,7 +590,7 @@ fun derive_cong_ctr_intros ctxt cong_ctor_intro = let - val \<^const>\Pure.imp\ $ _ $ (\<^const>\Trueprop\ $ ((Rcong as _ $ _) $ _ $ (ctor $ _))) = + val \<^Const_>\Pure.imp\ $ _ $ (\<^Const_>\Trueprop\ $ ((Rcong as _ $ _) $ _ $ (ctor $ _))) = Thm.prop_of cong_ctor_intro; val fpT as Type (fpT_name, fp_argTs) = range_type (fastype_of ctor); @@ -615,19 +615,19 @@ fun derive_cong_friend_intro ctxt cong_algrho_intro = let - val \<^const>\Pure.imp\ $ _ $ (\<^const>\Trueprop\ $ ((Rcong as _ $ _) $ _ + val \<^Const_>\Pure.imp\ $ _ $ (\<^Const_>\Trueprop\ $ ((Rcong as _ $ _) $ _ $ ((algrho as Const (algrho_name, _)) $ _))) = Thm.prop_of cong_algrho_intro; val fpT as Type (_, fp_argTs) = range_type (fastype_of algrho); - fun has_algrho (\<^const>\Trueprop\ $ (Const (\<^const_name>\HOL.eq\, _) $ _ $ rhs)) = + fun has_algrho (\<^Const_>\Trueprop\ $ (Const (\<^const_name>\HOL.eq\, _) $ _ $ rhs)) = fst (dest_Const (head_of (strip_abs_body rhs))) = algrho_name; val eq_algrho :: _ = maps (filter (has_algrho o Thm.prop_of) o #eq_algrhos o snd) (all_friend_extras_of ctxt); - val \<^const>\Trueprop\ $ (Const (\<^const_name>\HOL.eq\, _) $ friend0 $ _) = Thm.prop_of eq_algrho; + val \<^Const_>\Trueprop\ $ (Const (\<^const_name>\HOL.eq\, _) $ friend0 $ _) = Thm.prop_of eq_algrho; val friend = mk_ctr fp_argTs friend0; val goal = mk_cong_intro_ctr_or_friend_goal ctxt fpT Rcong friend; @@ -654,8 +654,8 @@ let val thy = Proof_Context.theory_of ctxt; - val \<^const>\Pure.imp\ $ (\<^const>\Trueprop\ $ (_ $ Abs (_, _, _ $ - Abs (_, _, \<^const>\implies\ $ _ $ (_ $ (cong0 $ _) $ _ $ _))))) $ _ = + val \<^Const_>\Pure.imp\ $ (\<^Const_>\Trueprop\ $ (_ $ Abs (_, _, _ $ + Abs (_, _, \<^Const_>\implies\ $ _ $ (_ $ (cong0 $ _) $ _ $ _))))) $ _ = Thm.prop_of dtor_coinduct; val SOME {X as TVar ((X_s, _), _), fp_res = {dtor_ctors, ...}, pre_bnf, @@ -820,7 +820,7 @@ |> curry (op ~~) (map (fn disc => disc $ lhs) discs); fun mk_disc_iff_props props [] = props - | mk_disc_iff_props _ ((lhs, \<^const>\HOL.True\) :: _) = [lhs] + | mk_disc_iff_props _ ((lhs, \<^Const_>\True\) :: _) = [lhs] | mk_disc_iff_props props ((lhs, rhs) :: views) = mk_disc_iff_props ((HOLogic.mk_eq (lhs, rhs)) :: props) views; in @@ -2242,7 +2242,7 @@ val fun_T = (case code_goal of - \<^const>\Trueprop\ $ (Const (\<^const_name>\HOL.eq\, _) $ t $ _) => fastype_of (head_of t) + \<^Const_>\Trueprop\ $ (Const (\<^const_name>\HOL.eq\, _) $ t $ _) => fastype_of (head_of t) | _ => ill_formed_equation_lhs_rhs lthy [code_goal]); val fun_t = Const (fun_name, fun_T); diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/BNF/bnf_gfp_grec_sugar_util.ML --- a/src/HOL/Tools/BNF/bnf_gfp_grec_sugar_util.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/BNF/bnf_gfp_grec_sugar_util.ML Tue Sep 28 22:45:52 2021 +0200 @@ -367,7 +367,7 @@ ctrXs_Tss |> map_index (fn (i, Ts) => Abs (Name.uu, mk_tupleT_balanced Ts, - if i + 1 = k then \<^const>\HOL.True\ else \<^const>\HOL.False\)) + if i + 1 = k then \<^Const>\True\ else \<^Const>\False\)) |> mk_case_sumN_balanced |> map_types substXYT |> (fn tm => Library.foldl1 HOLogic.mk_comp [tm, rep, snd_const YpreT]) diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/BNF/bnf_gfp_rec_sugar.ML --- a/src/HOL/Tools/BNF/bnf_gfp_rec_sugar.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/BNF/bnf_gfp_rec_sugar.ML Tue Sep 28 22:45:52 2021 +0200 @@ -189,22 +189,22 @@ fun sort_list_duplicates xs = map snd (sort (int_ord o apply2 fst) xs); -val mk_conjs = try (foldr1 HOLogic.mk_conj) #> the_default \<^const>\True\; -val mk_disjs = try (foldr1 HOLogic.mk_disj) #> the_default \<^const>\False\; +val mk_conjs = try (foldr1 HOLogic.mk_conj) #> the_default \<^Const>\True\; +val mk_disjs = try (foldr1 HOLogic.mk_disj) #> the_default \<^Const>\False\; val mk_dnf = mk_disjs o map mk_conjs; -val conjuncts_s = filter_out (curry (op aconv) \<^const>\True\) o HOLogic.conjuncts; +val conjuncts_s = filter_out (curry (op aconv) \<^Const>\True\) o HOLogic.conjuncts; -fun s_not \<^const>\True\ = \<^const>\False\ - | s_not \<^const>\False\ = \<^const>\True\ - | s_not (\<^const>\Not\ $ t) = t - | s_not (\<^const>\conj\ $ t $ u) = \<^const>\disj\ $ s_not t $ s_not u - | s_not (\<^const>\disj\ $ t $ u) = \<^const>\conj\ $ s_not t $ s_not u - | s_not t = \<^const>\Not\ $ t; +fun s_not \<^Const_>\True\ = \<^Const>\False\ + | s_not \<^Const_>\False\ = \<^Const>\True\ + | s_not \<^Const_>\Not for t\ = t + | s_not \<^Const_>\conj for t u\ = \<^Const>\disj for \s_not t\ \s_not u\\ + | s_not \<^Const_>\disj for t u\ = \<^Const>\conj for \s_not t\ \s_not u\\ + | s_not t = \<^Const>\Not for t\; val s_not_conj = conjuncts_s o s_not o mk_conjs; -fun propagate_unit_pos u cs = if member (op aconv) cs u then [\<^const>\False\] else cs; +fun propagate_unit_pos u cs = if member (op aconv) cs u then [\<^Const>\False\] else cs; fun propagate_unit_neg not_u cs = remove (op aconv) not_u cs; fun propagate_units css = @@ -215,17 +215,17 @@ (map (propagate_unit_pos u) (uss @ css')))); fun s_conjs cs = - if member (op aconv) cs \<^const>\False\ then \<^const>\False\ - else mk_conjs (remove (op aconv) \<^const>\True\ cs); + if member (op aconv) cs \<^Const>\False\ then \<^Const>\False\ + else mk_conjs (remove (op aconv) \<^Const>\True\ cs); fun s_disjs ds = - if member (op aconv) ds \<^const>\True\ then \<^const>\True\ - else mk_disjs (remove (op aconv) \<^const>\False\ ds); + if member (op aconv) ds \<^Const>\True\ then \<^Const>\True\ + else mk_disjs (remove (op aconv) \<^Const>\False\ ds); fun s_dnf css0 = let val css = propagate_units css0 in if null css then - [\<^const>\False\] + [\<^Const>\False\] else if exists null css then [] else diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/BNF/bnf_gfp_rec_sugar_tactics.ML --- a/src/HOL/Tools/BNF/bnf_gfp_rec_sugar_tactics.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/BNF/bnf_gfp_rec_sugar_tactics.ML Tue Sep 28 22:45:52 2021 +0200 @@ -154,7 +154,7 @@ fun inst_split_eq ctxt split = (case Thm.prop_of split of - \<^const>\Trueprop\ $ (Const (\<^const_name>\HOL.eq\, _) $ (Var (_, Type (_, [T, _])) $ _) $ _) => + \<^Const_>\Trueprop for \<^Const_>\HOL.eq _ for \Var (_, Type (_, [T, _])) $ _\ _\\ => let val s = Name.uu; val eq = Abs (Name.uu, T, HOLogic.mk_eq (Free (s, T), Bound 0)); diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/BNF/bnf_lfp_countable.ML --- a/src/HOL/Tools/BNF/bnf_lfp_countable.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/BNF/bnf_lfp_countable.ML Tue Sep 28 22:45:52 2021 +0200 @@ -70,13 +70,13 @@ fun encode_sumN n k t = Balanced_Tree.access {init = t, - left = fn t => \<^const>\sum_encode\ $ (@{const Inl (nat, nat)} $ t), - right = fn t => \<^const>\sum_encode\ $ (@{const Inr (nat, nat)} $ t)} + left = fn t => \<^Const>\sum_encode for \<^Const>\Inl \<^Type>\nat\ \<^Type>\nat\ for t\\, + right = fn t => \<^Const>\sum_encode for \<^Const>\Inr \<^Type>\nat\ \<^Type>\nat\ for t\\} n k; -fun encode_tuple [] = \<^term>\0 :: nat\ +fun encode_tuple [] = \<^Const>\zero_class.zero \<^Type>\nat\\ | encode_tuple ts = - Balanced_Tree.make (fn (t, u) => \<^const>\prod_encode\ $ (@{const Pair (nat, nat)} $ u $ t)) ts; + Balanced_Tree.make (fn (t, u) => \<^Const>\prod_encode for \<^Const>\Pair \<^Type>\nat\ \<^Type>\nat\ for u t\\) ts; fun mk_encode_funs ctxt fpTs ns ctrss0 recs0 = let @@ -181,7 +181,7 @@ |> map (Thm.close_derivation \<^here>) end; -fun get_countable_goal_type_name (\<^const>\Trueprop\ $ (Const (\<^const_name>\Ex\, _) +fun get_countable_goal_type_name (\<^Const>\Trueprop\ $ (Const (\<^const_name>\Ex\, _) $ Abs (_, Type (_, [Type (s, _), _]), Const (\<^const_name>\inj_on\, _) $ Bound 0 $ Const (\<^const_name>\top\, _)))) = s | get_countable_goal_type_name _ = error "Wrong goal format for datatype countability tactic"; diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/Ctr_Sugar/ctr_sugar.ML --- a/src/HOL/Tools/Ctr_Sugar/ctr_sugar.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/Ctr_Sugar/ctr_sugar.ML Tue Sep 28 22:45:52 2021 +0200 @@ -303,11 +303,11 @@ fun name_of_disc t = (case head_of t of - Abs (_, _, \<^const>\Not\ $ (t' $ Bound 0)) => + Abs (_, _, \<^Const_>\Not for \t' $ Bound 0\\) => Long_Name.map_base_name (prefix not_prefix) (name_of_disc t') - | Abs (_, _, Const (\<^const_name>\HOL.eq\, _) $ Bound 0 $ t') => + | Abs (_, _, \<^Const_>\HOL.eq _ for \Bound 0\ t'\) => Long_Name.map_base_name (prefix is_prefix) (name_of_disc t') - | Abs (_, _, \<^const>\Not\ $ (Const (\<^const_name>\HOL.eq\, _) $ Bound 0 $ t')) => + | Abs (_, _, \<^Const_>\Not for \<^Const_>\HOL.eq _ for \Bound 0\ t'\\) => Long_Name.map_base_name (prefix (not_prefix ^ is_prefix)) (name_of_disc t') | t' => name_of_const "discriminator" (perhaps (try domain_type)) t'); @@ -1037,7 +1037,7 @@ val disc_eq_case_thms = let - fun const_of_bool b = if b then \<^const>\True\ else \<^const>\False\; + fun const_of_bool b = if b then \<^Const>\True\ else \<^Const>\False\; fun mk_case_args n = map_index (fn (k, argTs) => fold_rev Term.absdummy argTs (const_of_bool (n = k))) ctr_Tss; val goals = map_index (fn (n, udisc) => diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/Lifting/lifting_def_code_dt.ML --- a/src/HOL/Tools/Lifting/lifting_def_code_dt.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/Lifting/lifting_def_code_dt.ML Tue Sep 28 22:45:52 2021 +0200 @@ -400,7 +400,7 @@ let val (sel_rhs, wits) = mk_sel_case_args lthy4 ctr_Tss ks arg in (arg |> #2, wits, list_comb (mk_sel_casex arg, sel_rhs)) end; fun mk_dis_case_args args k = map (fn (k', arg) => (if k = k' - then fold_rev Term.lambda arg \<^const>\True\ else fold_rev Term.lambda arg \<^const>\False\)) args; + then fold_rev Term.lambda arg \<^Const>\True\ else fold_rev Term.lambda arg \<^Const>\False\)) args; val sel_rhs = map (map mk_sel_rhs) sel_argss val dis_rhs = map (fn k => list_comb (dis_casex, mk_dis_case_args (ks ~~ xss) k)) ks val dis_qty = qty_isom --> HOLogic.boolT; diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/Meson/meson.ML --- a/src/HOL/Tools/Meson/meson.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/Meson/meson.ML Tue Sep 28 22:45:52 2021 +0200 @@ -261,9 +261,9 @@ fun refl_clause_aux 0 th = th | refl_clause_aux n th = case HOLogic.dest_Trueprop (Thm.concl_of th) of - \<^Const_>\disj for \\<^Const_>\disj for _ _\\ _\ => + \<^Const_>\disj for \<^Const_>\disj for _ _\ _\ => refl_clause_aux n (th RS disj_assoc) (*isolate an atom as first disjunct*) - | \<^Const_>\disj for \\<^Const_>\Not for \\<^Const_>\HOL.eq _ for t u\\\\ _\ => + | \<^Const_>\disj for \<^Const_>\Not for \<^Const_>\HOL.eq _ for t u\\ _\ => if eliminable(t,u) then refl_clause_aux (n-1) (th RS not_refl_disj_D) (*Var inequation: delete*) else refl_clause_aux (n-1) (th RS disj_comm) (*not between Vars: ignore*) @@ -271,7 +271,7 @@ | _ => (*not a disjunction*) th; fun notequal_lits_count \<^Const_>\disj for P Q\ = notequal_lits_count P + notequal_lits_count Q - | notequal_lits_count \<^Const_>\Not for \\<^Const_>\HOL.eq _ for _ _\\\ = 1 + | notequal_lits_count \<^Const_>\Not for \<^Const_>\HOL.eq _ for _ _\\ = 1 | notequal_lits_count _ = 0; (*Simplify a clause by applying reflexivity to its negated equality literals*) @@ -414,7 +414,7 @@ (**** Generation of contrapositives ****) -fun is_left \<^Const_>\Trueprop for \\<^Const_>\disj for \\<^Const_>\disj for _ _\\ _\\\ = true +fun is_left \<^Const_>\Trueprop for \<^Const_>\disj for \<^Const_>\disj for _ _\ _\\ = true | is_left _ = false; (*Associate disjuctions to right -- make leftmost disjunct a LITERAL*) @@ -435,7 +435,7 @@ fun rigid t = not (is_Var (head_of t)); -fun ok4horn \<^Const_>\Trueprop for \\<^Const_>\disj for t _\\\ = rigid t +fun ok4horn \<^Const_>\Trueprop for \<^Const_>\disj for t _\\ = rigid t | ok4horn \<^Const_>\Trueprop for t\ = rigid t | ok4horn _ = false; @@ -470,7 +470,7 @@ (***** MESON PROOF PROCEDURE *****) -fun rhyps (\<^Const_>\Pure.imp for \\<^Const_>\Trueprop for A\\ phi\, As) = rhyps(phi, A::As) +fun rhyps (\<^Const_>\Pure.imp for \<^Const_>\Trueprop for A\ phi\, As) = rhyps(phi, A::As) | rhyps (_, As) = As; (** Detecting repeated assumptions in a subgoal **) @@ -514,7 +514,7 @@ val nnf_rls = [imp_to_disjD, iff_to_disjD, not_conjD, not_disjD, not_impD, not_iffD, not_allD, not_exD, not_notD]; -fun ok4nnf \<^Const_>\Trueprop for \\<^Const_>\Not for t\\\ = rigid t +fun ok4nnf \<^Const_>\Trueprop for \<^Const_>\Not for t\\ = rigid t | ok4nnf \<^Const_>\Trueprop for t\ = rigid t | ok4nnf _ = false; @@ -620,7 +620,7 @@ (* Strengthens "f g ~= f h" to "f g ~= f h & (EX x. g x ~= h x)". *) fun cong_extensionalize_thm ctxt th = (case Thm.concl_of th of - \<^Const_>\Trueprop for \\<^Const_>\Not for \\<^Const_>\HOL.eq T for \t as _ $ _\ \u as _ $ _\\\\\\ => + \<^Const_>\Trueprop for \<^Const_>\Not for \<^Const_>\HOL.eq T for \t as _ $ _\ \u as _ $ _\\\\ => (case get_F_pattern T t u of SOME p => th RS infer_instantiate ctxt [(("F", 0), Thm.cterm_of ctxt p)] ext_cong_neq | NONE => th) diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/Nitpick/nitpick.ML --- a/src/HOL/Tools/Nitpick/nitpick.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/Nitpick/nitpick.ML Tue Sep 28 22:45:52 2021 +0200 @@ -182,8 +182,7 @@ fun none_true assigns = forall (not_equal (SOME true) o snd) assigns -fun has_lonely_bool_var (\<^const>\Pure.conjunction\ - $ (\<^const>\Trueprop\ $ Free _) $ _) = true +fun has_lonely_bool_var \<^Const_>\Pure.conjunction for \<^Const_>\Trueprop for \Free _\\ _\ = true | has_lonely_bool_var _ = false val syntactic_sorts = diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/Nitpick/nitpick_hol.ML --- a/src/HOL/Tools/Nitpick/nitpick_hol.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/Nitpick/nitpick_hol.ML Tue Sep 28 22:45:52 2021 +0200 @@ -331,16 +331,16 @@ else s -fun s_conj (t1, \<^const>\True\) = t1 - | s_conj (\<^const>\True\, t2) = t2 +fun s_conj (t1, \<^Const_>\True\) = t1 + | s_conj (\<^Const_>\True\, t2) = t2 | s_conj (t1, t2) = - if t1 = \<^const>\False\ orelse t2 = \<^const>\False\ then \<^const>\False\ + if t1 = \<^Const>\False\ orelse t2 = \<^Const>\False\ then \<^Const>\False\ else HOLogic.mk_conj (t1, t2) -fun s_disj (t1, \<^const>\False\) = t1 - | s_disj (\<^const>\False\, t2) = t2 +fun s_disj (t1, \<^Const_>\False\) = t1 + | s_disj (\<^Const_>\False\, t2) = t2 | s_disj (t1, t2) = - if t1 = \<^const>\True\ orelse t2 = \<^const>\True\ then \<^const>\True\ + if t1 = \<^Const>\True\ orelse t2 = \<^Const>\True\ then \<^Const>\True\ else HOLogic.mk_disj (t1, t2) fun strip_connective conn_t (t as (t0 $ t1 $ t2)) = @@ -348,13 +348,13 @@ | strip_connective _ t = [t] fun strip_any_connective (t as (t0 $ _ $ _)) = - if t0 = \<^const>\HOL.conj\ orelse t0 = \<^const>\HOL.disj\ then + if t0 = \<^Const>\conj\ orelse t0 = \<^Const>\disj\ then (strip_connective t0 t, t0) else - ([t], \<^const>\Not\) - | strip_any_connective t = ([t], \<^const>\Not\) -val conjuncts_of = strip_connective \<^const>\HOL.conj\ -val disjuncts_of = strip_connective \<^const>\HOL.disj\ + ([t], \<^Const>\Not\) + | strip_any_connective t = ([t], \<^Const>\Not\) +val conjuncts_of = strip_connective \<^Const>\conj\ +val disjuncts_of = strip_connective \<^Const>\disj\ (* When you add constants to these lists, make sure to handle them in "Nitpick_Nut.nut_from_term", and perhaps in "Nitpick_Mono.consider_term" as @@ -797,8 +797,8 @@ the (Quotient_Info.lookup_quotients thy s) val partial = case Thm.prop_of equiv_thm of - \<^const>\Trueprop\ $ (Const (\<^const_name>\equivp\, _) $ _) => false - | \<^const>\Trueprop\ $ (Const (\<^const_name>\part_equivp\, _) $ _) => true + \<^Const_>\Trueprop for \<^Const_>\equivp _ for _\\ => false + | \<^Const_>\Trueprop for \<^Const_>\part_equivp _ for _\\ => true | _ => raise NOT_SUPPORTED "Ill-formed quotient type equivalence \ \relation theorem" val Ts' = qtyp |> dest_Type |> snd @@ -948,7 +948,7 @@ fold (fn (z as ((s, _), T)) => fn t' => Logic.all_const T $ Abs (s, T, abstract_over (Var z, t'))) (take (length zs' - length zs) zs') - fun aux zs (\<^const>\Pure.imp\ $ t1 $ t2) = + fun aux zs \<^Const>\Pure.imp for t1 t2\ = let val zs' = Term.add_vars t1 zs in close_up zs zs' (Logic.mk_implies (t1, aux zs' t2)) end @@ -957,8 +957,8 @@ fun distinctness_formula T = all_distinct_unordered_pairs_of - #> map (fn (t1, t2) => \<^const>\Not\ $ (HOLogic.eq_const T $ t1 $ t2)) - #> List.foldr (s_conj o swap) \<^const>\True\ + #> map (fn (t1, t2) => \<^Const>\Not\ $ (HOLogic.eq_const T $ t1 $ t2)) + #> List.foldr (s_conj o swap) \<^Const>\True\ fun zero_const T = Const (\<^const_name>\zero_class.zero\, T) fun suc_const T = Const (\<^const_name>\Suc\, T --> T) @@ -986,7 +986,7 @@ SOME {abs_type, rep_type, Abs_name, ...} => [(Abs_name, varify_and_instantiate_type ctxt abs_type T rep_type --> T)] | NONE => - if T = \<^typ>\ind\ then [dest_Const \<^const>\Zero_Rep\, dest_Const \<^const>\Suc_Rep\] + if T = \<^typ>\ind\ then [dest_Const \<^Const>\Zero_Rep\, dest_Const \<^Const>\Suc_Rep\] else []) | uncached_data_type_constrs _ _ = [] @@ -1145,8 +1145,8 @@ if t1' aconv t2 then \<^prop>\True\ else t1 $ t2 | s_betapply _ (t1 as Const (\<^const_name>\HOL.eq\, _) $ t1', t2) = if t1' aconv t2 then \<^term>\True\ else t1 $ t2 - | s_betapply _ (Const (\<^const_name>\If\, _) $ \<^const>\True\ $ t1', _) = t1' - | s_betapply _ (Const (\<^const_name>\If\, _) $ \<^const>\False\ $ _, t2) = t2 + | s_betapply _ (Const (\<^const_name>\If\, _) $ \<^Const_>\True\ $ t1', _) = t1' + | s_betapply _ (Const (\<^const_name>\If\, _) $ \<^Const_>\False\ $ _, t2) = t2 | s_betapply Ts (Const (\<^const_name>\Let\, Type (_, [bound_T, Type (_, [_, body_T])])) $ t12 $ Abs (s, T, t13'), t2) = @@ -1181,18 +1181,18 @@ fun discr_term_for_constr hol_ctxt (x as (s, T)) = let val dataT = body_type T in if s = \<^const_name>\Suc\ then - Abs (Name.uu, dataT, \<^const>\Not\ $ HOLogic.mk_eq (zero_const dataT, Bound 0)) + Abs (Name.uu, dataT, \<^Const>\Not\ $ HOLogic.mk_eq (zero_const dataT, Bound 0)) else if length (data_type_constrs hol_ctxt dataT) >= 2 then Const (discr_for_constr x) else - Abs (Name.uu, dataT, \<^const>\True\) + Abs (Name.uu, dataT, \<^Const>\True\) end fun discriminate_value (hol_ctxt as {ctxt, ...}) x t = case head_of t of Const x' => - if x = x' then \<^const>\True\ - else if is_nonfree_constr ctxt x' then \<^const>\False\ + if x = x' then \<^Const>\True\ + else if is_nonfree_constr ctxt x' then \<^Const>\False\ else s_betapply [] (discr_term_for_constr hol_ctxt x, t) | _ => s_betapply [] (discr_term_for_constr hol_ctxt x, t) @@ -1379,10 +1379,10 @@ simplification rules (equational specifications). *) fun term_under_def t = case t of - \<^const>\Pure.imp\ $ _ $ t2 => term_under_def t2 - | Const (\<^const_name>\Pure.eq\, _) $ t1 $ _ => term_under_def t1 - | \<^const>\Trueprop\ $ t1 => term_under_def t1 - | Const (\<^const_name>\HOL.eq\, _) $ t1 $ _ => term_under_def t1 + \<^Const_>\Pure.imp for _ t2\ => term_under_def t2 + | \<^Const_>\Pure.eq _ for t1 _\ => term_under_def t1 + | \<^Const_>\Trueprop for t1\ => term_under_def t1 + | \<^Const_>\HOL.eq _ for t1 _\ => term_under_def t1 | Abs (_, _, t') => term_under_def t' | t1 $ _ => term_under_def t1 | _ => t @@ -1405,9 +1405,8 @@ | aux _ _ = NONE val (lhs, rhs) = case t of - Const (\<^const_name>\Pure.eq\, _) $ t1 $ t2 => (t1, t2) - | \<^const>\Trueprop\ $ (Const (\<^const_name>\HOL.eq\, _) $ t1 $ t2) => - (t1, t2) + \<^Const_>\Pure.eq _ for t1 t2\ => (t1, t2) + | \<^Const_>\Trueprop for \<^Const_>\HOL.eq _ for t1 t2\\ => (t1, t2) | _ => raise TERM ("Nitpick_HOL.normalized_rhs_of", [t]) val args = strip_comb lhs |> snd in fold_rev aux args (SOME rhs) end @@ -1482,13 +1481,13 @@ fun lhs_of_equation t = case t of - Const (\<^const_name>\Pure.all\, _) $ Abs (_, _, t1) => lhs_of_equation t1 - | Const (\<^const_name>\Pure.eq\, _) $ t1 $ _ => SOME t1 - | \<^const>\Pure.imp\ $ _ $ t2 => lhs_of_equation t2 - | \<^const>\Trueprop\ $ t1 => lhs_of_equation t1 - | Const (\<^const_name>\All\, _) $ Abs (_, _, t1) => lhs_of_equation t1 - | Const (\<^const_name>\HOL.eq\, _) $ t1 $ _ => SOME t1 - | \<^const>\HOL.implies\ $ _ $ t2 => lhs_of_equation t2 + \<^Const_>\Pure.all _ for \Abs (_, _, t1)\\ => lhs_of_equation t1 + | \<^Const_>\Pure.eq _ for t1 _\ => SOME t1 + | \<^Const_>\Pure.imp for _ t2\ => lhs_of_equation t2 + | \<^Const_>\Trueprop for t1\ => lhs_of_equation t1 + | \<^Const_>\All _ for \Abs (_, _, t1)\\ => lhs_of_equation t1 + | \<^Const_>\HOL.eq _ for t1 _\ => SOME t1 + | \<^Const_>\implies for _ t2\ => lhs_of_equation t2 | _ => NONE fun is_constr_pattern _ (Bound _) = true @@ -1598,19 +1597,19 @@ (incr_boundvars 1 func_t, x), discriminate_value hol_ctxt x (Bound 0))) |> AList.group (op aconv) - |> map (apsnd (List.foldl s_disj \<^const>\False\)) + |> map (apsnd (List.foldl s_disj \<^Const>\False\)) |> sort (int_ord o apply2 (size_of_term o snd)) |> rev in if res_T = bool_T then - if forall (member (op =) [\<^const>\False\, \<^const>\True\] o fst) cases then + if forall (member (op =) [\<^Const>\False\, \<^Const>\True\] o fst) cases then case cases of [(body_t, _)] => body_t - | [_, (\<^const>\True\, head_t2)] => head_t2 - | [_, (\<^const>\False\, head_t2)] => \<^const>\Not\ $ head_t2 + | [_, (\<^Const>\True\, head_t2)] => head_t2 + | [_, (\<^Const>\False\, head_t2)] => \<^Const>\Not for head_t2\ | _ => raise BAD ("Nitpick_HOL.optimized_case_def", "impossible cases") else - \<^const>\True\ |> fold_rev (add_constr_case res_T) cases + \<^Const>\True\ |> fold_rev (add_constr_case res_T) cases else fst (hd cases) |> fold_rev (add_constr_case res_T) (tl cases) end @@ -1895,13 +1894,12 @@ in Logic.list_implies (prems, case concl of - \<^const>\Trueprop\ $ (Const (\<^const_name>\HOL.eq\, Type (_, [T, _])) - $ t1 $ t2) => - \<^const>\Trueprop\ $ extensional_equal j T t1 t2 - | \<^const>\Trueprop\ $ t' => - \<^const>\Trueprop\ $ HOLogic.mk_eq (t', \<^const>\True\) - | Const (\<^const_name>\Pure.eq\, Type (_, [T, _])) $ t1 $ t2 => - \<^const>\Trueprop\ $ extensional_equal j T t1 t2 + \<^Const_>\Trueprop for \<^Const_>\HOL.eq T for t1 t2\\ => + \<^Const>\Trueprop for \extensional_equal j T t1 t2\\ + | \<^Const_>\Trueprop for t'\ => + \<^Const>\Trueprop for \HOLogic.mk_eq (t', \<^Const>\True\)\\ + | \<^Const_>\Pure.eq T for t1 t2\ => + \<^Const>\Trueprop for \extensional_equal j T t1 t2\\ | _ => (warning ("Ignoring " ^ quote tag ^ " for non-equation " ^ quote (Syntax.string_of_term ctxt t)); raise SAME ())) @@ -1951,7 +1949,7 @@ end fun ground_theorem_table thy = - fold ((fn \<^const>\Trueprop\ $ t1 => + fold ((fn \<^Const_>\Trueprop for t1\ => is_ground_term t1 ? Inttab.map_default (hash_term t1, []) (cons t1) | _ => I) o Thm.prop_of o snd) (Global_Theory.all_thms_of thy true) Inttab.empty @@ -2016,13 +2014,13 @@ in [Logic.mk_equals (normal_fun $ sel_a_t, sel_a_t), Logic.list_implies - ([\<^const>\Not\ $ (is_unknown_t $ normal_x), - \<^const>\Not\ $ (is_unknown_t $ normal_y), + ([\<^Const>\Not\ $ (is_unknown_t $ normal_x), + \<^Const>\Not\ $ (is_unknown_t $ normal_y), equiv_rel $ x_var $ y_var] |> map HOLogic.mk_Trueprop, Logic.mk_equals (normal_x, normal_y)), Logic.list_implies - ([HOLogic.mk_Trueprop (\<^const>\Not\ $ (is_unknown_t $ normal_x)), - HOLogic.mk_Trueprop (\<^const>\Not\ $ HOLogic.mk_eq (normal_x, x_var))], + ([HOLogic.mk_Trueprop (\<^Const>\Not\ $ (is_unknown_t $ normal_x)), + HOLogic.mk_Trueprop (\<^Const>\Not\ $ HOLogic.mk_eq (normal_x, x_var))], HOLogic.mk_Trueprop (equiv_rel $ x_var $ normal_x))] |> partial ? cons (HOLogic.mk_Trueprop (equiv_rel $ sel_a_t $ sel_a_t)) end @@ -2031,8 +2029,8 @@ let val xs = data_type_constrs hol_ctxt T val pred_T = T --> bool_T - val iter_T = \<^typ>\bisim_iterator\ - val bisim_max = \<^const>\bisim_iterator_max\ + val iter_T = \<^Type>\bisim_iterator\ + val bisim_max = \<^Const>\bisim_iterator_max\ val n_var = Var (("n", 0), iter_T) val n_var_minus_1 = Const (\<^const_name>\safe_The\, (iter_T --> bool_T) --> iter_T) @@ -2214,8 +2212,8 @@ fun repair_rec j (Const (\<^const_name>\Ex\, T1) $ Abs (s2, T2, t2')) = Const (\<^const_name>\Ex\, T1) $ Abs (s2, T2, repair_rec (j + 1) t2') - | repair_rec j (\<^const>\HOL.conj\ $ t1 $ t2) = - \<^const>\HOL.conj\ $ repair_rec j t1 $ repair_rec j t2 + | repair_rec j \<^Const_>\conj for t1 t2\ = + \<^Const>\conj for \repair_rec j t1\ \repair_rec j t2\\ | repair_rec j t = let val (head, args) = strip_comb t in if head = Bound j then @@ -2227,9 +2225,9 @@ val (nonrecs, recs) = List.partition (curry (op =) 0 o num_occs_of_bound_in_term j) (disjuncts_of body) - val base_body = nonrecs |> List.foldl s_disj \<^const>\False\ + val base_body = nonrecs |> List.foldl s_disj \<^Const>\False\ val step_body = recs |> map (repair_rec j) - |> List.foldl s_disj \<^const>\False\ + |> List.foldl s_disj \<^Const>\False\ in (fold_rev Term.abs (tl xs) (incr_bv (~1, j, base_body)) |> ap_n_split (length arg_Ts) tuple_T bool_T, @@ -2241,11 +2239,7 @@ in aux end fun predicatify T t = - let val set_T = HOLogic.mk_setT T in - Abs (Name.uu, T, - Const (\<^const_name>\Set.member\, T --> set_T --> bool_T) - $ Bound 0 $ incr_boundvars 1 t) - end + Abs (Name.uu, T, \<^Const>\Set.member T for \Bound 0\ \incr_boundvars 1 t\\) fun starred_linear_pred_const (hol_ctxt as {simp_table, ...}) (s, T) def = let @@ -2365,7 +2359,7 @@ [inductive_pred_axiom hol_ctxt x] else case def_of_const thy def_tables x of SOME def => - \<^const>\Trueprop\ $ HOLogic.mk_eq (Const x, def) + \<^Const>\Trueprop\ $ HOLogic.mk_eq (Const x, def) |> equationalize_term ctxt "" |> the |> single | NONE => []) | psimps => psimps) @@ -2373,7 +2367,7 @@ fun is_equational_fun_surely_complete hol_ctxt x = case equational_fun_axioms hol_ctxt x of - [\<^const>\Trueprop\ $ (Const (\<^const_name>\HOL.eq\, _) $ t1 $ _)] => + [\<^Const_>\Trueprop for \<^Const_>\HOL.eq _ for t1 _\\] => strip_comb t1 |> snd |> forall is_Var | _ => false diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/Nitpick/nitpick_model.ML --- a/src/HOL/Tools/Nitpick/nitpick_model.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/Nitpick/nitpick_model.ML Tue Sep 28 22:45:52 2021 +0200 @@ -333,8 +333,8 @@ else raise TYPE ("Nitpick_Model.format_fun.do_term", [T, T'], []) in if T1' = T1 andalso T2' = T2 then t else do_fun T1' T2' T1 T2 t end -fun truth_const_sort_key \<^const>\True\ = "0" - | truth_const_sort_key \<^const>\False\ = "2" +fun truth_const_sort_key \<^Const_>\True\ = "0" + | truth_const_sort_key \<^Const_>\False\ = "2" | truth_const_sort_key _ = "1" fun mk_tuple (Type (\<^type_name>\prod\, [T1, T2])) ts = @@ -411,14 +411,14 @@ empty_const | aux ((t1, t2) :: zs) = aux zs - |> t2 <> \<^const>\False\ + |> t2 <> \<^Const>\False\ ? curry (op $) (insert_const - $ (t1 |> t2 <> \<^const>\True\ + $ (t1 |> t2 <> \<^Const>\True\ ? curry (op $) (Const (maybe_name, T --> T)))) in - if forall (fn (_, t) => t <> \<^const>\True\ andalso t <> \<^const>\False\) + if forall (fn (_, t) => t <> \<^Const>\True\ andalso t <> \<^Const>\False\) tps then Const (unknown, set_T) else @@ -516,7 +516,7 @@ | term_for_atom seen \<^typ>\prop\ _ j k = HOLogic.mk_Trueprop (term_for_atom seen bool_T bool_T j k) | term_for_atom _ \<^typ>\bool\ _ j _ = - if j = 0 then \<^const>\False\ else \<^const>\True\ + if j = 0 then \<^Const>\False\ else \<^Const>\True\ | term_for_atom seen T _ j k = if T = nat_T then HOLogic.mk_number nat_T j @@ -524,7 +524,7 @@ HOLogic.mk_number int_T (int_for_atom (k, 0) j) else if is_fp_iterator_type T then HOLogic.mk_number nat_T (k - j - 1) - else if T = \<^typ>\bisim_iterator\ then + else if T = \<^Type>\bisim_iterator\ then HOLogic.mk_number nat_T j else case data_type_spec data_types T of NONE => nth_atom thy atomss pool T j diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/Nitpick/nitpick_mono.ML --- a/src/HOL/Tools/Nitpick/nitpick_mono.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/Nitpick/nitpick_mono.ML Tue Sep 28 22:45:52 2021 +0200 @@ -829,10 +829,10 @@ " \ " ^ Syntax.string_of_term ctxt t ^ " : _?"); case t of - \<^const>\False\ => (bool_M, accum ||> add_comp_frame (A Fls) Leq frame) + \<^Const_>\False\ => (bool_M, accum ||> add_comp_frame (A Fls) Leq frame) | Const (\<^const_name>\None\, T) => (mtype_for T, accum ||> add_comp_frame (A Fls) Leq frame) - | \<^const>\True\ => (bool_M, accum ||> add_comp_frame (A Tru) Leq frame) + | \<^Const_>\True\ => (bool_M, accum ||> add_comp_frame (A Tru) Leq frame) | (t0 as Const (\<^const_name>\HOL.eq\, _)) $ Bound 0 $ t2 => (* hack to exploit symmetry of equality when typing "insert" *) (if t2 = Bound 0 then do_term \<^term>\True\ @@ -850,9 +850,9 @@ | \<^const_name>\Ex\ => let val set_T = domain_type T in do_term (Abs (Name.uu, set_T, - \<^const>\Not\ $ (HOLogic.mk_eq + \<^Const>\Not\ $ (HOLogic.mk_eq (Abs (Name.uu, domain_type set_T, - \<^const>\False\), + \<^Const>\False\), Bound 0)))) accum end | \<^const_name>\HOL.eq\ => do_equals T accum @@ -971,12 +971,11 @@ val (M', accum) = do_term t' (accum |>> push_bound (V x) T M) in (MFun (M, V x, M'), accum |>> pop_bound) end)) - | \<^const>\Not\ $ t1 => do_connect imp_spec t1 \<^const>\False\ accum - | \<^const>\conj\ $ t1 $ t2 => do_connect conj_spec t1 t2 accum - | \<^const>\disj\ $ t1 $ t2 => do_connect disj_spec t1 t2 accum - | \<^const>\implies\ $ t1 $ t2 => do_connect imp_spec t1 t2 accum - | Const (\<^const_name>\Let\, _) $ t1 $ t2 => - do_term (betapply (t2, t1)) accum + | \<^Const_>\Not for t1\ => do_connect imp_spec t1 \<^Const>\False\ accum + | \<^Const_>\conj for t1 t2\ => do_connect conj_spec t1 t2 accum + | \<^Const_>\disj for t1 t2\ => do_connect disj_spec t1 t2 accum + | \<^Const_>\implies for t1 t2\ => do_connect imp_spec t1 t2 accum + | \<^Const_>\Let _ _ for t1 t2\ => do_term (betapply (t2, t1)) accum | t1 $ t2 => let fun is_in t (j, _) = loose_bvar1 (t, length bound_Ts - j - 1) @@ -1060,7 +1059,7 @@ Const (s as \<^const_name>\Pure.all\, _) $ Abs (_, T1, t1) => do_quantifier s T1 t1 | Const (\<^const_name>\Pure.eq\, _) $ t1 $ t2 => do_equals t1 t2 - | \<^const>\Trueprop\ $ t1 => do_formula sn t1 accum + | \<^Const_>\Trueprop for t1\ => do_formula sn t1 accum | Const (s as \<^const_name>\All\, _) $ Abs (_, T1, t1) => do_quantifier s T1 t1 | Const (s as \<^const_name>\Ex\, T0) $ (t1 as Abs (_, T1, t1')) => @@ -1068,19 +1067,17 @@ Plus => do_quantifier s T1 t1' | Minus => (* FIXME: Needed? *) - do_term (\<^const>\Not\ + do_term (\<^Const>\Not\ $ (HOLogic.eq_const (domain_type T0) $ t1 - $ Abs (Name.uu, T1, \<^const>\False\))) accum) - | Const (\<^const_name>\HOL.eq\, _) $ t1 $ t2 => do_equals t1 t2 - | Const (\<^const_name>\Let\, _) $ t1 $ t2 => - do_formula sn (betapply (t2, t1)) accum - | \<^const>\Pure.conjunction\ $ t1 $ t2 => - do_connect meta_conj_spec false t1 t2 accum - | \<^const>\Pure.imp\ $ t1 $ t2 => do_connect meta_imp_spec true t1 t2 accum - | \<^const>\Not\ $ t1 => do_connect imp_spec true t1 \<^const>\False\ accum - | \<^const>\conj\ $ t1 $ t2 => do_connect conj_spec false t1 t2 accum - | \<^const>\disj\ $ t1 $ t2 => do_connect disj_spec false t1 t2 accum - | \<^const>\implies\ $ t1 $ t2 => do_connect imp_spec true t1 t2 accum + $ Abs (Name.uu, T1, \<^Const>\False\))) accum) + | \<^Const_>\HOL.eq _ for t1 t2\ => do_equals t1 t2 + | \<^Const_>\Let _ _ for t1 t2\ => do_formula sn (betapply (t2, t1)) accum + | \<^Const_>\Pure.conjunction for t1 t2\ => do_connect meta_conj_spec false t1 t2 accum + | \<^Const_>\Pure.imp for t1 t2\ => do_connect meta_imp_spec true t1 t2 accum + | \<^Const_>\Not for t1\ => do_connect imp_spec true t1 \<^Const>\False\ accum + | \<^Const_>\conj for t1 t2\ => do_connect conj_spec false t1 t2 accum + | \<^Const_>\disj for t1 t2\ => do_connect disj_spec false t1 t2 accum + | \<^Const_>\implies for t1 t2\ => do_connect imp_spec true t1 t2 accum | _ => do_term t accum end |> tap (fn (gamma, _) => @@ -1122,18 +1119,15 @@ and do_implies t1 t2 = do_term t1 #> do_formula t2 and do_formula t accum = case t of - Const (\<^const_name>\Pure.all\, _) $ Abs (_, T1, t1) => do_all T1 t1 accum - | \<^const>\Trueprop\ $ t1 => do_formula t1 accum - | Const (\<^const_name>\Pure.eq\, _) $ t1 $ t2 => - consider_general_equals mdata true t1 t2 accum - | \<^const>\Pure.imp\ $ t1 $ t2 => do_implies t1 t2 accum - | \<^const>\Pure.conjunction\ $ t1 $ t2 => - fold (do_formula) [t1, t2] accum - | Const (\<^const_name>\All\, _) $ Abs (_, T1, t1) => do_all T1 t1 accum - | Const (\<^const_name>\HOL.eq\, _) $ t1 $ t2 => - consider_general_equals mdata true t1 t2 accum - | \<^const>\conj\ $ t1 $ t2 => fold (do_formula) [t1, t2] accum - | \<^const>\implies\ $ t1 $ t2 => do_implies t1 t2 accum + \<^Const_>\Pure.all _ for \Abs (_, T1, t1)\\ => do_all T1 t1 accum + | \<^Const_>\Trueprop for t1\ => do_formula t1 accum + | \<^Const_>\Pure.eq _ for t1 t2\ => consider_general_equals mdata true t1 t2 accum + | \<^Const_>\Pure.imp for t1 t2\ => do_implies t1 t2 accum + | \<^Const_>\Pure.conjunction for t1 t2\ => fold (do_formula) [t1, t2] accum + | \<^Const_>\All _ for \Abs (_, T1, t1)\\ => do_all T1 t1 accum + | \<^Const_>\HOL.eq _ for t1 t2\ => consider_general_equals mdata true t1 t2 accum + | \<^Const_>\conj for t1 t2\ => fold (do_formula) [t1, t2] accum + | \<^Const_>\implies for t1 t2\ => do_implies t1 t2 accum | _ => raise TERM ("Nitpick_Mono.consider_definitional_axiom.\ \do_formula", [t]) in do_formula t end diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/Nitpick/nitpick_preproc.ML --- a/src/HOL/Tools/Nitpick/nitpick_preproc.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/Nitpick/nitpick_preproc.ML Tue Sep 28 22:45:52 2021 +0200 @@ -36,15 +36,12 @@ val may_use_binary_ints = let - fun aux def (Const (\<^const_name>\Pure.eq\, _) $ t1 $ t2) = - aux def t1 andalso aux false t2 - | aux def (\<^const>\Pure.imp\ $ t1 $ t2) = aux false t1 andalso aux def t2 - | aux def (Const (\<^const_name>\HOL.eq\, _) $ t1 $ t2) = - aux def t1 andalso aux false t2 - | aux def (\<^const>\HOL.implies\ $ t1 $ t2) = aux false t1 andalso aux def t2 + fun aux def \<^Const_>\Pure.eq _ for t1 t2\ = aux def t1 andalso aux false t2 + | aux def \<^Const_>\Pure.imp for t1 t2\ = aux false t1 andalso aux def t2 + | aux def \<^Const_>\HOL.eq _ for t1 t2\ = aux def t1 andalso aux false t2 + | aux def \<^Const_>\implies for t1 t2\ = aux false t1 andalso aux def t2 | aux def (t1 $ t2) = aux def t1 andalso aux def t2 - | aux def (t as Const (s, _)) = - (not def orelse t <> \<^const>\Suc\) andalso + | aux def (t as Const (s, _)) = (not def orelse t <> \<^Const>\Suc\) andalso not (member (op =) [\<^const_name>\Abs_Frac\, \<^const_name>\Rep_Frac\, \<^const_name>\nat_gcd\, \<^const_name>\nat_lcm\, @@ -143,7 +140,7 @@ | _ => exists_subterm (curry (op =) (Var z)) t' ? insert (op =) T fun box_var_in_def new_Ts old_Ts t (z as (_, T)) = case t of - \<^const>\Trueprop\ $ t1 => box_var_in_def new_Ts old_Ts t1 z + \<^Const_>\Trueprop for t1\ => box_var_in_def new_Ts old_Ts t1 z | Const (s0, _) $ t1 $ _ => if s0 = \<^const_name>\Pure.eq\ orelse s0 = \<^const_name>\HOL.eq\ then let @@ -190,31 +187,29 @@ do_quantifier new_Ts old_Ts polar s0 T0 s1 T1 t1 | Const (s0 as \<^const_name>\Pure.eq\, T0) $ t1 $ t2 => do_equals new_Ts old_Ts s0 T0 t1 t2 - | \<^const>\Pure.imp\ $ t1 $ t2 => - \<^const>\Pure.imp\ $ do_term new_Ts old_Ts (flip_polarity polar) t1 - $ do_term new_Ts old_Ts polar t2 - | \<^const>\Pure.conjunction\ $ t1 $ t2 => - \<^const>\Pure.conjunction\ $ do_term new_Ts old_Ts polar t1 - $ do_term new_Ts old_Ts polar t2 - | \<^const>\Trueprop\ $ t1 => - \<^const>\Trueprop\ $ do_term new_Ts old_Ts polar t1 - | \<^const>\Not\ $ t1 => - \<^const>\Not\ $ do_term new_Ts old_Ts (flip_polarity polar) t1 + | \<^Const_>\Pure.imp for t1 t2\ => + \<^Const>\Pure.imp for \do_term new_Ts old_Ts (flip_polarity polar) t1\ + \do_term new_Ts old_Ts polar t2\\ + | \<^Const_>\Pure.conjunction for t1 t2\ => + \<^Const>\Pure.conjunction for \do_term new_Ts old_Ts polar t1\ + \do_term new_Ts old_Ts polar t2\\ + | \<^Const_>\Trueprop for t1\ => \<^Const>\Trueprop for \do_term new_Ts old_Ts polar t1\\ + | \<^Const_>\Not for t1\ => \<^Const>\Not for \do_term new_Ts old_Ts (flip_polarity polar) t1\\ | Const (s0 as \<^const_name>\All\, T0) $ Abs (s1, T1, t1) => do_quantifier new_Ts old_Ts polar s0 T0 s1 T1 t1 | Const (s0 as \<^const_name>\Ex\, T0) $ Abs (s1, T1, t1) => do_quantifier new_Ts old_Ts polar s0 T0 s1 T1 t1 | Const (s0 as \<^const_name>\HOL.eq\, T0) $ t1 $ t2 => do_equals new_Ts old_Ts s0 T0 t1 t2 - | \<^const>\HOL.conj\ $ t1 $ t2 => - \<^const>\HOL.conj\ $ do_term new_Ts old_Ts polar t1 - $ do_term new_Ts old_Ts polar t2 - | \<^const>\HOL.disj\ $ t1 $ t2 => - \<^const>\HOL.disj\ $ do_term new_Ts old_Ts polar t1 - $ do_term new_Ts old_Ts polar t2 - | \<^const>\HOL.implies\ $ t1 $ t2 => - \<^const>\HOL.implies\ $ do_term new_Ts old_Ts (flip_polarity polar) t1 - $ do_term new_Ts old_Ts polar t2 + | \<^Const_>\conj for t1 t2\ => + \<^Const>\conj for \do_term new_Ts old_Ts polar t1\ + \do_term new_Ts old_Ts polar t2\\ + | \<^Const_>\disj for t1 t2\ => + \<^Const>\disj for \do_term new_Ts old_Ts polar t1\ + \do_term new_Ts old_Ts polar t2\\ + | \<^Const_>\implies for t1 t2\ => + \<^Const>\implies for \do_term new_Ts old_Ts (flip_polarity polar) t1\ + \do_term new_Ts old_Ts polar t2\\ | Const (x as (s, T)) => if is_descr s then do_descr s T @@ -335,11 +330,11 @@ case t of (t0 as Const (\<^const_name>\Pure.eq\, _)) $ t1 $ t2 => do_eq_or_imp Ts true def t0 t1 t2 seen - | (t0 as \<^const>\Pure.imp\) $ t1 $ t2 => + | (t0 as \<^Const_>\Pure.imp\) $ t1 $ t2 => if def then (t, []) else do_eq_or_imp Ts false def t0 t1 t2 seen | (t0 as Const (\<^const_name>\HOL.eq\, _)) $ t1 $ t2 => do_eq_or_imp Ts true def t0 t1 t2 seen - | (t0 as \<^const>\HOL.implies\) $ t1 $ t2 => + | (t0 as \<^Const_>\implies\) $ t1 $ t2 => do_eq_or_imp Ts false def t0 t1 t2 seen | Abs (s, T, t') => let val (t', seen) = do_term (T :: Ts) def t' [] seen in @@ -402,11 +397,11 @@ | _ => I) t (K 0) fun aux Ts careful ((t0 as Const (\<^const_name>\Pure.eq\, _)) $ t1 $ t2) = aux_eq Ts careful true t0 t1 t2 - | aux Ts careful ((t0 as \<^const>\Pure.imp\) $ t1 $ t2) = + | aux Ts careful ((t0 as \<^Const_>\Pure.imp\) $ t1 $ t2) = t0 $ aux Ts false t1 $ aux Ts careful t2 | aux Ts careful ((t0 as Const (\<^const_name>\HOL.eq\, _)) $ t1 $ t2) = aux_eq Ts careful true t0 t1 t2 - | aux Ts careful ((t0 as \<^const>\HOL.implies\) $ t1 $ t2) = + | aux Ts careful ((t0 as \<^Const_>\implies\) $ t1 $ t2) = t0 $ aux Ts false t1 $ aux Ts careful t2 | aux Ts careful (Abs (s, T, t')) = Abs (s, T, aux (T :: Ts) careful t') | aux Ts careful (t1 $ t2) = aux Ts careful t1 $ aux Ts careful t2 @@ -417,13 +412,13 @@ raise SAME () else if axiom andalso is_Var t2 andalso num_occs_of_var (dest_Var t2) = 1 then - \<^const>\True\ + \<^Const>\True\ else case strip_comb t2 of (* The first case is not as general as it could be. *) (Const (\<^const_name>\PairBox\, _), [Const (\<^const_name>\fst\, _) $ Var z1, Const (\<^const_name>\snd\, _) $ Var z2]) => - if z1 = z2 andalso num_occs_of_var z1 = 2 then \<^const>\True\ + if z1 = z2 andalso num_occs_of_var z1 = 2 then \<^Const>\True\ else raise SAME () | (Const (x as (s, T)), args) => let @@ -454,26 +449,22 @@ (** Destruction of universal and existential equalities **) -fun curry_assms (\<^const>\Pure.imp\ $ (\<^const>\Trueprop\ - $ (\<^const>\HOL.conj\ $ t1 $ t2)) $ t3) = +fun curry_assms \<^Const_>\Pure.imp for \<^Const>\Trueprop for \<^Const_>\conj for t1 t2\\ t3\ = curry_assms (Logic.list_implies ([t1, t2] |> map HOLogic.mk_Trueprop, t3)) - | curry_assms (\<^const>\Pure.imp\ $ t1 $ t2) = - \<^const>\Pure.imp\ $ curry_assms t1 $ curry_assms t2 + | curry_assms \<^Const_>\Pure.imp for t1 t2\ = \<^Const>\Pure.imp for \curry_assms t1\ \curry_assms t2\\ | curry_assms t = t val destroy_universal_equalities = let fun aux prems zs t = case t of - \<^const>\Pure.imp\ $ t1 $ t2 => aux_implies prems zs t1 t2 + \<^Const_>\Pure.imp for t1 t2\ => aux_implies prems zs t1 t2 | _ => Logic.list_implies (rev prems, t) and aux_implies prems zs t1 t2 = case t1 of - Const (\<^const_name>\Pure.eq\, _) $ Var z $ t' => aux_eq prems zs z t' t1 t2 - | \<^const>\Trueprop\ $ (Const (\<^const_name>\HOL.eq\, _) $ Var z $ t') => - aux_eq prems zs z t' t1 t2 - | \<^const>\Trueprop\ $ (Const (\<^const_name>\HOL.eq\, _) $ t' $ Var z) => - aux_eq prems zs z t' t1 t2 + \<^Const_>\Pure.eq _ for \Var z\ t'\ => aux_eq prems zs z t' t1 t2 + | \<^Const_>\Trueprop for \<^Const_>\HOL.eq _ for \Var z\ t'\\ => aux_eq prems zs z t' t1 t2 + | \<^Const_>\Trueprop for \<^Const_>\HOL.eq _ for t' \Var z\\\ => aux_eq prems zs z t' t1 t2 | _ => aux (t1 :: prems) (Term.add_vars t1 zs) t2 and aux_eq prems zs z t' t1 t2 = if not (member (op =) zs z) andalso @@ -528,7 +519,7 @@ fun kill [] [] ts = foldr1 s_conj ts | kill (s :: ss) (T :: Ts) ts = (case find_bound_assign ctxt (length ss) [] ts of - SOME (_, []) => \<^const>\True\ + SOME (_, []) => \<^Const>\True\ | SOME (arg_t, ts) => kill ss Ts (map (subst_one_bound (length ss) (incr_bv (~1, length ss + 1, arg_t))) ts) @@ -592,27 +583,27 @@ case t of Const (s0 as \<^const_name>\Pure.all\, T0) $ Abs (s1, T1, t1) => do_quantifier s0 T0 s1 T1 t1 - | \<^const>\Pure.imp\ $ t1 $ t2 => - \<^const>\Pure.imp\ $ aux ss Ts js skolemizable (flip_polarity polar) t1 - $ aux ss Ts js skolemizable polar t2 - | \<^const>\Pure.conjunction\ $ t1 $ t2 => - \<^const>\Pure.conjunction\ $ aux ss Ts js skolemizable polar t1 - $ aux ss Ts js skolemizable polar t2 - | \<^const>\Trueprop\ $ t1 => - \<^const>\Trueprop\ $ aux ss Ts js skolemizable polar t1 - | \<^const>\Not\ $ t1 => - \<^const>\Not\ $ aux ss Ts js skolemizable (flip_polarity polar) t1 + | \<^Const_>\Pure.imp for t1 t2\ => + \<^Const>\Pure.imp for \aux ss Ts js skolemizable (flip_polarity polar) t1\ + \aux ss Ts js skolemizable polar t2\\ + | \<^Const_>\Pure.conjunction for t1 t2\ => + \<^Const>\Pure.conjunction for \aux ss Ts js skolemizable polar t1\ + \aux ss Ts js skolemizable polar t2\\ + | \<^Const_>\Trueprop for t1\ => + \<^Const>\Trueprop for \aux ss Ts js skolemizable polar t1\\ + | \<^Const_>\Not for t1\ => + \<^Const>\Not for \aux ss Ts js skolemizable (flip_polarity polar) t1\\ | Const (s0 as \<^const_name>\All\, T0) $ Abs (s1, T1, t1) => do_quantifier s0 T0 s1 T1 t1 | Const (s0 as \<^const_name>\Ex\, T0) $ Abs (s1, T1, t1) => do_quantifier s0 T0 s1 T1 t1 - | \<^const>\HOL.conj\ $ t1 $ t2 => + | \<^Const_>\conj for t1 t2\ => s_conj (apply2 (aux ss Ts js skolemizable polar) (t1, t2)) - | \<^const>\HOL.disj\ $ t1 $ t2 => + | \<^Const_>\disj for t1 t2\ => s_disj (apply2 (aux ss Ts js skolemizable polar) (t1, t2)) - | \<^const>\HOL.implies\ $ t1 $ t2 => - \<^const>\HOL.implies\ $ aux ss Ts js skolemizable (flip_polarity polar) t1 - $ aux ss Ts js skolemizable polar t2 + | \<^Const_>\implies for t1 t2\ => + \<^Const>\implies for \aux ss Ts js skolemizable (flip_polarity polar) t1\ + \aux ss Ts js skolemizable polar t2\\ | (t0 as Const (\<^const_name>\Let\, _)) $ t1 $ t2 => t0 $ t1 $ aux ss Ts js skolemizable polar t2 | Const (x as (s, T)) => @@ -622,8 +613,8 @@ let val gfp = (fixpoint_kind_of_const thy def_tables x = Gfp) val (pref, connective) = - if gfp then (lbfp_prefix, \<^const>\HOL.disj\) - else (ubfp_prefix, \<^const>\HOL.conj\) + if gfp then (lbfp_prefix, \<^Const>\disj\) + else (ubfp_prefix, \<^Const>\conj\) fun pos () = unrolled_inductive_pred_const hol_ctxt gfp x |> aux ss Ts js skolemizable polar fun neg () = Const (pref ^ s, T) @@ -653,10 +644,9 @@ (** Function specialization **) -fun params_in_equation (\<^const>\Pure.imp\ $ _ $ t2) = params_in_equation t2 - | params_in_equation (\<^const>\Trueprop\ $ t1) = params_in_equation t1 - | params_in_equation (Const (\<^const_name>\HOL.eq\, _) $ t1 $ _) = - snd (strip_comb t1) +fun params_in_equation \<^Const_>\Pure.imp for _ t2\ = params_in_equation t2 + | params_in_equation \<^Const_>\Trueprop for t1\ = params_in_equation t1 + | params_in_equation \<^Const_>\HOL.eq _ for t1 _\ = snd (strip_comb t1) | params_in_equation _ = [] fun specialize_fun_axiom x x' fixed_js fixed_args extra_args t = @@ -865,10 +855,8 @@ if exists_subterm (curry (op aconv) u) def then NONE else SOME u in case t of - Const (\<^const_name>\Pure.eq\, _) $ (u as Free _) $ def => do_equals u def - | \<^const>\Trueprop\ - $ (Const (\<^const_name>\HOL.eq\, _) $ (u as Free _) $ def) => - do_equals u def + \<^Const_>\Pure.eq _ for \u as Free _\ def\ => do_equals u def + | \<^Const_>\Trueprop\ $ \<^Const_>\HOL.eq _ for \u as Free _\ def\ => do_equals u def | _ => NONE end @@ -917,7 +905,7 @@ and add_def_axiom depth = add_axiom fst apfst true depth and add_nondef_axiom depth = add_axiom snd apsnd false depth and add_maybe_def_axiom depth t = - (if head_of t <> \<^const>\Pure.imp\ then add_def_axiom + (if head_of t <> \<^Const>\Pure.imp\ then add_def_axiom else add_nondef_axiom) depth t and add_eq_axiom depth t = (if is_constr_pattern_formula ctxt t then add_def_axiom @@ -1104,10 +1092,10 @@ case t of (t0 as Const (\<^const_name>\All\, T0)) $ Abs (s, T1, t1) => (case t1 of - (t10 as \<^const>\HOL.conj\) $ t11 $ t12 => + (t10 as \<^Const_>\conj\) $ t11 $ t12 => t10 $ distribute_quantifiers (t0 $ Abs (s, T1, t11)) $ distribute_quantifiers (t0 $ Abs (s, T1, t12)) - | (t10 as \<^const>\Not\) $ t11 => + | (t10 as \<^Const_>\Not\) $ t11 => t10 $ distribute_quantifiers (Const (\<^const_name>\Ex\, T0) $ Abs (s, T1, t11)) | t1 => @@ -1117,14 +1105,14 @@ t0 $ Abs (s, T1, distribute_quantifiers t1)) | (t0 as Const (\<^const_name>\Ex\, T0)) $ Abs (s, T1, t1) => (case distribute_quantifiers t1 of - (t10 as \<^const>\HOL.disj\) $ t11 $ t12 => + (t10 as \<^Const_>\disj\) $ t11 $ t12 => t10 $ distribute_quantifiers (t0 $ Abs (s, T1, t11)) $ distribute_quantifiers (t0 $ Abs (s, T1, t12)) - | (t10 as \<^const>\HOL.implies\) $ t11 $ t12 => + | (t10 as \<^Const_>\implies\) $ t11 $ t12 => t10 $ distribute_quantifiers (Const (\<^const_name>\All\, T0) $ Abs (s, T1, t11)) $ distribute_quantifiers (t0 $ Abs (s, T1, t12)) - | (t10 as \<^const>\Not\) $ t11 => + | (t10 as \<^Const_>\Not\) $ t11 => t10 $ distribute_quantifiers (Const (\<^const_name>\All\, T0) $ Abs (s, T1, t11)) | t1 => diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/Nunchaku/nunchaku.ML --- a/src/HOL/Tools/Nunchaku/nunchaku.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/Nunchaku/nunchaku.ML Tue Sep 28 22:45:52 2021 +0200 @@ -131,7 +131,7 @@ fun none_true assigns = forall (curry (op <>) (SOME true) o snd) assigns; -fun has_lonely_bool_var (\<^const>\Pure.conjunction\ $ (\<^const>\Trueprop\ $ Free _) $ _) = true +fun has_lonely_bool_var \<^Const_>\Pure.conjunction for \<^Const_>\Trueprop for \Free _\\ _\ = true | has_lonely_bool_var _ = false; val syntactic_sorts = diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/Nunchaku/nunchaku_collect.ML --- a/src/HOL/Tools/Nunchaku/nunchaku_collect.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/Nunchaku/nunchaku_collect.ML Tue Sep 28 22:45:52 2021 +0200 @@ -240,7 +240,7 @@ fun mutual_co_datatypes_of ctxt (T_name, Ts) = (if T_name = \<^type_name>\itself\ then - (BNF_Util.Least_FP, [\<^typ>\'a itself\], [[@{const Pure.type ('a)}]]) + (BNF_Util.Least_FP, [\<^typ>\'a itself\], [[\<^Const>\Pure.type \<^typ>\'a\\]]) else let val (fp, ctr_sugars) = @@ -269,7 +269,7 @@ val A = Logic.varifyT_global \<^typ>\'a\; val absT = Type (\<^type_name>\set\, [A]); val repT = A --> HOLogic.boolT; - val pred = Abs (Name.uu, repT, \<^const>\True\); + val pred = Abs (Name.uu, repT, \<^Const>\True\); val abs = Const (\<^const_name>\Collect\, repT --> absT); val rep = Const (\<^const_name>\rmember\, absT --> repT); in @@ -518,8 +518,8 @@ fold process_spec specs NONE end; -fun lhs_of_equation (Const (\<^const_name>\Pure.eq\, _) $ t $ _) = t - | lhs_of_equation (\<^const>\Trueprop\ $ (Const (\<^const_name>\HOL.eq\, _) $ t $ _)) = t; +fun lhs_of_equation \<^Const_>\Pure.eq _ for t _\ = t + | lhs_of_equation \<^Const_>\Trueprop for \<^Const_>\HOL.eq _ for t _\\ = t; fun specialize_definition_type thy x def0 = let @@ -674,10 +674,10 @@ [cmd] :: (group :: groups) end; -fun defined_by (Const (\<^const_name>\All\, _) $ t) = defined_by t +fun defined_by \<^Const_>\All _ for t\ = defined_by t | defined_by (Abs (_, _, t)) = defined_by t - | defined_by (\<^const>\implies\ $ _ $ u) = defined_by u - | defined_by (Const (\<^const_name>\HOL.eq\, _) $ t $ _) = head_of t + | defined_by \<^Const_>\implies for _ u\ = defined_by u + | defined_by \<^Const_>\HOL.eq _ for t _\ = head_of t | defined_by t = head_of t; fun partition_props [_] props = SOME [props] @@ -1002,14 +1002,14 @@ val (poly_axioms, mono_axioms0) = orphan_axioms_of ctxt |> List.partition has_polymorphism; - fun implicit_evals_of pol (\<^const>\Not\ $ t) = implicit_evals_of (not pol) t - | implicit_evals_of pol (\<^const>\implies\ $ t $ u) = + fun implicit_evals_of pol \<^Const_>\Not for t\ = implicit_evals_of (not pol) t + | implicit_evals_of pol \<^Const_>\implies for t u\ = (case implicit_evals_of pol u of [] => implicit_evals_of (not pol) t | ts => ts) - | implicit_evals_of pol (\<^const>\conj\ $ t $ u) = + | implicit_evals_of pol \<^Const_>\conj for t u\ = union (op aconv) (implicit_evals_of pol t) (implicit_evals_of pol u) - | implicit_evals_of pol (\<^const>\disj\ $ t $ u) = + | implicit_evals_of pol \<^Const_>\disj for t u\ = union (op aconv) (implicit_evals_of pol t) (implicit_evals_of pol u) | implicit_evals_of false (Const (\<^const_name>\HOL.eq\, _) $ t $ u) = distinct (op aconv) [t, u] @@ -1049,7 +1049,7 @@ Syntax.string_of_term ctxt t ^ " : " ^ Syntax.string_of_typ ctxt (fastype_of t); fun is_triv_wrt (Abs (_, _, body)) = is_triv_wrt body - | is_triv_wrt \<^const>\True\ = true + | is_triv_wrt \<^Const>\True\ = true | is_triv_wrt _ = false; fun str_of_isa_type_spec ctxt {abs_typ, rep_typ, wrt, abs, rep} = diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/Nunchaku/nunchaku_reconstruct.ML --- a/src/HOL/Tools/Nunchaku/nunchaku_reconstruct.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/Nunchaku/nunchaku_reconstruct.ML Tue Sep 28 22:45:52 2021 +0200 @@ -166,11 +166,11 @@ else if id = nun_equals then Const (\<^const_name>\HOL.eq\, typ_of ty) else if id = nun_false then - \<^const>\False\ + \<^Const>\False\ else if id = nun_if then Const (\<^const_name>\If\, typ_of ty) else if id = nun_implies then - \<^term>\implies\ + \<^Const>\implies\ else if id = nun_not then HOLogic.Not else if id = nun_unique then @@ -178,7 +178,7 @@ else if id = nun_unique_unsafe then Const (\<^const_name>\The_unsafe\, typ_of ty) else if id = nun_true then - \<^const>\True\ + \<^Const>\True\ else if String.isPrefix nun_dollar_anon_fun_prefix id then let val j = Int.fromString (unprefix nun_dollar_anon_fun_prefix id) |> the_default ~1 in Var ((anonymousN ^ nat_subscript (j + 1), 0), typ_of ty) @@ -225,12 +225,12 @@ end | term_of _ (NMatch _) = raise Fail "unexpected match"; - fun rewrite_numbers (t as \<^const>\Suc\ $ _) = + fun rewrite_numbers (t as \<^Const>\Suc\ $ _) = (case try HOLogic.dest_nat t of - SOME n => HOLogic.mk_number \<^typ>\nat\ n + SOME n => HOLogic.mk_number \<^Type>\nat\ n | NONE => t) - | rewrite_numbers (\<^const>\Abs_Integ\ $ (@{const Pair (nat, nat)} $ t $ u)) = - HOLogic.mk_number \<^typ>\int\ (HOLogic.dest_nat t - HOLogic.dest_nat u) + | rewrite_numbers \<^Const_>\Abs_Integ for \<^Const>\Pair \<^Type>\nat\ \<^Type>\nat\ for t u\\ = + HOLogic.mk_number \<^Type>\int\ (HOLogic.dest_nat t - HOLogic.dest_nat u) | rewrite_numbers (t $ u) = rewrite_numbers t $ rewrite_numbers u | rewrite_numbers (Abs (s, T, t)) = Abs (s, T, rewrite_numbers t) | rewrite_numbers t = t; diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/Quickcheck/quickcheck_common.ML --- a/src/HOL/Tools/Quickcheck/quickcheck_common.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/Quickcheck/quickcheck_common.ML Tue Sep 28 22:45:52 2021 +0200 @@ -466,8 +466,8 @@ fun make_fun_upds T1 T2 (tps, t) = fold_rev (mk_fun_upd T1 T2) tps t fun make_set T1 [] = Const (\<^const_abbrev>\Set.empty\, T1 --> \<^typ>\bool\) - | make_set T1 ((_, \<^const>\False\) :: tps) = make_set T1 tps - | make_set T1 ((t1, \<^const>\True\) :: tps) = + | make_set T1 ((_, \<^Const_>\False\) :: tps) = make_set T1 tps + | make_set T1 ((t1, \<^Const_>\True\) :: tps) = Const (\<^const_name>\insert\, T1 --> (T1 --> \<^typ>\bool\) --> T1 --> \<^typ>\bool\) $ t1 $ (make_set T1 tps) | make_set T1 ((_, t) :: _) = raise TERM ("make_set", [t]) @@ -476,8 +476,8 @@ | make_coset T tps = let val U = T --> \<^typ>\bool\ - fun invert \<^const>\False\ = \<^const>\True\ - | invert \<^const>\True\ = \<^const>\False\ + fun invert \<^Const_>\False\ = \<^Const>\True\ + | invert \<^Const_>\True\ = \<^Const>\False\ in Const (\<^const_name>\Groups.minus_class.minus\, U --> U --> U) $ Const (\<^const_abbrev>\UNIV\, U) $ make_set T (map (apsnd invert) tps) @@ -505,8 +505,8 @@ (case T2 of \<^typ>\bool\ => (case t of - Abs(_, _, \<^const>\False\) => fst #> rev #> make_set T1 - | Abs(_, _, \<^const>\True\) => fst #> rev #> make_coset T1 + Abs(_, _, \<^Const_>\False\) => fst #> rev #> make_set T1 + | Abs(_, _, \<^Const_>\True\) => fst #> rev #> make_coset T1 | Abs(_, _, Const (\<^const_name>\undefined\, _)) => fst #> rev #> make_set T1 | _ => raise TERM ("post_process_term", [t])) | Type (\<^type_name>\option\, _) => diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/Quickcheck/random_generators.ML --- a/src/HOL/Tools/Quickcheck/random_generators.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/Quickcheck/random_generators.ML Tue Sep 28 22:45:52 2021 +0200 @@ -96,7 +96,7 @@ fun subst_v t' = map_aterms (fn t as Free (w, _) => if v = w then t' else t | t => t); val t_rhs = lambda t_k proto_t_rhs; val eqs0 = [subst_v \<^term>\0::natural\ eq, - subst_v (\<^const>\Code_Numeral.Suc\ $ t_k) eq]; + subst_v \<^Const>\Code_Numeral.Suc for t_k\ eq]; val eqs1 = map (Pattern.rewrite_term thy rew_ts []) eqs0; val ((_, (_, eqs2)), lthy') = lthy |> BNF_LFP_Compat.primrec_simple diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/SMT/conj_disj_perm.ML --- a/src/HOL/Tools/SMT/conj_disj_perm.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/SMT/conj_disj_perm.ML Tue Sep 28 22:45:52 2021 +0200 @@ -25,9 +25,9 @@ fun explode_thm thm = (case HOLogic.dest_Trueprop (Thm.prop_of thm) of - \<^const>\HOL.conj\ $ _ $ _ => explode_conj_thm @{thm conjunct1} @{thm conjunct2} thm - | \<^const>\HOL.Not\ $ (\<^const>\HOL.disj\ $ _ $ _) => explode_conj_thm ndisj1_rule ndisj2_rule thm - | \<^const>\HOL.Not\ $ (\<^const>\HOL.Not\ $ _) => explode_thm (thm RS @{thm notnotD}) + \<^Const_>\conj for _ _\ => explode_conj_thm @{thm conjunct1} @{thm conjunct2} thm + | \<^Const_>\Not for \<^Const_>\disj for _ _\\ => explode_conj_thm ndisj1_rule ndisj2_rule thm + | \<^Const_>\Not for \<^Const_>\Not for _\\ => explode_thm (thm RS @{thm notnotD}) | _ => add_lit thm) and explode_conj_thm rule1 rule2 thm lits = @@ -36,7 +36,7 @@ val not_false_rule = @{lemma "\False" by auto} fun explode thm = explode_thm thm (add_lit not_false_rule (add_lit @{thm TrueI} Termtab.empty)) -fun find_dual_lit lits (\<^const>\HOL.Not\ $ t, thm) = Termtab.lookup lits t |> Option.map (pair thm) +fun find_dual_lit lits (\<^Const_>\Not for t\, thm) = Termtab.lookup lits t |> Option.map (pair thm) | find_dual_lit _ _ = NONE fun find_dual_lits lits = Termtab.get_first (find_dual_lit lits) lits @@ -49,10 +49,10 @@ SOME thm => thm | NONE => join_term lits t) -and join_term lits (\<^const>\HOL.conj\ $ t $ u) = @{thm conjI} OF (map (join lits) [t, u]) - | join_term lits (\<^const>\HOL.Not\ $ (\<^const>\HOL.disj\ $ t $ u)) = +and join_term lits \<^Const_>\conj for t u\ = @{thm conjI} OF (map (join lits) [t, u]) + | join_term lits \<^Const_>\Not for \<^Const_>\HOL.disj for t u\\ = ndisj_rule OF (map (join lits o HOLogic.mk_not) [t, u]) - | join_term lits (\<^const>\HOL.Not\ $ (\<^const>\HOL.Not\ $ t)) = join lits t RS not_not_rule + | join_term lits \<^Const_>\Not for \<^Const>\Not for t\\ = join lits t RS not_not_rule | join_term _ t = raise TERM ("join_term", [t]) fun prove_conj_disj_imp ct cu = with_assumption ct (fn thm => join (explode thm) (Thm.term_of cu)) @@ -68,19 +68,19 @@ fun prove_any_imp ct = (case Thm.term_of ct of - \<^const>\HOL.False\ => @{thm FalseE} - | \<^const>\HOL.Not\ $ (\<^const>\HOL.Not\ $ \<^const>\HOL.False\) => not_not_false_rule - | \<^const>\HOL.Not\ $ \<^const>\HOL.True\ => not_true_rule + \<^Const_>\False\ => @{thm FalseE} + | \<^Const_>\Not for \<^Const>\Not for \<^Const>\False\\\ => not_not_false_rule + | \<^Const_>\Not for \<^Const>\True\\ => not_true_rule | _ => raise CTERM ("prove_any_imp", [ct])) fun prove_contradiction_imp ct = with_assumption ct (fn thm => let val lits = explode thm in - (case Termtab.lookup lits \<^const>\HOL.False\ of + (case Termtab.lookup lits \<^Const>\False\ of SOME thm' => thm' RS @{thm FalseE} | NONE => - (case Termtab.lookup lits (\<^const>\HOL.Not\ $ \<^const>\HOL.True\) of + (case Termtab.lookup lits \<^Const>\Not for \<^Const>\True\\ of SOME thm' => thm' RS not_true_rule | NONE => (case find_dual_lits lits of @@ -99,13 +99,13 @@ datatype kind = True | False | Conj | Disj | Other -fun choose t _ _ _ \<^const>\HOL.True\ = t - | choose _ f _ _ \<^const>\HOL.False\ = f - | choose _ _ c _ (\<^const>\HOL.conj\ $ _ $ _) = c - | choose _ _ _ d (\<^const>\HOL.disj\ $ _ $ _) = d +fun choose t _ _ _ \<^Const_>\True\ = t + | choose _ f _ _ \<^Const_>\False\ = f + | choose _ _ c _ \<^Const_>\conj for _ _\ = c + | choose _ _ _ d \<^Const_>\disj for _ _\ = d | choose _ _ _ _ _ = Other -fun kind_of (\<^const>\HOL.Not\ $ t) = choose False True Disj Conj t +fun kind_of \<^Const_>\Not for t\ = choose False True Disj Conj t | kind_of t = choose True False Conj Disj t fun prove_conj_disj_perm ct cp = @@ -120,7 +120,7 @@ fun conj_disj_perm_tac ctxt = CSUBGOAL (fn (ct, i) => (case Thm.term_of ct of - \<^const>\HOL.Trueprop\ $ (@{const HOL.eq(bool)} $ _ $ _) => + \<^Const_>\Trueprop for \<^Const>\HOL.eq \<^Type>\bool\ for _ _\\ => resolve_tac ctxt [prove_conj_disj_perm ct (Thm.dest_binop (Thm.dest_arg ct))] i | _ => no_tac)) diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/SMT/smt_normalize.ML --- a/src/HOL/Tools/SMT/smt_normalize.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/SMT/smt_normalize.ML Tue Sep 28 22:45:52 2021 +0200 @@ -31,7 +31,7 @@ (** instantiate elimination rules **) local - val (cpfalse, cfalse) = `SMT_Util.mk_cprop (Thm.cterm_of \<^context> \<^const>\False\) + val (cpfalse, cfalse) = `SMT_Util.mk_cprop \<^cterm>\False\ fun inst f ct thm = let val cv = f (Drule.strip_imp_concl (Thm.cprop_of thm)) @@ -40,7 +40,7 @@ fun instantiate_elim thm = (case Thm.concl_of thm of - \<^const>\Trueprop\ $ Var (_, \<^typ>\bool\) => inst Thm.dest_arg cfalse thm + \<^Const_>\Trueprop for \Var (_, \<^Type>\bool\)\\ => inst Thm.dest_arg cfalse thm | Var _ => inst I cpfalse thm | _ => thm) @@ -51,9 +51,8 @@ fun norm_def thm = (case Thm.prop_of thm of - \<^const>\Trueprop\ $ (Const (\<^const_name>\HOL.eq\, _) $ _ $ Abs _) => - norm_def (thm RS @{thm fun_cong}) - | Const (\<^const_name>\Pure.eq\, _) $ _ $ Abs _ => norm_def (HOLogic.mk_obj_eq thm) + \<^Const_>\Trueprop for \<^Const>\HOL.eq _ for _ \Abs _\\\ => norm_def (thm RS @{thm fun_cong}) + | \<^Const_>\Pure.eq _ for _ \Abs _\\ => norm_def (HOLogic.mk_obj_eq thm) | _ => thm) @@ -61,11 +60,11 @@ fun atomize_conv ctxt ct = (case Thm.term_of ct of - \<^const>\Pure.imp\ $ _ $ _ => + \<^Const_>\Pure.imp for _ _\ => Conv.binop_conv (atomize_conv ctxt) then_conv Conv.rewr_conv @{thm atomize_imp} - | Const (\<^const_name>\Pure.eq\, _) $ _ $ _ => + | \<^Const_>\Pure.eq _ for _ _\ => Conv.binop_conv (atomize_conv ctxt) then_conv Conv.rewr_conv @{thm atomize_eq} - | Const (\<^const_name>\Pure.all\, _) $ Abs _ => + | \<^Const_>\Pure.all _ for \Abs _\\ => Conv.binder_conv (atomize_conv o snd) ctxt then_conv Conv.rewr_conv @{thm atomize_all} | _ => Conv.all_conv) ct handle CTERM _ => Conv.all_conv ct @@ -120,9 +119,9 @@ fun proper_quant inside f t = (case t of - Const (\<^const_name>\All\, _) $ Abs (_, _, u) => proper_quant true f u - | Const (\<^const_name>\Ex\, _) $ Abs (_, _, u) => proper_quant true f u - | \<^const>\trigger\ $ p $ u => + \<^Const_>\All _ for \Abs (_, _, u)\\ => proper_quant true f u + | \<^Const_>\Ex _ for \Abs (_, _, u)\\ => proper_quant true f u + | \<^Const_>\trigger for p u\ => (if inside then f p else false) andalso proper_quant false f u | Abs (_, _, u) => proper_quant false f u | u1 $ u2 => proper_quant false f u1 andalso proper_quant false f u2 @@ -142,7 +141,7 @@ fun dest_cond_eq ct = (case Thm.term_of ct of Const (\<^const_name>\HOL.eq\, _) $ _ $ _ => Thm.dest_binop ct - | \<^const>\HOL.implies\ $ _ $ _ => dest_cond_eq (Thm.dest_arg ct) + | \<^Const_>\implies for _ _\ => dest_cond_eq (Thm.dest_arg ct) | _ => raise CTERM ("no equation", [ct])) fun get_constrs thy (Type (n, _)) = these (BNF_LFP_Compat.get_constrs thy n) @@ -220,7 +219,7 @@ in insert_trigger_conv (filter_mpats (get_mpats lhs)) ct end - fun has_trigger (\<^const>\trigger\ $ _ $ _) = true + fun has_trigger \<^Const_>\trigger for _ _\ = true | has_trigger _ = false fun try_trigger_conv cv ct = @@ -331,12 +330,12 @@ local val simple_nat_ops = [ - @{const HOL.eq (nat)}, @{const less (nat)}, @{const less_eq (nat)}, - \<^const>\Suc\, @{const plus (nat)}, @{const minus (nat)}] + \<^Const>\HOL.eq \<^Type>\nat\\, \<^Const>\less \<^Type>\nat\\, \<^Const>\less_eq \<^Type>\nat\\, + \<^Const>\Suc\, \<^Const>\plus \<^Type>\nat\\, \<^Const>\minus \<^Type>\nat\\] val nat_consts = simple_nat_ops @ - [@{const numeral (nat)}, @{const zero_class.zero (nat)}, @{const one_class.one (nat)}] @ - [@{const times (nat)}, @{const divide (nat)}, @{const modulo (nat)}] + [\<^Const>\numeral \<^Type>\nat\\, \<^Const>\zero_class.zero \<^Type>\nat\\, \<^Const>\one_class.one \<^Type>\nat\\] @ + [\<^Const>\times \<^Type>\nat\\, \<^Const>\divide \<^Type>\nat\\, \<^Const>\modulo \<^Type>\nat\\] val is_nat_const = member (op aconv) nat_consts @@ -349,10 +348,10 @@ fun int_ops_conv cv ctxt ct = (case Thm.term_of ct of - @{const of_nat (int)} $ (Const (\<^const_name>\If\, _) $ _ $ _ $ _) => + \<^Const_>\of_nat \<^Type>\int\ for \\<^Const_>\If _ for _ _ _\\\ => Conv.rewr_conv int_if_thm then_conv if_conv (cv ctxt) (int_ops_conv cv ctxt) - | @{const of_nat (int)} $ _ => + | \<^Const>\of_nat \<^Type>\int\ for _\ => (Conv.rewrs_conv int_ops_thms then_conv Conv.top_sweep_conv (int_ops_conv cv) ctxt) else_conv Conv.arg_conv (Conv.sub_conv cv ctxt) @@ -372,7 +371,7 @@ fun add_int_of_nat vs ct cu (q, cts) = (case Thm.term_of ct of - @{const of_nat(int)} => + \<^Const>\of_nat \<^Type>\int\\ => if Term.exists_subterm (member (op aconv) vs) (Thm.term_of cu) then (true, cts) else (q, insert (op aconvc) cu cts) | _ => (q, cts)) @@ -490,7 +489,7 @@ val schematic_consts_of = let - fun collect (\<^const>\trigger\ $ p $ t) = collect_trigger p #> collect t + fun collect \<^Const_>\trigger for p t\ = collect_trigger p #> collect t | collect (t $ u) = collect t #> collect u | collect (Abs (_, _, t)) = collect t | collect (t as Const (n, _)) = diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/SMT/smt_real.ML --- a/src/HOL/Tools/SMT/smt_real.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/SMT/smt_real.ML Tue Sep 28 22:45:52 2021 +0200 @@ -25,7 +25,7 @@ | is_linear [t, u] = SMT_Util.is_number t orelse SMT_Util.is_number u | is_linear _ = false - fun mk_times ts = Term.list_comb (@{const times (real)}, ts) + fun mk_times ts = Term.list_comb (\<^Const>\times \<^Type>\real\\, ts) fun times _ _ ts = if is_linear ts then SOME ("*", 2, ts, mk_times) else NONE in @@ -34,17 +34,17 @@ SMT_Builtin.add_builtin_typ SMTLIB_Interface.smtlibC (\<^typ>\real\, K (SOME ("Real", [])), real_num) #> fold (SMT_Builtin.add_builtin_fun' SMTLIB_Interface.smtlibC) [ - (@{const less (real)}, "<"), - (@{const less_eq (real)}, "<="), - (@{const uminus (real)}, "-"), - (@{const plus (real)}, "+"), - (@{const minus (real)}, "-") ] #> + (\<^Const>\less \<^Type>\real\\, "<"), + (\<^Const>\less_eq \<^Type>\real\\, "<="), + (\<^Const>\uminus \<^Type>\real\\, "-"), + (\<^Const>\plus \<^Type>\real\\, "+"), + (\<^Const>\minus \<^Type>\real\\, "-") ] #> SMT_Builtin.add_builtin_fun SMTLIB_Interface.smtlibC - (Term.dest_Const @{const times (real)}, times) #> + (Term.dest_Const \<^Const>\times \<^Type>\real\\, times) #> SMT_Builtin.add_builtin_fun' Z3_Interface.smtlib_z3C - (@{const times (real)}, "*") #> + (\<^Const>\times \<^Type>\real\\, "*") #> SMT_Builtin.add_builtin_fun' Z3_Interface.smtlib_z3C - (@{const divide (real)}, "/") + (\<^Const>\divide \<^Type>\real\\, "/") end @@ -64,14 +64,14 @@ fun mk_nary _ cu [] = cu | mk_nary ct _ cts = uncurry (fold_rev (Thm.mk_binop ct)) (split_last cts) - val mk_uminus = Thm.apply (Thm.cterm_of \<^context> @{const uminus (real)}) - val add = Thm.cterm_of \<^context> @{const plus (real)} + val mk_uminus = Thm.apply \<^cterm>\uminus :: real \ _\ + val add = \<^cterm>\(+) :: real \ _\ val real0 = Numeral.mk_cnumber \<^ctyp>\real\ 0 - val mk_sub = Thm.mk_binop (Thm.cterm_of \<^context> @{const minus (real)}) - val mk_mul = Thm.mk_binop (Thm.cterm_of \<^context> @{const times (real)}) - val mk_div = Thm.mk_binop (Thm.cterm_of \<^context> @{const divide (real)}) - val mk_lt = Thm.mk_binop (Thm.cterm_of \<^context> @{const less (real)}) - val mk_le = Thm.mk_binop (Thm.cterm_of \<^context> @{const less_eq (real)}) + val mk_sub = Thm.mk_binop \<^cterm>\(-) :: real \ _\ + val mk_mul = Thm.mk_binop \<^cterm>\(*) :: real \ _\ + val mk_div = Thm.mk_binop \<^cterm>\(/) :: real \ _\ + val mk_lt = Thm.mk_binop \<^cterm>\(<) :: real \ _\ + val mk_le = Thm.mk_binop \<^cterm>\(\) :: real \ _\ fun z3_mk_builtin_fun (Z3_Interface.Sym ("-", _)) [ct] = SOME (mk_uminus ct) | z3_mk_builtin_fun (Z3_Interface.Sym ("+", _)) cts = SOME (mk_nary add real0 cts) diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/SMT/smt_replay_methods.ML --- a/src/HOL/Tools/SMT/smt_replay_methods.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/SMT/smt_replay_methods.ML Tue Sep 28 22:45:52 2021 +0200 @@ -218,30 +218,30 @@ fun abstract_ter abs f t t1 t2 t3 = abstract_sub t (abs t1 ##>> abs t2 ##>> abs t3 #>> (Scan.triple1 #> f)) -fun abstract_lit (\<^const>\HOL.Not\ $ t) = abstract_term t #>> HOLogic.mk_not +fun abstract_lit \<^Const>\Not for t\ = abstract_term t #>> HOLogic.mk_not | abstract_lit t = abstract_term t -fun abstract_not abs (t as \<^const>\HOL.Not\ $ t1) = +fun abstract_not abs (t as \<^Const_>\Not\ $ t1) = abstract_sub t (abs t1 #>> HOLogic.mk_not) | abstract_not _ t = abstract_lit t -fun abstract_conj (t as \<^const>\HOL.conj\ $ t1 $ t2) = +fun abstract_conj (t as \<^Const_>\conj\ $ t1 $ t2) = abstract_bin abstract_conj HOLogic.mk_conj t t1 t2 | abstract_conj t = abstract_lit t -fun abstract_disj (t as \<^const>\HOL.disj\ $ t1 $ t2) = +fun abstract_disj (t as \<^Const_>\disj\ $ t1 $ t2) = abstract_bin abstract_disj HOLogic.mk_disj t t1 t2 | abstract_disj t = abstract_lit t -fun abstract_prop (t as (c as @{const If (bool)}) $ t1 $ t2 $ t3) = +fun abstract_prop (t as (c as \<^Const>\If \<^Type>\bool\\) $ t1 $ t2 $ t3) = abstract_ter abstract_prop (fn (t1, t2, t3) => c $ t1 $ t2 $ t3) t t1 t2 t3 - | abstract_prop (t as \<^const>\HOL.disj\ $ t1 $ t2) = + | abstract_prop (t as \<^Const_>\disj\ $ t1 $ t2) = abstract_bin abstract_prop HOLogic.mk_disj t t1 t2 - | abstract_prop (t as \<^const>\HOL.conj\ $ t1 $ t2) = + | abstract_prop (t as \<^Const_>\conj\ $ t1 $ t2) = abstract_bin abstract_prop HOLogic.mk_conj t t1 t2 - | abstract_prop (t as \<^const>\HOL.implies\ $ t1 $ t2) = + | abstract_prop (t as \<^Const_>\implies\ $ t1 $ t2) = abstract_bin abstract_prop HOLogic.mk_imp t t1 t2 - | abstract_prop (t as \<^term>\HOL.eq :: bool => _\ $ t1 $ t2) = + | abstract_prop (t as \<^Const_>\HOL.eq \<^Type>\bool\\ $ t1 $ t2) = abstract_bin abstract_prop HOLogic.mk_eq t t1 t2 | abstract_prop t = abstract_not abstract_prop t @@ -253,8 +253,8 @@ abstract_sub t (abs t' #>> (fn u' => c $ Abs (s, T, u'))) | abs (t as (c as Const (\<^const_name>\If\, _)) $ t1 $ t2 $ t3) = abstract_ter abs (fn (t1, t2, t3) => c $ t1 $ t2 $ t3) t t1 t2 t3 - | abs (t as \<^const>\HOL.Not\ $ t1) = abstract_sub t (abs t1 #>> HOLogic.mk_not) - | abs (t as \<^const>\HOL.disj\ $ t1 $ t2) = + | abs (t as \<^Const_>\Not\ $ t1) = abstract_sub t (abs t1 #>> HOLogic.mk_not) + | abs (t as \<^Const_>\disj\ $ t1 $ t2) = abstract_sub t (abs t1 ##>> abs t2 #>> HOLogic.mk_disj) | abs (t as (c as Const (\<^const_name>\uminus_class.uminus\, _)) $ t1) = abstract_sub t (abs t1 #>> (fn u => c $ u)) @@ -282,10 +282,10 @@ | (NONE, _) => abstract_term t cx)) in abs u end -fun abstract_unit (t as (\<^const>\HOL.Not\ $ (\<^const>\HOL.disj\ $ t1 $ t2))) = +fun abstract_unit (t as \<^Const_>\Not for \<^Const_>\disj for t1 t2\\) = abstract_sub t (abstract_unit t1 ##>> abstract_unit t2 #>> HOLogic.mk_not o HOLogic.mk_disj) - | abstract_unit (t as (\<^const>\HOL.disj\ $ t1 $ t2)) = + | abstract_unit (t as \<^Const_>\disj for t1 t2\) = abstract_sub t (abstract_unit t1 ##>> abstract_unit t2 #>> HOLogic.mk_disj) | abstract_unit (t as (Const(\<^const_name>\HOL.eq\, _) $ t1 $ t2)) = @@ -293,49 +293,49 @@ abstract_sub t (abstract_unit t1 ##>> abstract_unit t2 #>> HOLogic.mk_eq) else abstract_lit t - | abstract_unit (t as (\<^const>\HOL.Not\ $ (Const(\<^const_name>\HOL.eq\, _) $ t1 $ t2))) = + | abstract_unit (t as \<^Const_>\Not for \<^Const_>\HOL.eq _ for t1 t2\\) = if fastype_of t1 = \<^typ>\bool\ then abstract_sub t (abstract_unit t1 ##>> abstract_unit t2 #>> HOLogic.mk_eq #>> HOLogic.mk_not) else abstract_lit t - | abstract_unit (t as (\<^const>\HOL.Not\ $ t1)) = + | abstract_unit (t as \<^Const>\Not for t1\) = abstract_sub t (abstract_unit t1 #>> HOLogic.mk_not) | abstract_unit t = abstract_lit t -fun abstract_bool (t as (@{const HOL.disj} $ t1 $ t2)) = +fun abstract_bool (t as \<^Const_>\disj for t1 t2\) = abstract_sub t (abstract_bool t1 ##>> abstract_bool t2 #>> HOLogic.mk_disj) - | abstract_bool (t as (@{const HOL.conj} $ t1 $ t2)) = + | abstract_bool (t as \<^Const_>\conj for t1 t2\) = abstract_sub t (abstract_bool t1 ##>> abstract_bool t2 #>> HOLogic.mk_conj) - | abstract_bool (t as (Const(@{const_name HOL.eq}, _) $ t1 $ t2)) = + | abstract_bool (t as \<^Const_>\HOL.eq _ for t1 t2\) = if fastype_of t1 = @{typ bool} then abstract_sub t (abstract_bool t1 ##>> abstract_bool t2 #>> HOLogic.mk_eq) else abstract_lit t - | abstract_bool (t as (@{const HOL.Not} $ t1)) = + | abstract_bool (t as \<^Const_>\Not for t1\) = abstract_sub t (abstract_bool t1 #>> HOLogic.mk_not) - | abstract_bool (t as (@{const HOL.implies} $ t1 $ t2)) = + | abstract_bool (t as \<^Const>\implies for t1 t2\) = abstract_sub t (abstract_bool t1 ##>> abstract_bool t2 #>> HOLogic.mk_imp) | abstract_bool t = abstract_lit t -fun abstract_bool_shallow (t as (@{const HOL.disj} $ t1 $ t2)) = +fun abstract_bool_shallow (t as \<^Const_>\disj for t1 t2\) = abstract_sub t (abstract_bool_shallow t1 ##>> abstract_bool_shallow t2 #>> HOLogic.mk_disj) - | abstract_bool_shallow (t as (@{const HOL.Not} $ t1)) = + | abstract_bool_shallow (t as \<^Const_>\Not for t1\) = abstract_sub t (abstract_bool_shallow t1 #>> HOLogic.mk_not) | abstract_bool_shallow t = abstract_term t -fun abstract_bool_shallow_equivalence (t as (@{const HOL.disj} $ t1 $ t2)) = +fun abstract_bool_shallow_equivalence (t as \<^Const_>\disj for t1 t2\) = abstract_sub t (abstract_bool_shallow_equivalence t1 ##>> abstract_bool_shallow_equivalence t2 #>> HOLogic.mk_disj) - | abstract_bool_shallow_equivalence (t as (Const(@{const_name HOL.eq}, _) $ t1 $ t2)) = - if fastype_of t1 = @{typ bool} then + | abstract_bool_shallow_equivalence (t as \<^Const_>\HOL.eq _ for t1 t2\) = + if fastype_of t1 = \<^Type>\bool\ then abstract_sub t (abstract_lit t1 ##>> abstract_lit t2 #>> HOLogic.mk_eq) else abstract_lit t - | abstract_bool_shallow_equivalence (t as (@{const HOL.Not} $ t1)) = + | abstract_bool_shallow_equivalence (t as \<^Const_>\Not for t1\) = abstract_sub t (abstract_bool_shallow_equivalence t1 #>> HOLogic.mk_not) | abstract_bool_shallow_equivalence t = abstract_lit t @@ -347,8 +347,8 @@ abstract_sub t (abs t' #>> (fn u' => c $ Abs (s, T, u'))) | abs (t as (Const (\<^const_name>\If\, _)) $ _ $ _ $ _) = abstract_sub t (abstract_term t) - | abs (t as \<^const>\HOL.Not\ $ t1) = abstract_sub t (abs t1 #>> HOLogic.mk_not) - | abs (t as \<^const>\HOL.disj\ $ t1 $ t2) = + | abs (t as \<^Const>\Not\ $ t1) = abstract_sub t (abs t1 #>> HOLogic.mk_not) + | abs (t as \<^Const>\disj\ $ t1 $ t2) = abstract_sub t (abs t1 ##>> abs t2 #>> HOLogic.mk_disj) | abs (t as (c as Const (\<^const_name>\uminus_class.uminus\, _)) $ t1) = abstract_sub t (abs t1 #>> (fn u => c $ u)) diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/SMT/smt_translate.ML --- a/src/HOL/Tools/SMT/smt_translate.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/SMT/smt_translate.ML Tue Sep 28 22:45:52 2021 +0200 @@ -306,12 +306,12 @@ | (u as Bound i, ts) => apply 0 u (nth Ts i) (map (traverse Ts) ts) | (Abs (n, T, u), ts) => traverses Ts (Abs (n, T, traverse (T::Ts) u)) ts | (u, ts) => traverses Ts u ts) - and in_trigger Ts ((c as \<^const>\trigger\) $ p $ t) = c $ in_pats Ts p $ traverse Ts t + and in_trigger Ts ((c as \<^Const_>\trigger\) $ p $ t) = c $ in_pats Ts p $ traverse Ts t | in_trigger Ts t = traverse Ts t and in_pats Ts ps = in_list \<^typ>\pattern symb_list\ (in_list \<^typ>\pattern\ (in_pat Ts)) ps - and in_pat Ts ((p as Const (\<^const_name>\pat\, _)) $ t) = p $ traverse Ts t - | in_pat Ts ((p as Const (\<^const_name>\nopat\, _)) $ t) = p $ traverse Ts t + and in_pat Ts ((p as \<^Const_>\pat _\) $ t) = p $ traverse Ts t + | in_pat Ts ((p as \<^Const_>\nopat _\) $ t) = p $ traverse Ts t | in_pat _ t = raise TERM ("bad pattern", [t]) and traverses Ts t ts = Term.list_comb (t, map (traverse Ts) ts) in map (traverse []) ts end @@ -343,9 +343,9 @@ fun in_term pat t = (case Term.strip_comb t of - (\<^const>\True\, []) => t - | (\<^const>\False\, []) => t - | (u as Const (\<^const_name>\If\, _), [t1, t2, t3]) => + (\<^Const_>\True\, []) => t + | (\<^Const_>\False\, []) => t + | (u as \<^Const_>\If _\, [t1, t2, t3]) => if pat then raise BAD_PATTERN () else u $ in_form t1 $ in_term pat t2 $ in_term pat t3 | (Const (c as (n, _)), ts) => if is_builtin_conn_or_pred ctxt c ts orelse is_quant n then @@ -364,7 +364,7 @@ and in_pats ps = in_list \<^typ>\pattern symb_list\ (SOME o in_list \<^typ>\pattern\ (try in_pat)) ps - and in_trigger ((c as \<^const>\trigger\) $ p $ t) = c $ in_pats p $ in_form t + and in_trigger ((c as \<^Const_>\trigger\) $ p $ t) = c $ in_pats p $ in_form t | in_trigger t = in_form t and in_form t = @@ -412,7 +412,7 @@ | (ps, [false]) => cons (SNoPat ps) | _ => raise TERM ("bad multi-pattern", ts)) -fun dest_trigger (\<^const>\trigger\ $ tl $ t) = +fun dest_trigger \<^Const_>\trigger for tl t\ = (rev (fold (dest_pats o SMT_Util.dest_symb_list) (SMT_Util.dest_symb_list tl) []), t) | dest_trigger t = ([], t) @@ -511,7 +511,7 @@ |> (fn T => Const (\<^const_name>\pat\, T) $ lhs) |> SMT_Util.mk_symb_list \<^typ>\pattern\ o single |> SMT_Util.mk_symb_list \<^typ>\pattern symb_list\ o single - |> (fn t => \<^const>\trigger\ $ t $ eq) + |> (fn t => \<^Const>\trigger for t eq\) | mk_trigger t = t val (ctxt2, (ts3, ll_defs)) = diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/SMT/smt_util.ML --- a/src/HOL/Tools/SMT/smt_util.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/SMT/smt_util.ML Tue Sep 28 22:45:52 2021 +0200 @@ -131,16 +131,16 @@ (* terms *) -fun dest_conj (\<^const>\HOL.conj\ $ t $ u) = (t, u) +fun dest_conj \<^Const_>\conj for t u\ = (t, u) | dest_conj t = raise TERM ("not a conjunction", [t]) -fun dest_disj (\<^const>\HOL.disj\ $ t $ u) = (t, u) +fun dest_disj \<^Const_>\disj for t u\ = (t, u) | dest_disj t = raise TERM ("not a disjunction", [t]) fun under_quant f t = (case t of - Const (\<^const_name>\All\, _) $ Abs (_, _, u) => under_quant f u - | Const (\<^const_name>\Ex\, _) $ Abs (_, _, u) => under_quant f u + \<^Const_>\All _ for \Abs (_, _, u)\\ => under_quant f u + | \<^Const_>\Ex _ for \Abs (_, _, u)\\ => under_quant f u | _ => f t) val is_number = @@ -197,17 +197,17 @@ val dest_all_cbinders = repeat_yield (try o dest_cbinder) -val mk_cprop = Thm.apply (Thm.cterm_of \<^context> \<^const>\Trueprop\) +val mk_cprop = Thm.apply \<^cterm>\Trueprop\ fun dest_cprop ct = (case Thm.term_of ct of - \<^const>\Trueprop\ $ _ => Thm.dest_arg ct + \<^Const_>\Trueprop for _\ => Thm.dest_arg ct | _ => raise CTERM ("not a property", [ct])) val equals = mk_const_pat \<^theory> \<^const_name>\Pure.eq\ Thm.dest_ctyp0 fun mk_cequals ct cu = Thm.mk_binop (instT' ct equals) ct cu -val dest_prop = (fn \<^const>\Trueprop\ $ t => t | t => t) +val dest_prop = fn \<^Const_>\Trueprop for t\ => t | t => t fun term_of ct = dest_prop (Thm.term_of ct) fun prop_of thm = dest_prop (Thm.prop_of thm) @@ -237,7 +237,7 @@ fun prop_conv cv ct = (case Thm.term_of ct of - \<^const>\Trueprop\ $ _ => Conv.arg_conv cv ct + \<^Const_>\Trueprop for _\ => Conv.arg_conv cv ct | _ => raise CTERM ("not a property", [ct])) end; diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/SMT/smtlib_interface.ML --- a/src/HOL/Tools/SMT/smtlib_interface.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/SMT/smtlib_interface.ML Tue Sep 28 22:45:52 2021 +0200 @@ -35,7 +35,7 @@ | is_linear _ = false fun times _ _ ts = - let val mk = Term.list_comb o pair @{const times (int)} + let val mk = Term.list_comb o pair \<^Const>\times \<^Type>\int\\ in if is_linear ts then SOME ("*", 2, ts, mk) else NONE end in @@ -46,21 +46,21 @@ (\<^typ>\bool\, K (SOME ("Bool", [])), K (K NONE)), (\<^typ>\int\, K (SOME ("Int", [])), int_num)] #> fold (SMT_Builtin.add_builtin_fun' smtlibC) [ - (\<^const>\True\, "true"), - (\<^const>\False\, "false"), - (\<^const>\Not\, "not"), - (\<^const>\HOL.conj\, "and"), - (\<^const>\HOL.disj\, "or"), - (\<^const>\HOL.implies\, "=>"), - (@{const HOL.eq ('a)}, "="), - (@{const If ('a)}, "ite"), - (@{const less (int)}, "<"), - (@{const less_eq (int)}, "<="), - (@{const uminus (int)}, "-"), - (@{const plus (int)}, "+"), - (@{const minus (int)}, "-")] #> + (\<^Const>\True\, "true"), + (\<^Const>\False\, "false"), + (\<^Const>\Not\, "not"), + (\<^Const>\conj\, "and"), + (\<^Const>\disj\, "or"), + (\<^Const>\implies\, "=>"), + (\<^Const>\HOL.eq \<^typ>\'a\\, "="), + (\<^Const>\If \<^typ>\'a\\, "ite"), + (\<^Const>\less \<^Type>\int\\, "<"), + (\<^Const>\less_eq \<^Type>\int\\, "<="), + (\<^Const>\uminus \<^Type>\int\\, "-"), + (\<^Const>\plus \<^Type>\int\\, "+"), + (\<^Const>\minus \<^Type>\int\\, "-")] #> SMT_Builtin.add_builtin_fun smtlibC - (Term.dest_Const @{const times (int)}, times) + (Term.dest_Const \<^Const>\times \<^Type>\int\\, times) end diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/SMT/smtlib_proof.ML --- a/src/HOL/Tools/SMT/smtlib_proof.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/SMT/smtlib_proof.ML Tue Sep 28 22:45:52 2021 +0200 @@ -150,8 +150,8 @@ fun mk_less t1 t2 = mk_binary_pred \<^const_name>\ord_class.less\ \<^sort>\linorder\ t1 t2 fun mk_less_eq t1 t2 = mk_binary_pred \<^const_name>\ord_class.less_eq\ \<^sort>\linorder\ t1 t2 -fun core_term_parser (SMTLIB.Sym "true", _) = SOME \<^const>\HOL.True\ - | core_term_parser (SMTLIB.Sym "false", _) = SOME \<^const>\HOL.False\ +fun core_term_parser (SMTLIB.Sym "true", _) = SOME \<^Const>\True\ + | core_term_parser (SMTLIB.Sym "false", _) = SOME \<^Const>\False\ | core_term_parser (SMTLIB.Sym "not", [t]) = SOME (HOLogic.mk_not t) | core_term_parser (SMTLIB.Sym "and", t :: ts) = SOME (mk_rassoc (curry HOLogic.mk_conj) t ts) | core_term_parser (SMTLIB.Sym "or", t :: ts) = SOME (mk_rassoc (curry HOLogic.mk_disj) t ts) diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/SMT/verit_proof.ML --- a/src/HOL/Tools/SMT/verit_proof.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/SMT/verit_proof.ML Tue Sep 28 22:45:52 2021 +0200 @@ -738,7 +738,7 @@ fun remove_assumption_id assumption_id prems = filter_out (curry (op =) assumption_id) prems fun add_assumption assumption concl = - \<^const>\Pure.imp\ $ mk_prop_of_term assumption $ mk_prop_of_term concl + \<^Const>\Pure.imp for \mk_prop_of_term assumption\ \mk_prop_of_term concl\\ fun inline_assumption assumption assumption_id (VeriT_Node {id, rule, prems, proof_ctxt, concl}) = mk_node id rule (remove_assumption_id assumption_id prems) proof_ctxt diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/SMT/z3_interface.ML --- a/src/HOL/Tools/SMT/z3_interface.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/SMT/z3_interface.ML Tue Sep 28 22:45:52 2021 +0200 @@ -38,8 +38,8 @@ fp_kinds = [BNF_Util.Least_FP], serialize = #serialize (SMTLIB_Interface.translate_config SMT_Util.First_Order ctxt)} - fun is_div_mod @{const divide (int)} = true - | is_div_mod @{const modulo (int)} = true + fun is_div_mod \<^Const_>\divide \<^Type>\int\\ = true + | is_div_mod \<^Const>\modulo \<^Type>\int\\ = true | is_div_mod _ = false val have_int_div_mod = exists (Term.exists_subterm is_div_mod o Thm.prop_of) @@ -50,9 +50,9 @@ else (thms, extra_thms) val setup_builtins = - SMT_Builtin.add_builtin_fun' smtlib_z3C (@{const times (int)}, "*") #> - SMT_Builtin.add_builtin_fun' smtlib_z3C (\<^const>\z3div\, "div") #> - SMT_Builtin.add_builtin_fun' smtlib_z3C (\<^const>\z3mod\, "mod") + SMT_Builtin.add_builtin_fun' smtlib_z3C (\<^Const>\times \<^Type>\int\\, "*") #> + SMT_Builtin.add_builtin_fun' smtlib_z3C (\<^Const>\z3div\, "div") #> + SMT_Builtin.add_builtin_fun' smtlib_z3C (\<^Const>\z3mod\, "mod") in val _ = Theory.setup (Context.theory_map ( @@ -116,13 +116,13 @@ | mk_builtin_num ctxt i T = chained_mk_builtin_num ctxt (get_mk_builtins ctxt) i T -val mk_true = Thm.cterm_of \<^context> (\<^const>\Not\ $ \<^const>\False\) -val mk_false = Thm.cterm_of \<^context> \<^const>\False\ -val mk_not = Thm.apply (Thm.cterm_of \<^context> \<^const>\Not\) -val mk_implies = Thm.mk_binop (Thm.cterm_of \<^context> \<^const>\HOL.implies\) -val mk_iff = Thm.mk_binop (Thm.cterm_of \<^context> @{const HOL.eq (bool)}) -val conj = Thm.cterm_of \<^context> \<^const>\HOL.conj\ -val disj = Thm.cterm_of \<^context> \<^const>\HOL.disj\ +val mk_true = \<^cterm>\\ False\ +val mk_false = \<^cterm>\False\ +val mk_not = Thm.apply \<^cterm>\HOL.Not\ +val mk_implies = Thm.mk_binop \<^cterm>\HOL.implies\ +val mk_iff = Thm.mk_binop \<^cterm>\(=) :: bool \ _\ +val conj = \<^cterm>\HOL.conj\ +val disj = \<^cterm>\HOL.disj\ fun mk_nary _ cu [] = cu | mk_nary ct _ cts = uncurry (fold_rev (Thm.mk_binop ct)) (split_last cts) @@ -143,15 +143,15 @@ let val cTs = Thm.dest_ctyp (Thm.ctyp_of_cterm array) in Thm.apply (Thm.mk_binop (SMT_Util.instTs cTs update) array index) value end -val mk_uminus = Thm.apply (Thm.cterm_of \<^context> @{const uminus (int)}) -val add = Thm.cterm_of \<^context> @{const plus (int)} +val mk_uminus = Thm.apply \<^cterm>\uminus :: int \ _\ +val add = \<^cterm>\(+) :: int \ _\ val int0 = Numeral.mk_cnumber \<^ctyp>\int\ 0 -val mk_sub = Thm.mk_binop (Thm.cterm_of \<^context> @{const minus (int)}) -val mk_mul = Thm.mk_binop (Thm.cterm_of \<^context> @{const times (int)}) -val mk_div = Thm.mk_binop (Thm.cterm_of \<^context> \<^const>\z3div\) -val mk_mod = Thm.mk_binop (Thm.cterm_of \<^context> \<^const>\z3mod\) -val mk_lt = Thm.mk_binop (Thm.cterm_of \<^context> @{const less (int)}) -val mk_le = Thm.mk_binop (Thm.cterm_of \<^context> @{const less_eq (int)}) +val mk_sub = Thm.mk_binop \<^cterm>\(-) :: int \ _\ +val mk_mul = Thm.mk_binop \<^cterm>\(*) :: int \ _\ +val mk_div = Thm.mk_binop \<^cterm>\z3div\ +val mk_mod = Thm.mk_binop \<^cterm>\z3mod\ +val mk_lt = Thm.mk_binop \<^cterm>\(<) :: int \ _\ +val mk_le = Thm.mk_binop \<^cterm>\(\) :: int \ _\ fun mk_builtin_fun ctxt sym cts = (case (sym, cts) of diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/SMT/z3_replay_methods.ML --- a/src/HOL/Tools/SMT/z3_replay_methods.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/SMT/z3_replay_methods.ML Tue Sep 28 22:45:52 2021 +0200 @@ -315,10 +315,10 @@ (thm COMP_INCR intro_hyp_rule1) handle THM _ => thm COMP_INCR intro_hyp_rule2 -fun negated_prop (\<^const>\HOL.Not\ $ t) = HOLogic.mk_Trueprop t +fun negated_prop \<^Const_>\Not for t\ = HOLogic.mk_Trueprop t | negated_prop t = HOLogic.mk_Trueprop (HOLogic.mk_not t) -fun intro_hyps tab (t as \<^const>\HOL.disj\ $ t1 $ t2) cx = +fun intro_hyps tab (t as \<^Const_>\HOL.disj\ $ t1 $ t2) cx = lookup_intro_hyps tab t (fold (intro_hyps tab) [t1, t2]) cx | intro_hyps tab t cx = lookup_intro_hyps tab t (fn _ => raise LEMMA ()) cx @@ -376,7 +376,7 @@ fun def_axiom_disj ctxt t = (case dest_prop t of - \<^const>\HOL.disj\ $ u1 $ u2 => + \<^Const_>\disj for u1 u2\ => SMT_Replay_Methods.prove_abstract' ctxt t prop_tac ( SMT_Replay_Methods.abstract_prop u2 ##>> SMT_Replay_Methods.abstract_prop u1 #>> HOLogic.mk_disj o swap) diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/Sledgehammer/sledgehammer_fact.ML --- a/src/HOL/Tools/Sledgehammer/sledgehammer_fact.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/Sledgehammer/sledgehammer_fact.ML Tue Sep 28 22:45:52 2021 +0200 @@ -78,10 +78,10 @@ fun is_rec_eq lhs = Term.exists_subterm (curry (op =) (head_of lhs)) -fun is_rec_def (\<^const>\Trueprop\ $ t) = is_rec_def t - | is_rec_def (\<^const>\Pure.imp\ $ _ $ t2) = is_rec_def t2 - | is_rec_def (Const (\<^const_name>\Pure.eq\, _) $ t1 $ t2) = is_rec_eq t1 t2 - | is_rec_def (Const (\<^const_name>\HOL.eq\, _) $ t1 $ t2) = is_rec_eq t1 t2 +fun is_rec_def \<^Const_>\Trueprop for t\ = is_rec_def t + | is_rec_def \<^Const_>\Pure.imp for _ t2\ = is_rec_def t2 + | is_rec_def \<^Const_>\Pure.eq _ for t1 t2\ = is_rec_eq t1 t2 + | is_rec_def \<^Const_>\HOL.eq _ for t1 t2\ = is_rec_eq t1 t2 | is_rec_def _ = false fun is_assum assms th = exists (fn ct => Thm.prop_of th aconv Thm.term_of ct) assms @@ -249,8 +249,8 @@ else Interesting - fun interest_of_prop _ (\<^const>\Trueprop\ $ t) = interest_of_bool t - | interest_of_prop Ts (\<^const>\Pure.imp\ $ t $ u) = + fun interest_of_prop _ \<^Const_>\Trueprop for t\ = interest_of_bool t + | interest_of_prop Ts \<^Const_>\Pure.imp for t u\ = combine_interests (interest_of_prop Ts t) (interest_of_prop Ts u) | interest_of_prop Ts (Const (\<^const_name>\Pure.all\, _) $ Abs (_, T, t)) = if type_has_top_sort T then Deal_Breaker else interest_of_prop (T :: Ts) t @@ -331,9 +331,9 @@ end end -fun normalize_eq (\<^const>\Trueprop\ $ (t as (t0 as Const (\<^const_name>\HOL.eq\, _)) $ t1 $ t2)) = +fun normalize_eq (\<^Const_>\Trueprop\ $ (t as (t0 as Const (\<^const_name>\HOL.eq\, _)) $ t1 $ t2)) = if is_less_equal (Term_Ord.fast_term_ord (t1, t2)) then t else t0 $ t2 $ t1 - | normalize_eq (\<^const>\Trueprop\ $ (t as \<^const>\Not\ + | normalize_eq (\<^Const_>\Trueprop\ $ (t as \<^Const_>\Not\ $ ((t0 as Const (\<^const_name>\HOL.eq\, _)) $ t1 $ t2))) = if is_less_equal (Term_Ord.fast_term_ord (t1, t2)) then t else HOLogic.mk_not (t0 $ t2 $ t1) | normalize_eq (Const (\<^const_name>\Pure.eq\, Type (_, [T, _])) $ t1 $ t2) = @@ -376,7 +376,7 @@ fun struct_induct_rule_on th = (case Logic.strip_horn (Thm.prop_of th) of - (prems, \<^const>\Trueprop\ $ ((p as Var ((p_name, 0), _)) $ (a as Var (_, ind_T)))) => + (prems, \<^Const_>\Trueprop\ $ ((p as Var ((p_name, 0), _)) $ (a as Var (_, ind_T)))) => if not (is_TVar ind_T) andalso length prems > 1 andalso exists (exists_subterm (curry (op aconv) p)) prems andalso not (exists (exists_subterm (curry (op aconv) a)) prems) then diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/Sledgehammer/sledgehammer_mepo.ML --- a/src/HOL/Tools/Sledgehammer/sledgehammer_mepo.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/Sledgehammer/sledgehammer_mepo.ML Tue Sep 28 22:45:52 2021 +0200 @@ -178,18 +178,18 @@ and do_formula t = (case t of Const (\<^const_name>\Pure.all\, _) $ Abs (_, _, t') => do_formula t' - | \<^const>\Pure.imp\ $ t1 $ t2 => do_formula t1 #> do_formula t2 + | \<^Const_>\Pure.imp for t1 t2\ => do_formula t1 #> do_formula t2 | Const (\<^const_name>\Pure.eq\, Type (_, [T, _])) $ t1 $ t2 => do_term_or_formula false T t1 #> do_term_or_formula true T t2 - | \<^const>\Trueprop\ $ t1 => do_formula t1 - | \<^const>\False\ => I - | \<^const>\True\ => I - | \<^const>\Not\ $ t1 => do_formula t1 + | \<^Const_>\Trueprop for t1\ => do_formula t1 + | \<^Const_>\False\ => I + | \<^Const_>\True\ => I + | \<^Const_>\Not for t1\ => do_formula t1 | Const (\<^const_name>\All\, _) $ Abs (_, _, t') => do_formula t' | Const (\<^const_name>\Ex\, _) $ Abs (_, _, t') => do_formula t' - | \<^const>\HOL.conj\ $ t1 $ t2 => do_formula t1 #> do_formula t2 - | \<^const>\HOL.disj\ $ t1 $ t2 => do_formula t1 #> do_formula t2 - | \<^const>\HOL.implies\ $ t1 $ t2 => do_formula t1 #> do_formula t2 + | \<^Const_>\conj for t1 t2\ => do_formula t1 #> do_formula t2 + | \<^Const_>\disj for t1 t2\ => do_formula t1 #> do_formula t2 + | \<^Const_>\implies for t1 t2\ => do_formula t1 #> do_formula t2 | Const (\<^const_name>\HOL.eq\, Type (_, [T, _])) $ t1 $ t2 => do_term_or_formula false T t1 #> do_term_or_formula true T t2 | Const (\<^const_name>\If\, Type (_, [_, Type (_, [T, _])])) $ t1 $ t2 $ t3 => diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/Sledgehammer/sledgehammer_prover_atp.ML --- a/src/HOL/Tools/Sledgehammer/sledgehammer_prover_atp.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/Sledgehammer/sledgehammer_prover_atp.ML Tue Sep 28 22:45:52 2021 +0200 @@ -76,17 +76,17 @@ fun do_equals t1 t2 = is_bad_equal t1 t2 orelse is_bad_equal t2 t1 fun do_formula pos t = (case (pos, t) of - (_, \<^const>\Trueprop\ $ t1) => do_formula pos t1 + (_, \<^Const_>\Trueprop for t1\) => do_formula pos t1 | (true, Const (\<^const_name>\Pure.all\, _) $ Abs (_, _, t')) => do_formula pos t' | (true, Const (\<^const_name>\All\, _) $ Abs (_, _, t')) => do_formula pos t' | (false, Const (\<^const_name>\Ex\, _) $ Abs (_, _, t')) => do_formula pos t' - | (_, \<^const>\Pure.imp\ $ t1 $ t2) => + | (_, \<^Const_>\Pure.imp for t1 t2\) => do_formula (not pos) t1 andalso (t2 = \<^prop>\False\ orelse do_formula pos t2) - | (_, \<^const>\HOL.implies\ $ t1 $ t2) => - do_formula (not pos) t1 andalso (t2 = \<^const>\False\ orelse do_formula pos t2) - | (_, \<^const>\Not\ $ t1) => do_formula (not pos) t1 - | (true, \<^const>\HOL.disj\ $ t1 $ t2) => forall (do_formula pos) [t1, t2] - | (false, \<^const>\HOL.conj\ $ t1 $ t2) => forall (do_formula pos) [t1, t2] + | (_, \<^Const_>\implies for t1 t2\) => + do_formula (not pos) t1 andalso (t2 = \<^Const>\False\ orelse do_formula pos t2) + | (_, \<^Const_>\Not for t1\) => do_formula (not pos) t1 + | (true, \<^Const_>\disj for t1 t2\) => forall (do_formula pos) [t1, t2] + | (false, \<^Const_>\conj for t1 t2\) => forall (do_formula pos) [t1, t2] | (true, Const (\<^const_name>\HOL.eq\, _) $ t1 $ t2) => do_equals t1 t2 | (true, Const (\<^const_name>\Pure.eq\, _) $ t1 $ t2) => do_equals t1 t2 | _ => false) diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/Transfer/transfer.ML --- a/src/HOL/Tools/Transfer/transfer.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/Transfer/transfer.ML Tue Sep 28 22:45:52 2021 +0200 @@ -550,8 +550,8 @@ Symtab.join (K or3) (tab1, tab2) end val tab = go [] p (t, u) Symtab.empty - fun f (a, (true, false, false)) = SOME (a, \<^const>\implies\) - | f (a, (false, true, false)) = SOME (a, \<^const>\rev_implies\) + fun f (a, (true, false, false)) = SOME (a, \<^Const>\implies\) + | f (a, (false, true, false)) = SOME (a, \<^Const>\rev_implies\) | f (a, (true, true, _)) = SOME (a, HOLogic.eq_const HOLogic.boolT) | f _ = NONE in diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/etc/options --- a/src/HOL/Tools/etc/options Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/etc/options Tue Sep 28 22:45:52 2021 +0200 @@ -26,7 +26,7 @@ section "Miscellaneous Tools" -public option sledgehammer_provers : string = "cvc4 z3 spass e remote_vampire" +public option sledgehammer_provers : string = "cvc4 z3 spass e vampire" -- "provers for Sledgehammer (separated by blanks)" public option sledgehammer_timeout : int = 30 diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/record.ML --- a/src/HOL/Tools/record.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/record.ML Tue Sep 28 22:45:52 2021 +0200 @@ -1808,8 +1808,8 @@ distinct_discsss = [], exhaust_discs = [], exhaust_sels = [], collapses = [], expands = [], split_sels = [], split_sel_asms = [], case_eq_ifs = []}; -fun lhs_of_equation (Const (\<^const_name>\Pure.eq\, _) $ t $ _) = t - | lhs_of_equation (\<^const>\Trueprop\ $ (Const (\<^const_name>\HOL.eq\, _) $ t $ _)) = t; +fun lhs_of_equation \<^Const_>\Pure.eq _ for t _\ = t + | lhs_of_equation \<^Const_>\Trueprop for \<^Const_>\HOL.eq _ for t _\\ = t; fun add_spec_rule rule = let val head = head_of (lhs_of_equation (Thm.prop_of rule)) diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Tools/set_comprehension_pointfree.ML --- a/src/HOL/Tools/set_comprehension_pointfree.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Tools/set_comprehension_pointfree.ML Tue Sep 28 22:45:52 2021 +0200 @@ -250,8 +250,8 @@ (map Pattern pats, Un (fm1', fm2')) end; -fun mk_formula vs (\<^const>\HOL.conj\ $ t1 $ t2) = merge_inter vs (mk_formula vs t1) (mk_formula vs t2) - | mk_formula vs (\<^const>\HOL.disj\ $ t1 $ t2) = merge_union vs (mk_formula vs t1) (mk_formula vs t2) +fun mk_formula vs \<^Const_>\conj for t1 t2\ = merge_inter vs (mk_formula vs t1) (mk_formula vs t2) + | mk_formula vs \<^Const_>\disj for t1 t2\ = merge_union vs (mk_formula vs t1) (mk_formula vs t2) | mk_formula vs t = apfst single (mk_atom vs t) fun strip_Int (Int (fm1, fm2)) = fm1 :: (strip_Int fm2) diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Transitive_Closure.thy --- a/src/HOL/Transitive_Closure.thy Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Transitive_Closure.thy Tue Sep 28 22:45:52 2021 +0200 @@ -1289,7 +1289,7 @@ fun decomp \<^Const_>\Trueprop for t\ = let - fun dec \<^Const_>\Set.member _ for \\<^Const_>\Pair _ _ for a b\\ rel\ = + fun dec \<^Const_>\Set.member _ for \<^Const_>\Pair _ _ for a b\ rel\ = let fun decr \<^Const_>\rtrancl _ for r\ = (r,"r*") | decr \<^Const_>\trancl _ for r\ = (r,"r+") diff -r 90c99974f648 -r bd9a5e128c31 src/HOL/Typerep.thy --- a/src/HOL/Typerep.thy Tue Sep 28 20:58:04 2021 +0200 +++ b/src/HOL/Typerep.thy Tue Sep 28 22:45:52 2021 +0200 @@ -32,7 +32,7 @@ typed_print_translation \ let - fun typerep_tr' ctxt (*"typerep"*) \<^Type>\fun \\<^Type>\itself T\\ _\ + fun typerep_tr' ctxt (*"typerep"*) \<^Type>\fun \<^Type>\itself T\ _\ (Const (\<^const_syntax>\Pure.type\, _) :: ts) = Term.list_comb (Syntax.const \<^syntax_const>\_TYPEREP\ $ Syntax_Phases.term_of_typ ctxt T, ts) diff -r 90c99974f648 -r bd9a5e128c31 src/Pure/General/antiquote.ML --- a/src/Pure/General/antiquote.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/Pure/General/antiquote.ML Tue Sep 28 22:45:52 2021 +0200 @@ -7,6 +7,8 @@ signature ANTIQUOTE = sig type control = {range: Position.range, name: string * Position.T, body: Symbol_Pos.T list} + val no_control: control + val control_symbols: control -> Symbol_Pos.T list type antiq = {start: Position.T, stop: Position.T, range: Position.range, body: Symbol_Pos.T list} datatype 'a antiquote = Text of 'a | Control of control | Antiq of antiq val is_text: 'a antiquote -> bool @@ -17,7 +19,8 @@ val split_lines: text_antiquote list -> text_antiquote list list val antiq_reports: 'a antiquote list -> Position.report list val update_reports: bool -> Position.T -> string list -> Position.report_text list - val scan_control: control scanner + val err_prefix: string + val scan_control: string -> control scanner val scan_antiq: antiq scanner val scan_antiquote: text_antiquote scanner val scan_antiquote_comments: text_antiquote scanner @@ -31,6 +34,10 @@ (* datatype antiquote *) type control = {range: Position.range, name: string * Position.T, body: Symbol_Pos.T list}; +val no_control = {range = Position.no_range, name = ("", Position.none), body = []}; +fun control_symbols ({name = (name, pos), body, ...}: control) = + (Symbol.encode (Symbol.Control name), pos) :: body; + type antiq = {start: Position.T, stop: Position.T, range: Position.range, body: Symbol_Pos.T list}; datatype 'a antiquote = Text of 'a | Control of control | Antiq of antiq; @@ -112,9 +119,9 @@ open Basic_Symbol_Pos; -local +val err_prefix = "Antiquotation lexical error: "; -val err_prefix = "Antiquotation lexical error: "; +local val scan_nl = Scan.one (fn (s, _) => s = "\n") >> single; val scan_nl_opt = Scan.optional scan_nl []; @@ -148,9 +155,9 @@ in -val scan_control = +fun scan_control err = Scan.option (Scan.one (Symbol.is_control o Symbol_Pos.symbol)) -- - Symbol_Pos.scan_cartouche err_prefix >> + Symbol_Pos.scan_cartouche err >> (fn (opt_control, body) => let val (name, range) = @@ -173,10 +180,10 @@ body = body}); val scan_antiquote = - scan_text >> Text || scan_control >> Control || scan_antiq >> Antiq; + scan_text >> Text || scan_control err_prefix >> Control || scan_antiq >> Antiq; val scan_antiquote_comments = - scan_text_comments >> Text || scan_control >> Control || scan_antiq >> Antiq; + scan_text_comments >> Text || scan_control err_prefix >> Control || scan_antiq >> Antiq; end; diff -r 90c99974f648 -r bd9a5e128c31 src/Pure/General/scan.scala --- a/src/Pure/General/scan.scala Tue Sep 28 20:58:04 2021 +0200 +++ b/src/Pure/General/scan.scala Tue Sep 28 22:45:52 2021 +0200 @@ -290,6 +290,13 @@ } + /* control cartouches */ + + val control_symbol: Parser[String] = one(Symbol.is_control) + + val control_cartouche: Parser[String] = control_symbol ~ cartouche ^^ { case a ~ b => a + b } + + /* keyword */ def literal(lexicon: Lexicon): Parser[String] = new Parser[String] diff -r 90c99974f648 -r bd9a5e128c31 src/Pure/Isar/parse.ML --- a/src/Pure/Isar/parse.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/Pure/Isar/parse.ML Tue Sep 28 22:45:52 2021 +0200 @@ -32,6 +32,7 @@ val alt_string: string parser val verbatim: string parser val cartouche: string parser + val control: Antiquote.control parser val eof: string parser val command_name: string -> string parser val keyword_with: (string -> bool) -> string parser @@ -195,6 +196,7 @@ val alt_string = kind Token.Alt_String; val verbatim = kind Token.Verbatim; val cartouche = kind Token.Cartouche; +val control = token (kind Token.control_kind) >> (the o Token.get_control); val eof = kind Token.EOF; fun command_name x = diff -r 90c99974f648 -r bd9a5e128c31 src/Pure/Isar/token.ML --- a/src/Pure/Isar/token.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/Pure/Isar/token.ML Tue Sep 28 22:45:52 2021 +0200 @@ -11,9 +11,12 @@ Command | Keyword | Ident | Long_Ident | Sym_Ident | Var | Type_Ident | Type_Var | Nat | Float | Space | (*delimited content*) - String | Alt_String | Verbatim | Cartouche | Comment of Comment.kind option | + String | Alt_String | Verbatim | Cartouche | + Control of Antiquote.control | + Comment of Comment.kind option | (*special content*) Error of string | EOF + val control_kind: kind val str_of_kind: kind -> string type file = {src_path: Path.T, lines: string list, digest: SHA1.digest, pos: Position.T} type T @@ -37,6 +40,7 @@ val stopper: T Scan.stopper val kind_of: T -> kind val is_kind: kind -> T -> bool + val get_control: T -> Antiquote.control option val is_command: T -> bool val keyword_with: (string -> bool) -> T -> bool val is_command_modifier: T -> bool @@ -118,10 +122,20 @@ Command | Keyword | Ident | Long_Ident | Sym_Ident | Var | Type_Ident | Type_Var | Nat | Float | Space | (*delimited content*) - String | Alt_String | Verbatim | Cartouche | Comment of Comment.kind option | + String | Alt_String | Verbatim | Cartouche | + Control of Antiquote.control | + Comment of Comment.kind option | (*special content*) Error of string | EOF; +val control_kind = Control Antiquote.no_control; + +fun equiv_kind kind kind' = + (case (kind, kind') of + (Control _, Control _) => true + | (Error _, Error _) => true + | _ => kind = kind'); + val str_of_kind = fn Command => "command" | Keyword => "keyword" @@ -138,6 +152,7 @@ | Alt_String => "back-quoted string" | Verbatim => "verbatim text" | Cartouche => "text cartouche" + | Control _ => "control cartouche" | Comment NONE => "informal comment" | Comment (SOME _) => "formal comment" | Error _ => "bad input" @@ -152,6 +167,7 @@ | Alt_String => true | Verbatim => true | Cartouche => true + | Control _ => true | Comment _ => true | _ => false); @@ -214,7 +230,10 @@ (* kind of token *) fun kind_of (Token (_, (k, _), _)) = k; -fun is_kind k (Token (_, (k', _), _)) = k = k'; +fun is_kind k (Token (_, (k', _), _)) = equiv_kind k k'; + +fun get_control tok = + (case kind_of tok of Control control => SOME control | _ => NONE); val is_command = is_kind Command; @@ -304,6 +323,7 @@ | Alt_String => (Markup.alt_string, "") | Verbatim => (Markup.verbatim, "") | Cartouche => (Markup.cartouche, "") + | Control _ => (Markup.cartouche, "") | Comment _ => (Markup.comment, "") | Error msg => (Markup.bad (), msg) | _ => (Markup.empty, ""); @@ -354,6 +374,7 @@ | Alt_String => Symbol_Pos.quote_string_bq x | Verbatim => enclose "{*" "*}" x | Cartouche => cartouche x + | Control control => Symbol_Pos.content (Antiquote.control_symbols control) | Comment NONE => enclose "(*" "*)" x | EOF => "" | _ => x); @@ -646,9 +667,11 @@ (Symbol_Pos.scan_string_qq err_prefix >> token_range String || Symbol_Pos.scan_string_bq err_prefix >> token_range Alt_String || scan_verbatim >> token_range Verbatim || - scan_cartouche >> token_range Cartouche || scan_comment >> token_range (Comment NONE) || Comment.scan_outer >> (fn (k, ss) => token (Comment (SOME k)) ss) || + scan_cartouche >> token_range Cartouche || + Antiquote.scan_control err_prefix >> (fn control => + token (Control control) (Antiquote.control_symbols control)) || scan_space >> token Space || (Scan.max token_leq (Scan.max token_leq diff -r 90c99974f648 -r bd9a5e128c31 src/Pure/Isar/token.scala --- a/src/Pure/Isar/token.scala Tue Sep 28 20:58:04 2021 +0200 +++ b/src/Pure/Isar/token.scala Tue Sep 28 22:45:52 2021 +0200 @@ -34,6 +34,7 @@ val ALT_STRING = Value("back-quoted string") val VERBATIM = Value("verbatim text") val CARTOUCHE = Value("text cartouche") + val CONTROL = Value("control cartouche") val INFORMAL_COMMENT = Value("informal comment") val FORMAL_COMMENT = Value("formal comment") /*special content*/ @@ -53,11 +54,12 @@ val string = quoted("\"") ^^ (x => Token(Token.Kind.STRING, x)) val alt_string = quoted("`") ^^ (x => Token(Token.Kind.ALT_STRING, x)) val verb = verbatim ^^ (x => Token(Token.Kind.VERBATIM, x)) - val cart = cartouche ^^ (x => Token(Token.Kind.CARTOUCHE, x)) val cmt = comment ^^ (x => Token(Token.Kind.INFORMAL_COMMENT, x)) val formal_cmt = comment_cartouche ^^ (x => Token(Token.Kind.FORMAL_COMMENT, x)) + val cart = cartouche ^^ (x => Token(Token.Kind.CARTOUCHE, x)) + val ctrl = control_cartouche ^^ (x => Token(Token.Kind.CONTROL, x)) - string | (alt_string | (verb | (cart | (cmt | formal_cmt)))) + string | (alt_string | (verb | (cmt | (formal_cmt | (cart | ctrl))))) } private def other_token(keywords: Keyword.Keywords): Parser[Token] = diff -r 90c99974f648 -r bd9a5e128c31 src/Pure/ML/ml_antiquotations1.ML --- a/src/Pure/ML/ml_antiquotations1.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/Pure/ML/ml_antiquotations1.ML Tue Sep 28 22:45:52 2021 +0200 @@ -234,27 +234,35 @@ | NONE => error ("Bad input" ^ Position.here (Input.pos_of input))) end; -fun ml_sources ctxt srcs = +fun ml_args ctxt args = let - val (decls, ctxt') = fold_map (ML_Context.expand_antiquotes o ML_Lex.read_source) srcs ctxt; + val (decls, ctxt') = fold_map (ML_Context.expand_antiquotes) args ctxt; fun decl' ctxt'' = map (fn decl => decl ctxt'') decls; in (decl', ctxt') end val parse_name = Parse.input Parse.name; -val parse_args = Scan.repeat (Parse.input Parse.underscore || Parse.embedded_input); + +val parse_arg = + Parse.input Parse.underscore >> ML_Lex.read_source || + Parse.embedded_input >> ML_Lex.read_source || + Parse.control >> (ML_Lex.read_symbols o Antiquote.control_symbols); + +val parse_args = Scan.repeat parse_arg; val parse_for_args = Scan.optional ((Parse.position (Parse.$$$ "for") >> #2) -- Parse.!!! parse_args) (Position.none, []); fun parse_body b = - if b then Parse.$$$ "=>" |-- Parse.!!! Parse.embedded_input >> single + if b then Parse.$$$ "=>" |-- Parse.!!! Parse.embedded_input >> (ML_Lex.read_source #> single) else Scan.succeed []; -fun is_dummy s = Input.string_of s = "_"; +fun is_dummy [Antiquote.Text tok] = ML_Lex.content_of tok = "_" + | is_dummy _ = false; val ml = ML_Lex.tokenize_no_range; val ml_range = ML_Lex.tokenize_range; val ml_dummy = ml "_"; +fun ml_enclose range x = ml_range range "(" @ x @ ml_range range ")"; fun ml_parens x = ml "(" @ x @ ml ")"; fun ml_bracks x = ml "[" @ x @ ml "]"; fun ml_commas xs = flat (separate (ml ", ") xs); @@ -279,18 +287,20 @@ error ("Type constructor " ^ quote (Proof_Context.markup_type ctxt c) ^ " takes " ^ string_of_int n ^ " argument(s)" ^ Position.here pos); - val (decls1, ctxt1) = ml_sources ctxt type_args; - val (decls2, ctxt2) = (ml_sources ctxt1) fn_body; + val (decls1, ctxt1) = ml_args ctxt type_args; + val (decls2, ctxt2) = ml_args ctxt1 fn_body; fun decl' ctxt' = let val (ml_args_env, ml_args_body) = split_list (decls1 ctxt'); val (ml_fn_env, ml_fn_body) = split_list (decls2 ctxt'); - val ml1 = ml_parens (ml "Term.Type " @ ml_pair (ml_string c, ml_list ml_args_body)); + val ml1 = + ml_enclose range (ml "Term.Type " @ ml_pair (ml_string c, ml_list ml_args_body)); val ml2 = if function then - ml "(" @ ml_range range "fn " @ ml1 @ ml "=> " @ flat ml_fn_body @ - ml "| T => " @ ml_range range "raise" @ - ml " Term.TYPE (" @ ml_string ("Type_fn " ^ quote c) @ ml ", [T], []))" + ml_enclose range + (ml_range range "fn " @ ml1 @ ml "=> " @ flat ml_fn_body @ + ml "| T => " @ ml_range range "raise" @ + ml " Term.TYPE (" @ ml_string ("Type_fn " ^ quote c) @ ml ", [T], [])") else ml1; in (flat (ml_args_env @ ml_fn_env), ml2) end; in (decl', ctxt2) end); @@ -321,11 +331,11 @@ length type_args <> n andalso err (" takes " ^ string_of_int n ^ " type argument(s)"); val _ = length term_args > m andalso Term.is_Type (Term.body_type T) andalso - err (" cannot have more than " ^ string_of_int m ^ " type argument(s)"); + err (" cannot have more than " ^ string_of_int m ^ " argument(s)"); - val (decls1, ctxt1) = ml_sources ctxt type_args; - val (decls2, ctxt2) = ml_sources ctxt1 term_args; - val (decls3, ctxt3) = ml_sources ctxt2 fn_body; + val (decls1, ctxt1) = ml_args ctxt type_args; + val (decls2, ctxt2) = ml_args ctxt1 term_args; + val (decls3, ctxt3) = ml_args ctxt2 fn_body; fun decl' ctxt' = let val (ml_args_env1, ml_args_body1) = split_list (decls1 ctxt'); @@ -351,12 +361,13 @@ | ml_app (u :: us) = ml "Term.$ " @ ml_pair (ml_app us, u); val ml_env = flat (ml_args_env1 @ ml_args_env2 @ ml_fn_env); - val ml1 = ml_parens (ml_app (rev ml_args_body2)); + val ml1 = ml_enclose range (ml_app (rev ml_args_body2)); val ml2 = if function then - ml "(" @ ml_range range "fn " @ ml1 @ ml "=> " @ flat ml_fn_body @ - ml "| t => " @ ml_range range "raise" @ - ml " Term.TERM (" @ ml_string ("Const_fn " ^ quote c) @ ml ", [t]))" + ml_enclose range + (ml_range range "fn " @ ml1 @ ml "=> " @ flat ml_fn_body @ + ml "| t => " @ ml_range range "raise" @ + ml " Term.TERM (" @ ml_string ("Const_fn " ^ quote c) @ ml ", [t])") else ml1; in (ml_env, ml2) end; in (decl', ctxt3) end); diff -r 90c99974f648 -r bd9a5e128c31 src/Pure/ML/ml_lex.ML --- a/src/Pure/ML/ml_lex.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/Pure/ML/ml_lex.ML Tue Sep 28 22:45:52 2021 +0200 @@ -36,6 +36,7 @@ token Antiquote.antiquote Symbol_Pos.scanner -> Input.source -> token Antiquote.antiquote list val read_source: Input.source -> token Antiquote.antiquote list val read_source_sml: Input.source -> token Antiquote.antiquote list + val read_symbols: Symbol_Pos.T list -> token Antiquote.antiquote list val read_symbols_sml: Symbol_Pos.T list -> token Antiquote.antiquote list end; @@ -315,7 +316,7 @@ val scan_ml_antiq = Comment.scan_inner >> (fn (kind, ss) => Antiquote.Text (token (Comment (SOME kind)) ss)) || - Antiquote.scan_control >> Antiquote.Control || + Antiquote.scan_control Antiquote.err_prefix >> Antiquote.Control || Antiquote.scan_antiq >> Antiquote.Antiq || scan_rat_antiq >> Antiquote.Antiq || scan_sml_antiq; @@ -389,6 +390,7 @@ read_source' {language = Markup.language_SML, symbols = false, opaque_warning = false} scan_sml_antiq; +val read_symbols = reader {opaque_warning = true} scan_ml_antiq; val read_symbols_sml = reader {opaque_warning = false} scan_sml_antiq; end; diff -r 90c99974f648 -r bd9a5e128c31 src/Pure/Thy/document_output.ML --- a/src/Pure/Thy/document_output.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/Pure/Thy/document_output.ML Tue Sep 28 22:45:52 2021 +0200 @@ -156,6 +156,7 @@ | Token.Alt_String => output false "{\\isacharbackquoteopen}" "{\\isacharbackquoteclose}" | Token.Verbatim => output true "{\\isacharverbatimopen}" "{\\isacharverbatimclose}" | Token.Cartouche => output false "{\\isacartoucheopen}" "{\\isacartoucheclose}" + | Token.Control control => output_body ctxt false "" "" (Antiquote.control_symbols control) | _ => output false "" "") end handle ERROR msg => error (msg ^ Position.here (Token.pos_of tok)); diff -r 90c99974f648 -r bd9a5e128c31 src/Pure/Tools/generated_files.ML --- a/src/Pure/Tools/generated_files.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/Pure/Tools/generated_files.ML Tue Sep 28 22:45:52 2021 +0200 @@ -201,7 +201,7 @@ end; val scan_antiq = - Antiquote.scan_control >> Antiquote.Control || + Antiquote.scan_control Antiquote.err_prefix >> Antiquote.Control || Scan.one (Symbol.not_eof o Symbol_Pos.symbol) >> (Antiquote.Text o Symbol_Pos.symbol); fun read_source ctxt (file_type: file_type) source = diff -r 90c99974f648 -r bd9a5e128c31 src/Tools/jEdit/src/jedit_rendering.scala --- a/src/Tools/jEdit/src/jedit_rendering.scala Tue Sep 28 20:58:04 2021 +0200 +++ b/src/Tools/jEdit/src/jedit_rendering.scala Tue Sep 28 22:45:52 2021 +0200 @@ -72,6 +72,7 @@ Token.Kind.ALT_STRING -> LITERAL2, Token.Kind.VERBATIM -> COMMENT3, Token.Kind.CARTOUCHE -> COMMENT3, + Token.Kind.CONTROL -> COMMENT3, Token.Kind.INFORMAL_COMMENT -> COMMENT1, Token.Kind.FORMAL_COMMENT -> COMMENT1, Token.Kind.ERROR -> INVALID diff -r 90c99974f648 -r bd9a5e128c31 src/ZF/Tools/inductive_package.ML --- a/src/ZF/Tools/inductive_package.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/ZF/Tools/inductive_package.ML Tue Sep 28 22:45:52 2021 +0200 @@ -298,7 +298,7 @@ (*Used to make induction rules; ind_alist = [(rec_tm1,pred1),...] associates predicates with rec ops prem is a premise of an intr rule*) - fun add_induct_prem ind_alist (prem as \<^Const_>\Trueprop for \\<^Const_>\mem for t X\\\, iprems) = + fun add_induct_prem ind_alist (prem as \<^Const_>\Trueprop for \<^Const_>\mem for t X\\, iprems) = (case AList.lookup (op aconv) ind_alist X of SOME pred => prem :: \<^make_judgment> (pred $ t) :: iprems | NONE => (*possibly membership in M(rec_tm), for M monotone*) @@ -391,7 +391,7 @@ elem_factors ---> \<^Type>\o\) val qconcl = fold_rev (FOLogic.mk_all o Term.dest_Free) elem_frees - \<^Const>\imp for \\<^Const>\mem for elem_tuple rec_tm\\ \list_comb (pfree, elem_frees)\\ + \<^Const>\imp for \<^Const>\mem for elem_tuple rec_tm\ \list_comb (pfree, elem_frees)\\ in (CP.ap_split elem_type \<^Type>\o\ pfree, qconcl) end; @@ -400,7 +400,7 @@ (*Used to form simultaneous induction lemma*) fun mk_rec_imp (rec_tm,pred) = - \<^Const>\imp for \\<^Const>\mem for \Bound 0\ rec_tm\\ \pred $ Bound 0\\; + \<^Const>\imp for \<^Const>\mem for \Bound 0\ rec_tm\ \pred $ Bound 0\\; (*To instantiate the main induction rule*) val induct_concl = diff -r 90c99974f648 -r bd9a5e128c31 src/ZF/Tools/typechk.ML --- a/src/ZF/Tools/typechk.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/ZF/Tools/typechk.ML Tue Sep 28 22:45:52 2021 +0200 @@ -76,7 +76,7 @@ if length rls <= maxr then resolve_tac ctxt rls i else no_tac end); -fun is_rigid_elem \<^Const_>\Trueprop for \\<^Const_>\mem for a _\\\ = not (is_Var (head_of a)) +fun is_rigid_elem \<^Const_>\Trueprop for \<^Const_>\mem for a _\\ = not (is_Var (head_of a)) | is_rigid_elem _ = false; (*Try solving a:A by assumption provided a is rigid!*) diff -r 90c99974f648 -r bd9a5e128c31 src/ZF/arith_data.ML --- a/src/ZF/arith_data.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/ZF/arith_data.ML Tue Sep 28 22:45:52 2021 +0200 @@ -48,7 +48,7 @@ (*Use <-> or = depending on the type of t*) fun mk_eq_iff(t,u) = if fastype_of t = \<^Type>\i\ - then \<^Const>\IFOL.eq \\<^Type>\i\\ for t u\ + then \<^Const>\IFOL.eq \<^Type>\i\ for t u\ else \<^Const>\IFOL.iff for t u\; (*We remove equality assumptions because they confuse the simplifier and diff -r 90c99974f648 -r bd9a5e128c31 src/ZF/ind_syntax.ML --- a/src/ZF/ind_syntax.ML Tue Sep 28 20:58:04 2021 +0200 +++ b/src/ZF/ind_syntax.ML Tue Sep 28 22:45:52 2021 +0200 @@ -22,7 +22,7 @@ fun mk_all_imp (A,P) = let val T = \<^Type>\i\ in \<^Const>\All T for - \Abs ("v", T, \<^Const>\imp for \\<^Const>\mem for \Bound 0\ A\\ \Term.betapply (P, Bound 0)\\)\\ + \Abs ("v", T, \<^Const>\imp for \<^Const>\mem for \Bound 0\ A\ \Term.betapply (P, Bound 0)\\)\\ end; fun mk_Collect (a, D, t) = \<^Const>\Collect for D\ $ absfree (a, \<^Type>\i\) t; @@ -37,7 +37,7 @@ (*Return the conclusion of a rule, of the form t:X*) fun rule_concl rl = - let val \<^Const_>\Trueprop for \\<^Const_>\mem for t X\\\ = Logic.strip_imp_concl rl + let val \<^Const_>\Trueprop for \<^Const_>\mem for t X\\ = Logic.strip_imp_concl rl in (t,X) end; (*As above, but return error message if bad*)