src/HOL/Decision_Procs/MIR.thy
changeset 54489 03ff4d1e6784
parent 54230 b1d955791529
child 55584 a879f14b6f95
equal deleted inserted replaced
54488:b60f1fab408c 54489:03ff4d1e6784
  3152       by (simp only: real_of_int_mult real_of_int_add real_of_int_inject[symmetric] ei[simplified isint_iff] real_of_one) 
  3152       by (simp only: real_of_int_mult real_of_int_add real_of_int_inject[symmetric] ei[simplified isint_iff] real_of_one) 
  3153         (simp add: algebra_simps)
  3153         (simp add: algebra_simps)
  3154     hence "\<exists> j1\<in> {1 .. c*d}. real (c*i) = (- ?N i e + real j1) - 1"
  3154     hence "\<exists> j1\<in> {1 .. c*d}. real (c*i) = (- ?N i e + real j1) - 1"
  3155       by (simp only: algebra_simps)
  3155       by (simp only: algebra_simps)
  3156         hence "\<exists> j1\<in> {1 .. c*d}. real (c*i) = - 1 - ?N i e + real j1"
  3156         hence "\<exists> j1\<in> {1 .. c*d}. real (c*i) = - 1 - ?N i e + real j1"
  3157           by (simp add: algebra_simps minus_one [symmetric] del: minus_one)
  3157           by (simp add: algebra_simps)
  3158     with nob  have ?case by blast }
  3158     with nob  have ?case by blast }
  3159   ultimately show ?case by blast
  3159   ultimately show ?case by blast
  3160 next
  3160 next
  3161   case (9 j c e)  hence p: "real j rdvd real (c*i) + ?N i e" (is "?p x") and cp: "c > 0" and bn:"numbound0 e"  by simp+
  3161   case (9 j c e)  hence p: "real j rdvd real (c*i) + ?N i e" (is "?p x") and cp: "c > 0" and bn:"numbound0 e"  by simp+
  3162   let ?e = "Inum (real i # bs) e"
  3162   let ?e = "Inum (real i # bs) e"
  5547       | SOME n => mk_Bound n)
  5547       | SOME n => mk_Bound n)
  5548   | num_of_term vs @{term "real (0::int)"} = mk_C 0
  5548   | num_of_term vs @{term "real (0::int)"} = mk_C 0
  5549   | num_of_term vs @{term "real (1::int)"} = mk_C 1
  5549   | num_of_term vs @{term "real (1::int)"} = mk_C 1
  5550   | num_of_term vs @{term "0::real"} = mk_C 0
  5550   | num_of_term vs @{term "0::real"} = mk_C 0
  5551   | num_of_term vs @{term "1::real"} = mk_C 1
  5551   | num_of_term vs @{term "1::real"} = mk_C 1
       
  5552   | num_of_term vs @{term "- 1::real"} = mk_C (~ 1)
  5552   | num_of_term vs (Bound i) = mk_Bound i
  5553   | num_of_term vs (Bound i) = mk_Bound i
  5553   | num_of_term vs (@{term "uminus :: real \<Rightarrow> real"} $ t') = @{code Neg} (num_of_term vs t')
  5554   | num_of_term vs (@{term "uminus :: real \<Rightarrow> real"} $ t') = @{code Neg} (num_of_term vs t')
  5554   | num_of_term vs (@{term "op + :: real \<Rightarrow> real \<Rightarrow> real"} $ t1 $ t2) =
  5555   | num_of_term vs (@{term "op + :: real \<Rightarrow> real \<Rightarrow> real"} $ t1 $ t2) =
  5555       @{code Add} (num_of_term vs t1, num_of_term vs t2)
  5556       @{code Add} (num_of_term vs t1, num_of_term vs t2)
  5556   | num_of_term vs (@{term "op - :: real \<Rightarrow> real \<Rightarrow> real"} $ t1 $ t2) =
  5557   | num_of_term vs (@{term "op - :: real \<Rightarrow> real \<Rightarrow> real"} $ t1 $ t2) =
  5559       (case (num_of_term vs t1)
  5560       (case (num_of_term vs t1)
  5560        of @{code C} i => @{code Mul} (i, num_of_term vs t2)
  5561        of @{code C} i => @{code Mul} (i, num_of_term vs t2)
  5561         | _ => error "num_of_term: unsupported Multiplication")
  5562         | _ => error "num_of_term: unsupported Multiplication")
  5562   | num_of_term vs (@{term "real :: int \<Rightarrow> real"} $ (@{term "numeral :: _ \<Rightarrow> int"} $ t')) =
  5563   | num_of_term vs (@{term "real :: int \<Rightarrow> real"} $ (@{term "numeral :: _ \<Rightarrow> int"} $ t')) =
  5563       mk_C (HOLogic.dest_num t')
  5564       mk_C (HOLogic.dest_num t')
  5564   | num_of_term vs (@{term "real :: int \<Rightarrow> real"} $ (@{term "neg_numeral :: _ \<Rightarrow> int"} $ t')) =
  5565   | num_of_term vs (@{term "real :: int \<Rightarrow> real"} $ (@{term "- numeral :: _ \<Rightarrow> int"} $ t')) =
  5565       mk_C (~ (HOLogic.dest_num t'))
  5566       mk_C (~ (HOLogic.dest_num t'))
  5566   | num_of_term vs (@{term "real :: int \<Rightarrow> real"} $ (@{term "floor :: real \<Rightarrow> int"} $ t')) =
  5567   | num_of_term vs (@{term "real :: int \<Rightarrow> real"} $ (@{term "floor :: real \<Rightarrow> int"} $ t')) =
  5567       @{code Floor} (num_of_term vs t')
  5568       @{code Floor} (num_of_term vs t')
  5568   | num_of_term vs (@{term "real :: int \<Rightarrow> real"} $ (@{term "ceiling :: real \<Rightarrow> int"} $ t')) =
  5569   | num_of_term vs (@{term "real :: int \<Rightarrow> real"} $ (@{term "ceiling :: real \<Rightarrow> int"} $ t')) =
  5569       @{code Neg} (@{code Floor} (@{code Neg} (num_of_term vs t')))
  5570       @{code Neg} (@{code Floor} (@{code Neg} (num_of_term vs t')))
  5570   | num_of_term vs (@{term "numeral :: _ \<Rightarrow> real"} $ t') =
  5571   | num_of_term vs (@{term "numeral :: _ \<Rightarrow> real"} $ t') =
  5571       mk_C (HOLogic.dest_num t')
  5572       mk_C (HOLogic.dest_num t')
  5572   | num_of_term vs (@{term "neg_numeral :: _ \<Rightarrow> real"} $ t') =
  5573   | num_of_term vs (@{term "- numeral :: _ \<Rightarrow> real"} $ t') =
  5573       mk_C (~ (HOLogic.dest_num t'))
  5574       mk_C (~ (HOLogic.dest_num t'))
  5574   | num_of_term vs t = error ("num_of_term: unknown term " ^ Syntax.string_of_term @{context} t);
  5575   | num_of_term vs t = error ("num_of_term: unknown term " ^ Syntax.string_of_term @{context} t);
  5575 
  5576 
  5576 fun fm_of_term vs @{term True} = @{code T}
  5577 fun fm_of_term vs @{term True} = @{code T}
  5577   | fm_of_term vs @{term False} = @{code F}
  5578   | fm_of_term vs @{term False} = @{code F}
  5581       @{code Le} (@{code Sub} (num_of_term vs t1, num_of_term vs t2))
  5582       @{code Le} (@{code Sub} (num_of_term vs t1, num_of_term vs t2))
  5582   | fm_of_term vs (@{term "op = :: real \<Rightarrow> real \<Rightarrow> bool"} $ t1 $ t2) =
  5583   | fm_of_term vs (@{term "op = :: real \<Rightarrow> real \<Rightarrow> bool"} $ t1 $ t2) =
  5583       @{code Eq} (@{code Sub} (num_of_term vs t1, num_of_term vs t2)) 
  5584       @{code Eq} (@{code Sub} (num_of_term vs t1, num_of_term vs t2)) 
  5584   | fm_of_term vs (@{term "op rdvd"} $ (@{term "real :: int \<Rightarrow> real"} $ (@{term "numeral :: _ \<Rightarrow> int"} $ t1)) $ t2) =
  5585   | fm_of_term vs (@{term "op rdvd"} $ (@{term "real :: int \<Rightarrow> real"} $ (@{term "numeral :: _ \<Rightarrow> int"} $ t1)) $ t2) =
  5585       mk_Dvd (HOLogic.dest_num t1, num_of_term vs t2)
  5586       mk_Dvd (HOLogic.dest_num t1, num_of_term vs t2)
  5586   | fm_of_term vs (@{term "op rdvd"} $ (@{term "real :: int \<Rightarrow> real"} $ (@{term "neg_numeral :: _ \<Rightarrow> int"} $ t1)) $ t2) =
  5587   | fm_of_term vs (@{term "op rdvd"} $ (@{term "real :: int \<Rightarrow> real"} $ (@{term "- numeral :: _ \<Rightarrow> int"} $ t1)) $ t2) =
  5587       mk_Dvd (~ (HOLogic.dest_num t1), num_of_term vs t2)
  5588       mk_Dvd (~ (HOLogic.dest_num t1), num_of_term vs t2)
  5588   | fm_of_term vs (@{term "op = :: bool \<Rightarrow> bool \<Rightarrow> bool"} $ t1 $ t2) =
  5589   | fm_of_term vs (@{term "op = :: bool \<Rightarrow> bool \<Rightarrow> bool"} $ t1 $ t2) =
  5589       @{code Iff} (fm_of_term vs t1, fm_of_term vs t2)
  5590       @{code Iff} (fm_of_term vs t1, fm_of_term vs t2)
  5590   | fm_of_term vs (@{term HOL.conj} $ t1 $ t2) =
  5591   | fm_of_term vs (@{term HOL.conj} $ t1 $ t2) =
  5591       @{code And} (fm_of_term vs t1, fm_of_term vs t2)
  5592       @{code And} (fm_of_term vs t1, fm_of_term vs t2)