src/HOL/Library/normarith.ML
changeset 33035 15eab423e573
parent 32934 a1b6e8d281ce
child 33039 5018f6a76b3f
equal deleted inserted replaced
33034:66ef64a5f122 33035:15eab423e573
   165 fun inequality_canon_rule ctxt = 
   165 fun inequality_canon_rule ctxt = 
   166  let 
   166  let 
   167   (* FIXME : Should be computed statically!! *)
   167   (* FIXME : Should be computed statically!! *)
   168   val real_poly_conv = 
   168   val real_poly_conv = 
   169     Normalizer.semiring_normalize_wrapper ctxt
   169     Normalizer.semiring_normalize_wrapper ctxt
   170      (valOf (NormalizerData.match ctxt @{cterm "(0::real) + 1"}))
   170      (the (NormalizerData.match ctxt @{cterm "(0::real) + 1"}))
   171  in fconv_rule (arg_conv ((rewr_conv @{thm ge_iff_diff_ge_0}) then_conv arg_conv (field_comp_conv then_conv real_poly_conv)))
   171  in fconv_rule (arg_conv ((rewr_conv @{thm ge_iff_diff_ge_0}) then_conv arg_conv (field_comp_conv then_conv real_poly_conv)))
   172 end;
   172 end;
   173 
   173 
   174  fun absc cv ct = case term_of ct of 
   174  fun absc cv ct = case term_of ct of 
   175  Abs (v,_, _) => 
   175  Abs (v,_, _) => 
   276  fun real_vector_combo_prover ctxt translator (nubs,ges,gts) = 
   276  fun real_vector_combo_prover ctxt translator (nubs,ges,gts) = 
   277   let 
   277   let 
   278    (* FIXME: Should be computed statically!!*)
   278    (* FIXME: Should be computed statically!!*)
   279    val real_poly_conv = 
   279    val real_poly_conv = 
   280       Normalizer.semiring_normalize_wrapper ctxt
   280       Normalizer.semiring_normalize_wrapper ctxt
   281        (valOf (NormalizerData.match ctxt @{cterm "(0::real) + 1"}))
   281        (the (NormalizerData.match ctxt @{cterm "(0::real) + 1"}))
   282    val sources = map (Thm.dest_arg o Thm.dest_arg1 o concl) nubs
   282    val sources = map (Thm.dest_arg o Thm.dest_arg1 o concl) nubs
   283    val rawdests = fold_rev (find_normedterms o Thm.dest_arg o concl) (ges @ gts) [] 
   283    val rawdests = fold_rev (find_normedterms o Thm.dest_arg o concl) (ges @ gts) [] 
   284    val _ = if not (forall fst rawdests) then error "real_vector_combo_prover: Sanity check" 
   284    val _ = if not (forall fst rawdests) then error "real_vector_combo_prover: Sanity check" 
   285            else ()
   285            else ()
   286    val dests = distinct (op aconvc) (map snd rawdests)
   286    val dests = distinct (op aconvc) (map snd rawdests)
   382   (* FIXME: Lookup in the context every time!!! Fix this !!!*)
   382   (* FIXME: Lookup in the context every time!!! Fix this !!!*)
   383  fun splitequation ctxt th acc =
   383  fun splitequation ctxt th acc =
   384   let 
   384   let 
   385    val real_poly_neg_conv = #neg
   385    val real_poly_neg_conv = #neg
   386        (Normalizer.semiring_normalizers_ord_wrapper ctxt
   386        (Normalizer.semiring_normalizers_ord_wrapper ctxt
   387         (valOf (NormalizerData.match ctxt @{cterm "(0::real) + 1"})) simple_cterm_ord)
   387         (the (NormalizerData.match ctxt @{cterm "(0::real) + 1"})) simple_cterm_ord)
   388    val (th1,th2) = conj_pair(rawrule th)
   388    val (th1,th2) = conj_pair(rawrule th)
   389   in th1::fconv_rule (arg_conv (arg_conv real_poly_neg_conv)) th2::acc
   389   in th1::fconv_rule (arg_conv (arg_conv real_poly_neg_conv)) th2::acc
   390   end
   390   end
   391 in fun real_vector_prover ctxt _ translator (eqs,ges,gts) =
   391 in fun real_vector_prover ctxt _ translator (eqs,ges,gts) =
   392      (real_vector_ineq_prover ctxt translator
   392      (real_vector_ineq_prover ctxt translator