diff -r dc73f9e6476b -r e80c4cde6064 src/HOL/Decision_Procs/MIR.thy --- a/src/HOL/Decision_Procs/MIR.thy Wed Sep 29 18:22:32 2021 +0200 +++ b/src/HOL/Decision_Procs/MIR.thy Wed Sep 29 22:54:38 2021 +0200 @@ -5581,92 +5581,92 @@ | num_of_term vs \<^term>\1::real\ = mk_C 1 | num_of_term vs \<^term>\- 1::real\ = mk_C (~ 1) | num_of_term vs (Bound i) = mk_Bound i - | num_of_term vs (\<^term>\uminus :: real \ real\ $ t') = @{code Neg} (num_of_term vs t') - | num_of_term vs (\<^term>\(+) :: real \ real \ real\ $ t1 $ t2) = + | num_of_term vs \<^Const_>\uminus \<^Type>\real\ for t'\ = @{code Neg} (num_of_term vs t') + | num_of_term vs \<^Const_>\plus \<^Type>\real\ for t1 t2\ = @{code Add} (num_of_term vs t1, num_of_term vs t2) - | num_of_term vs (\<^term>\(-) :: real \ real \ real\ $ t1 $ t2) = + | num_of_term vs \<^Const_>\minus \<^Type>\real\ for t1 t2\ = @{code Sub} (num_of_term vs t1, num_of_term vs t2) - | num_of_term vs (\<^term>\(*) :: real \ real \ real\ $ t1 $ t2) = - (case (num_of_term vs t1) - of @{code C} i => @{code Mul} (i, num_of_term vs t2) - | _ => error "num_of_term: unsupported Multiplication") - | num_of_term vs (\<^term>\of_int :: int \ real\ $ (\<^term>\numeral :: _ \ int\ $ t')) = + | num_of_term vs \<^Const_>\times \<^Type>\real\ for t1 t2\ = + (case num_of_term vs t1 of + @{code C} i => @{code Mul} (i, num_of_term vs t2) + | _ => error "num_of_term: unsupported Multiplication") + | num_of_term vs \<^Const_>\of_int \<^Type>\real\ for \<^Const_>\numeral \<^Type>\int\ for t'\\ = mk_C (HOLogic.dest_numeral t') - | num_of_term vs (\<^term>\of_int :: int \ real\ $ (\<^term>\- numeral :: _ \ int\ $ t')) = + | num_of_term vs (\<^Const_>\of_int \<^Type>\real\\ $ (\<^term>\- numeral :: _ \ int\ $ t')) = (* FIXME !? *) mk_C (~ (HOLogic.dest_numeral t')) - | num_of_term vs (\<^term>\of_int :: int \ real\ $ (\<^term>\floor :: real \ int\ $ t')) = + | num_of_term vs \<^Const_>\of_int \<^Type>\real\ for \<^Const_>\floor \<^Type>\real\ for t'\\ = @{code Floor} (num_of_term vs t') - | num_of_term vs (\<^term>\of_int :: int \ real\ $ (\<^term>\ceiling :: real \ int\ $ t')) = + | num_of_term vs \<^Const_>\of_int \<^Type>\real\ for \<^Const_>\ceiling \<^Type>\real\ for t'\\ = @{code Neg} (@{code Floor} (@{code Neg} (num_of_term vs t'))) - | num_of_term vs (\<^term>\numeral :: _ \ real\ $ t') = + | num_of_term vs \<^Const_>\numeral \<^Type>\real\ for t'\ = mk_C (HOLogic.dest_numeral t') - | num_of_term vs (\<^term>\- numeral :: _ \ real\ $ t') = + | num_of_term vs (\<^term>\- numeral :: _ \ real\ $ t') = (* FIXME !? *) mk_C (~ (HOLogic.dest_numeral t')) | num_of_term vs t = error ("num_of_term: unknown term " ^ Syntax.string_of_term \<^context> t); -fun fm_of_term vs \<^term>\True\ = @{code T} - | fm_of_term vs \<^term>\False\ = @{code F} - | fm_of_term vs (\<^term>\(<) :: real \ real \ bool\ $ t1 $ t2) = +fun fm_of_term vs \<^Const_>\True\ = @{code T} + | fm_of_term vs \<^Const_>\False\ = @{code F} + | fm_of_term vs \<^Const_>\less \<^Type>\real\ for t1 t2\ = @{code Lt} (@{code Sub} (num_of_term vs t1, num_of_term vs t2)) - | fm_of_term vs (\<^term>\(\) :: real \ real \ bool\ $ t1 $ t2) = + | fm_of_term vs \<^Const_>\less_eq \<^Type>\real\ for t1 t2\ = @{code Le} (@{code Sub} (num_of_term vs t1, num_of_term vs t2)) - | fm_of_term vs (\<^term>\(=) :: real \ real \ bool\ $ t1 $ t2) = + | fm_of_term vs \<^Const_>\HOL.eq \<^Type>\real\ for t1 t2\ = @{code Eq} (@{code Sub} (num_of_term vs t1, num_of_term vs t2)) - | fm_of_term vs (\<^term>\(rdvd)\ $ (\<^term>\of_int :: int \ real\ $ (\<^term>\numeral :: _ \ int\ $ t1)) $ t2) = + | fm_of_term vs \<^Const_>\rdvd for \<^Const_>\of_int \<^Type>\real\ for \<^Const_>\numeral \<^Type>\int\ for t1\\ t2\ = mk_Dvd (HOLogic.dest_numeral t1, num_of_term vs t2) - | fm_of_term vs (\<^term>\(rdvd)\ $ (\<^term>\of_int :: int \ real\ $ (\<^term>\- numeral :: _ \ int\ $ t1)) $ t2) = + | fm_of_term vs \<^Const_>\rdvd for \<^Const_>\of_int \<^Type>\real\ for \(\<^term>\- numeral :: _ \ int\ $ t1)\\ t2\ = (* FIXME !? *) mk_Dvd (~ (HOLogic.dest_numeral t1), num_of_term vs t2) - | fm_of_term vs (\<^term>\(=) :: bool \ bool \ bool\ $ t1 $ t2) = + | fm_of_term vs \<^Const_>\HOL.eq \<^Type>\bool\ for t1 t2\ = @{code Iff} (fm_of_term vs t1, fm_of_term vs t2) - | fm_of_term vs (\<^term>\HOL.conj\ $ t1 $ t2) = + | fm_of_term vs \<^Const_>\HOL.conj for t1 t2\ = @{code And} (fm_of_term vs t1, fm_of_term vs t2) - | fm_of_term vs (\<^term>\HOL.disj\ $ t1 $ t2) = + | fm_of_term vs \<^Const_>\HOL.disj for t1 t2\ = @{code Or} (fm_of_term vs t1, fm_of_term vs t2) - | fm_of_term vs (\<^term>\HOL.implies\ $ t1 $ t2) = + | fm_of_term vs \<^Const_>\HOL.implies for t1 t2\ = @{code Imp} (fm_of_term vs t1, fm_of_term vs t2) - | fm_of_term vs (\<^term>\HOL.Not\ $ t') = + | fm_of_term vs \<^Const_>\HOL.Not for t'\ = @{code Not} (fm_of_term vs t') - | fm_of_term vs (Const (\<^const_name>\Ex\, _) $ Abs (xn, xT, p)) = + | fm_of_term vs \<^Const_>\Ex _ for \Abs (xn, xT, p)\\ = @{code E} (fm_of_term (map (fn (v, n) => (v, n + 1)) vs) p) - | fm_of_term vs (Const (\<^const_name>\All\, _) $ Abs (xn, xT, p)) = + | fm_of_term vs \<^Const_>\All _ for \Abs (xn, xT, p)\\ = @{code A} (fm_of_term (map (fn (v, n) => (v, n + 1)) vs) p) | fm_of_term vs t = error ("fm_of_term : unknown term " ^ Syntax.string_of_term \<^context> t); -fun term_of_num vs (@{code C} i) = \<^term>\of_int :: int \ real\ $ - HOLogic.mk_number HOLogic.intT (@{code integer_of_int} i) +fun term_of_num vs (@{code C} i) = + \<^Const>\of_int \<^Type>\real\ for \HOLogic.mk_number HOLogic.intT (@{code integer_of_int} i)\\ | term_of_num vs (@{code Bound} n) = let val m = @{code integer_of_nat} n; in fst (the (find_first (fn (_, q) => m = q) vs)) end | term_of_num vs (@{code Neg} (@{code Floor} (@{code Neg} t'))) = - \<^term>\of_int :: int \ real\ $ (\<^term>\ceiling :: real \ int\ $ term_of_num vs t') - | term_of_num vs (@{code Neg} t') = \<^term>\uminus :: real \ real\ $ term_of_num vs t' - | term_of_num vs (@{code Add} (t1, t2)) = \<^term>\(+) :: real \ real \ real\ $ - term_of_num vs t1 $ term_of_num vs t2 - | term_of_num vs (@{code Sub} (t1, t2)) = \<^term>\(-) :: real \ real \ real\ $ - term_of_num vs t1 $ term_of_num vs t2 - | term_of_num vs (@{code Mul} (i, t2)) = \<^term>\(*) :: real \ real \ real\ $ - term_of_num vs (@{code C} i) $ term_of_num vs t2 - | term_of_num vs (@{code Floor} t) = \<^term>\of_int :: int \ real\ $ (\<^term>\floor :: real \ int\ $ term_of_num vs t) + \<^Const>\of_int \<^Type>\real\ for \<^Const>\ceiling \<^Type>\real\ for \term_of_num vs t'\\\ + | term_of_num vs (@{code Neg} t') = \<^Const>\uminus \<^Type>\real\ for \term_of_num vs t'\\ + | term_of_num vs (@{code Add} (t1, t2)) = + \<^Const>\plus \<^Type>\real\ for \term_of_num vs t1\ \term_of_num vs t2\\ + | term_of_num vs (@{code Sub} (t1, t2)) = + \<^Const>\minus \<^Type>\real\ for \term_of_num vs t1\ \term_of_num vs t2\\ + | term_of_num vs (@{code Mul} (i, t2)) = + \<^Const>\times \<^Type>\real\ for \term_of_num vs (@{code C} i)\ \term_of_num vs t2\\ + | term_of_num vs (@{code Floor} t) = \<^Const>\of_int \<^Type>\real\ for \<^Const>\floor \<^Type>\real\ for \term_of_num vs t\\\ | term_of_num vs (@{code CN} (n, i, t)) = term_of_num vs (@{code Add} (@{code Mul} (i, @{code Bound} n), t)) | term_of_num vs (@{code CF} (c, t, s)) = term_of_num vs (@{code Add} (@{code Mul} (c, @{code Floor} t), s)); -fun term_of_fm vs @{code T} = \<^term>\True\ - | term_of_fm vs @{code F} = \<^term>\False\ +fun term_of_fm vs @{code T} = \<^Const>\True\ + | term_of_fm vs @{code F} = \<^Const>\False\ | term_of_fm vs (@{code Lt} t) = - \<^term>\(<) :: real \ real \ bool\ $ term_of_num vs t $ \<^term>\0::real\ + \<^Const>\less \<^Type>\real\ for \term_of_num vs t\ \<^term>\0::real\\ | term_of_fm vs (@{code Le} t) = - \<^term>\(\) :: real \ real \ bool\ $ term_of_num vs t $ \<^term>\0::real\ + \<^Const>\less_eq \<^Type>\real\ for \term_of_num vs t\ \<^term>\0::real\\ | term_of_fm vs (@{code Gt} t) = - \<^term>\(<) :: real \ real \ bool\ $ \<^term>\0::real\ $ term_of_num vs t + \<^Const>\less \<^Type>\real\ for \<^term>\0::real\ \term_of_num vs t\\ | term_of_fm vs (@{code Ge} t) = - \<^term>\(\) :: real \ real \ bool\ $ \<^term>\0::real\ $ term_of_num vs t + \<^Const>\less_eq \<^Type>\real\ for \<^term>\0::real\ \term_of_num vs t\\ | term_of_fm vs (@{code Eq} t) = - \<^term>\(=) :: real \ real \ bool\ $ term_of_num vs t $ \<^term>\0::real\ + \<^Const>\HOL.eq \<^Type>\real\ for \term_of_num vs t\ \<^term>\0::real\\ | term_of_fm vs (@{code NEq} t) = term_of_fm vs (@{code Not} (@{code Eq} t)) | term_of_fm vs (@{code Dvd} (i, t)) = - \<^term>\(rdvd)\ $ term_of_num vs (@{code C} i) $ term_of_num vs t + \<^Const>\rdvd for \term_of_num vs (@{code C} i)\ \term_of_num vs t\\ | term_of_fm vs (@{code NDvd} (i, t)) = term_of_fm vs (@{code Not} (@{code Dvd} (i, t))) | term_of_fm vs (@{code Not} t') = @@ -5678,7 +5678,7 @@ | term_of_fm vs (@{code Imp} (t1, t2)) = HOLogic.imp $ term_of_fm vs t1 $ term_of_fm vs t2 | term_of_fm vs (@{code Iff} (t1, t2)) = - \<^term>\(=) :: bool \ bool \ bool\ $ term_of_fm vs t1 $ term_of_fm vs t2; + \<^Const>\HOL.eq \<^Type>\bool\ for \term_of_fm vs t1\ \term_of_fm vs t2\\; in fn (ctxt, t) =>