多项式的次数小于一个数

时间:2013-09-12 21:19:25

标签: polynomial-math isabelle theorem-proving

我正在研究一个引理,它表明如果每个单项式的指数小于或等于n,则单项式的和的程度总是小于或等于n

lemma degree_poly_smaller:
  fixes a :: "('a::comm_ring_1 poly)" and n::nat
  shows "degree (∑x∷nat | x ≤ n . monom (coeff a x) x) ≤ n"
sorry

到目前为止我所要做的是以下内容(请注意我是Isabelle的初学者):

lemma degree_smaller:
  fixes a :: "('a::comm_ring_1 poly)" and n::nat
  shows "degree (∑x∷nat | x ≤ n . monom (coeff a x) x) ≤ n"
proof-

 have th01: "⋀k. k ≤ n ⟹ 
             degree (setsum (λ x . monom (coeff a x) k) {x∷nat. x ≤ n})  ≤ n" 
                    by (metis degree_monom_le monom_setsum order_trans)

 have min_lemma1: "k∈{x∷nat. x ≤ n} ⟹ k ≤ n" by simp

 from this th01 have th02: 
     "⋀k. k∈{x∷nat. x ≤ n} ⟹ 
     degree (setsum (λ x . monom (coeff a x) k) {x∷nat. x ≤ n})  ≤ n" 
                                             by (metis mem_Collect_eq)

 have min_lemma2: "(SOME y . y ≤ n) ≤ n" by (metis (full_types) le0 some_eq_ex)

 from this have th03: 
     "degree (∑x∷nat | x ≤ n . monom (coeff a x) (SOME y . y ≤ n)) ≤ n" 
                                                         by (metis th01)

 from min_lemma1 min_lemma2 have min_lemma3: 
     "(SOME y . y∈{x∷nat. x ≤ n}) ≤ n" by (metis (full_types) mem_Collect_eq some_eq_ex)

 from this th01 th02 th03 have th04: 
     "degree (∑x∷nat | x ≤ n . monom (coeff a x) (SOME y . y∈{x∷nat. x ≤ n}) ) ≤ n" 
                                                                      by presburger

这是问题,我不明白为什么下面的引理不足以完成证明。特别是,我希望最后一部分(抱歉的地方)足够简单,以便大锤找到证据:

 from this th01 th02 th03 th04  have th05: 
 "degree 
  (setsum (λ i . monom (coeff a i) (SOME y . y∈{x∷nat. x ≤ n})) {x∷nat. x ≤ n})
   ≤ n"
        by linarith

  (* how can I prove this last step ? *)
  from this have 
    "degree (setsum (λ i . monom (coeff a i) i) {x∷nat. x ≤ n}) ≤ n" sorry 

  from this show ?thesis by auto
qed


来自Brian Huffman的优秀答案解决方案

lemma degree_setsum_smaller:
  "finite A ⟹ ∀x∈A. degree (f x) ≤ n ⟹ degree (∑x∈A. f x) ≤ n"
apply(induct rule: finite_induct)
apply(auto)
by (metis degree_add_le)

lemma finiteSetSmallerThanNumber: 
   "finite {x∷nat. x ≤ n}" 
by (metis finite_Collect_le_nat)

lemma degree_smaller:
  fixes a :: "('a::comm_ring_1 poly)" and n::nat
  shows "degree (∑x∷nat | x ≤ n . monom (coeff a x) x) ≤ n"
apply (rule degree_setsum_smaller)
apply(simp add: finiteSetSmallerThanNumber)
by (metis degree_0 degree_monom_eq le0 mem_Collect_eq monom_eq_0_iff) (* from sledgehammer *)

2 个答案:

答案 0 :(得分:3)

最后一步没有从th05开始。问题是您似乎想要将(SOME y. y∈{x∷nat. x ≤ n})与绑定变量i统一起来。但是,在HOL (SOME y. y∈{x∷nat. x ≤ n})中,只有n而不是i的单个值。此外,你无法选择价值;使用SOME的定理与具有普遍量化变量的定理不同。

我的建议是完全避免使用SOME,而是首先尝试证明你的定理的推广:

lemma degree_setsum_smaller:
  "finite A ⟹ ∀x∈A. degree (f x) ≤ n ⟹ degree (∑x∈A. f x) ≤ n"

您应该能够通过degree_setsum_smaller(使用A)的归纳来证明induct rule: finite_induct,然后使用它来证明degree_poly_smaller。多项式库中的引理degree_add_le应该是有用的。

答案 1 :(得分:1)

除了应用脚本中的最后一个方法之外,使用auto作为其他任何东西通常被认为是不好的样式,因为这样的证明往往非常脆弱。我会彻底消除“finiteSetSmallerThanNumber”引理,它是Collect_le_nat的一个不必要的特殊情况。此外,Isabelle通常不使用定理的骆驼案例名称。

无论如何,这是我对如何使证明更好的建议:

lemma degree_setsum_smaller:
  "finite A ⟹ ∀x∈A. degree (f x) ≤ n ⟹ degree (∑x∈A. f x) ≤ n"
by (induct rule: finite_induct, simp_all add: degree_add_le)

lemma degree_smaller:
  fixes a :: "('a::comm_ring_1 poly)" and n::nat
  shows "degree (∑x∷nat | x ≤ n . monom (coeff a x) x) ≤ n"
proof (rule degree_setsum_smaller)
  show "finite {x. x ≤ n}" using finite_Collect_le_nat .
  {
    fix x assume "x ≤ n"
    hence "degree (monom (coeff a x) x) ≤ n"
        by (cases "coeff a x = 0", simp_all add: degree_monom_eq)
  }
  thus "∀x∈{x. x≤ n}. degree (monom (coeff a x) x) ≤ n" by simp
qed