src/HOL/Library/Sum_of_Squares/positivstellensatz.ML
changeset 74282 c2ee8d993d6a
parent 70333 0f7edf0853df
child 74290 b2ad24b5a42c
equal deleted inserted replaced
74281:7829d6435c60 74282:c2ee8d993d6a
   474     val dest_eq = dest_binary \<^cterm>\<open>(=) :: real \<Rightarrow> _\<close>
   474     val dest_eq = dest_binary \<^cterm>\<open>(=) :: real \<Rightarrow> _\<close>
   475     val neq_th = nth pth 5
   475     val neq_th = nth pth 5
   476     fun real_not_eq_conv ct =
   476     fun real_not_eq_conv ct =
   477       let
   477       let
   478         val (l,r) = dest_eq (Thm.dest_arg ct)
   478         val (l,r) = dest_eq (Thm.dest_arg ct)
   479         val th = Thm.instantiate ([],[((("x", 0), \<^typ>\<open>real\<close>),l),((("y", 0), \<^typ>\<open>real\<close>),r)]) neq_th
   479         val th = Thm.instantiate (TVars.empty, Vars.make [((("x", 0), \<^typ>\<open>real\<close>),l),((("y", 0), \<^typ>\<open>real\<close>),r)]) neq_th
   480         val th_p = poly_conv(Thm.dest_arg(Thm.dest_arg1(Thm.rhs_of th)))
   480         val th_p = poly_conv(Thm.dest_arg(Thm.dest_arg1(Thm.rhs_of th)))
   481         val th_x = Drule.arg_cong_rule \<^cterm>\<open>uminus :: real \<Rightarrow> _\<close> th_p
   481         val th_x = Drule.arg_cong_rule \<^cterm>\<open>uminus :: real \<Rightarrow> _\<close> th_p
   482         val th_n = fconv_rule (arg_conv poly_neg_conv) th_x
   482         val th_n = fconv_rule (arg_conv poly_neg_conv) th_x
   483         val th' = Drule.binop_cong_rule \<^cterm>\<open>HOL.disj\<close>
   483         val th' = Drule.binop_cong_rule \<^cterm>\<open>HOL.disj\<close>
   484           (Drule.arg_cong_rule (Thm.apply \<^cterm>\<open>(<)::real \<Rightarrow> _\<close> \<^cterm>\<open>0::real\<close>) th_p)
   484           (Drule.arg_cong_rule (Thm.apply \<^cterm>\<open>(<)::real \<Rightarrow> _\<close> \<^cterm>\<open>0::real\<close>) th_p)
   738                      (Thm.transitive th0 (c p ax))
   738                      (Thm.transitive th0 (c p ax))
   739         end
   739         end
   740 
   740 
   741       val elim_abs = eliminate_construct is_abs
   741       val elim_abs = eliminate_construct is_abs
   742         (fn p => fn ax =>
   742         (fn p => fn ax =>
   743           Thm.instantiate ([], [(p_v,p), (x_v, Thm.dest_arg ax)]) pth_abs)
   743           Thm.instantiate (TVars.empty, Vars.make [(p_v,p), (x_v, Thm.dest_arg ax)]) pth_abs)
   744       val elim_max = eliminate_construct is_max
   744       val elim_max = eliminate_construct is_max
   745         (fn p => fn ax =>
   745         (fn p => fn ax =>
   746           let val (ax,y) = Thm.dest_comb ax
   746           let val (ax,y) = Thm.dest_comb ax
   747           in Thm.instantiate ([], [(p_v,p), (x_v, Thm.dest_arg ax), (y_v,y)])
   747           in Thm.instantiate (TVars.empty, Vars.make [(p_v,p), (x_v, Thm.dest_arg ax), (y_v,y)])
   748                              pth_max end)
   748                              pth_max end)
   749       val elim_min = eliminate_construct is_min
   749       val elim_min = eliminate_construct is_min
   750         (fn p => fn ax =>
   750         (fn p => fn ax =>
   751           let val (ax,y) = Thm.dest_comb ax
   751           let val (ax,y) = Thm.dest_comb ax
   752           in Thm.instantiate ([], [(p_v,p), (x_v, Thm.dest_arg ax), (y_v,y)])
   752           in Thm.instantiate (TVars.empty, Vars.make [(p_v,p), (x_v, Thm.dest_arg ax), (y_v,y)])
   753                              pth_min end)
   753                              pth_min end)
   754     in first_conv [elim_abs, elim_max, elim_min, all_conv]
   754     in first_conv [elim_abs, elim_max, elim_min, all_conv]
   755     end;
   755     end;
   756 in
   756 in
   757 fun gen_real_arith ctxt (mkconst,eq,ge,gt,norm,neg,add,mul,prover) =
   757 fun gen_real_arith ctxt (mkconst,eq,ge,gt,norm,neg,add,mul,prover) =