伊莎贝尔:关于多项式的这个引理只能用于成语

时间:2014-02-03 22:23:22

标签: polynomial-math isabelle

简而言之:我只有计算机科学的背景,而不是数学。我已经在伊莎贝尔身上证明了偶像的一个引理,并得出结论:无法证明环'a::comm_ring_1 poly的多项式。但我不完全确定。

在Isabelle图书馆中,有以下问题:

Polynomial.coeff_mult_degree_sum:
    coeff (p * q) (degree p + degree q) = coeff p (degree p) * coeff q (degree q)

(其中(p∷?'a∷comm_semiring_0 poly)(q∷?'a∷comm_semiring_0 poly);引理来自HOL/Library/Polynomial.thy

我已经在Isabelle(产品/多项式之和)中证明了以下引理:

lemma coeff_mult_setprod_setsum:
fixes S :: "'b::idom poly set"
shows "finite S ⟹ coeff (setprod (λx. x) S) (setsum (λx. degree x) S) = setprod (λ x. coeff x (degree x)) S"
by (induct rule: finite_induct, simp, simp_all add: coeff_setprod_setsum_induct_step)  

我的问题:
上述引理是否需要idom(即没有零除数)并且S :: "'a::comm_ring_1 poly set"无法证明?

..
..
以下是完整的证据:

(* tested with Isabelle2013-2  *)
theory Notepad
imports
  Main
  "~~/src/HOL/Library/Polynomial"
begin

lemma degree_product_setsum:
  fixes S :: "('a::comm_ring_1) poly set"
  assumes "finite S"
  shows "degree (∏S) ≤ setsum degree S" 
using `finite S`
proof-
  (* Sledgehammer proof *)
  have th1: "⋀x⇩1 x⇩2 x⇩3. degree ((x⇩1∷'a poly) * x⇩2) ≤ degree x⇩1 + x⇩3 ∨ ¬ degree x⇩2 ≤ x⇩3" 
  by (metis add_le_cancel_right degree_mult_le dual_order.trans nat_add_commute) 
  show ?thesis using `finite S`
    apply(induct)
    apply(simp)
    by (metis (full_types) th1 setprod.insert setsum.insert)
qed

lemma coeff_setprod_setsum_induct_step:
fixes x :: "'b::idom poly" and   F :: "'b::idom poly set"
assumes a1: "finite F"
and a2: "x ∉ F"
and a3: "coeff (∏F) (setsum degree F) = (∏x∷'b poly∈F. coeff x (degree x))"
shows "coeff (x * ∏F) (degree x + setsum degree F) = coeff x (degree x) * (∏x∈F. coeff x (degree x))"
proof-

from coeff_mult_degree_sum[of x "∏F"]
have 1: "coeff (x * ∏F) (degree x + degree (∏F)) = coeff x (degree x) * coeff (∏F) (degree (∏F))" by fast

from a1
have 3: "degree (∏F) ≤ setsum degree F" using degree_product_setsum by fast

(** BEWARE SLEDGEHAMMER PROOF! (don't care at the moment about it) *)
show ?thesis
proof -
  have "(∏R∈F. coeff R (degree R)) = 0 ∨ setsum degree F ≤ degree (∏F)"
    by (metis a3 le_degree)
  hence f1: "setsum degree F = degree (∏F) ∨ (∏R∈F. coeff R (degree R)) = 0"
    by (metis "3" le_antisym)
  have f2: "setsum degree F = degree (∏F) ∨ ¬ setsum degree F ≤ degree (∏F)"
    by (metis "3" le_antisym)
  hence "coeff (∏F) (degree (∏F)) = (∏R∈F. coeff R (degree R)) ⟶ coeff x (degree x) * (∏R∈F. coeff R (degree R)) = coeff (x * ∏F) (degree (x * ∏F))"
  by (metis (full_types) "1" degree_mult_eq leading_coeff_0_iff mult_eq_0_iff)
  moreover
  { assume "coeff (∏F) (degree (∏F)) ≠ (∏R∈F. coeff R (degree R))"
    hence "setsum degree F ≠ degree (∏F)"
      using a3 by force }
  moreover
  { assume "coeff x (degree x) * (∏R∈F. coeff R (degree R)) = coeff (x * ∏F) (degree (x * ∏F))"
    hence "setsum degree F = degree (∏F) ⟶ coeff (x * ∏F) (degree x + setsum degree F) = coeff x (degree x) * (∏R∈F. coeff R (degree R))"
by (metis (lifting, no_types) "1" calculation(2))}
  ultimately have "setsum degree F = degree (∏F) ⟶ coeff (x * ∏F) (degree x + setsum degree F) = coeff x (degree x) * (∏R∈F. coeff R (degree R))"
    by fastforce
  hence "setsum degree F ≠ degree (∏F) ∧ ¬ degree x + setsum degree F ≤ degree x + degree (∏F) ∨ coeff (x * ∏F) (degree x + setsum degree F) = coeff x (degree x) * (∏R∈F. coeff R (degree R))"
    using f2 add_le_cancel_left by blast
  hence "setsum degree F ≠ degree (∏F) ∧ coeff (x * ∏F) (degree x + setsum degree F) = 0 ∨ coeff (x * ∏F) (degree x + setsum degree F) = coeff x (degree x) * (∏R∈F. coeff R (degree R))"
by (metis (full_types) coeff_0 degree_mult_eq le_degree mult_eq_0_iff)
  thus "coeff (x * ∏F) (degree x + setsum degree F) = coeff x (degree x) * (∏x∈F. coeff x (degree x))"
    using f1 by force
qed
qed

lemma coeff_setprod_setsum:
fixes S :: "'b::idom poly set" (* lemma is not true for S :: "'a::comm_ring_1 poly set"*)
shows "finite S ⟹ coeff (setprod (λx. x) S) (setsum (λx. degree x) S) = setprod (λ x. coeff x (degree x)) S"
by (induct rule: finite_induct, simp, simp_all add: coeff_setprod_setsum_induct_step)

查看三个多项式,问题是可见的:

notepad
begin
 fix p q r :: "'a::comm_ring_1 poly"
 have "coeff (p * q * r) (degree (p * q) + degree r) = coeff (p * q) (degree (p * q)) * coeff r (degree r)"
using Polynomial.coeff_mult_degree_sum[of "p * q" r]  by fast
end

但是,对于degree (p * q)类型,degree p + degree q不等于'a::comm_ring_1 poly是不可能的。

考虑这个需要idom的引理:

Polynomial.degree_mult_eq: (?p∷?'a∷idom poly) ≠ (0∷?'a∷idom poly) ⟹ (?q∷?'a∷idom poly) ≠ (0∷?'a∷idom poly) ⟹ 
degree (?p * ?q) = degree ?p + degree ?q

..
..
..

Brian Huffman的解决方案

lemma degree_setprod_le: "degree (∏i∈S. f i) ≤ (∑i∈S. degree (f i))"
apply(cases "finite S", simp_all, induct rule: finite_induct, simp_all)
by (metis (lifting) degree_mult_le dual_order.trans nat_add_left_cancel_le)

lemma coeff_mult_sum: "degree p ≤ m ⟹ degree q ≤ n ⟹ coeff (p * q) (m + n) = coeff p m * coeff q n"
apply(cases "degree p = m ∧ degree q = n")
apply(insert coeff_mult_degree_sum[of p q], simp) [1]
apply(cases "degree p < m", cases "degree q < n")
by(insert coeff_eq_0[of q n] coeff_eq_0[of p m] degree_mult_le[of p q] coeff_eq_0[of "p*q" "m + n"], simp_all)

lemma coeff_mult_setprod_setsum:
"coeff (setprod (λx. x) S) (setsum (λx. degree x) S) = setprod (λ x. coeff x (degree x)) S"
by(cases "finite S", induct rule: finite_induct, simp_all add: coeff_mult_sum degree_setprod_le)

2 个答案:

答案 0 :(得分:3)

是的,您的引理coeff_mult_setprod_setsum实际上可以证明任意comm_ring_1类型。它在没有idom类约束的情况下工作的原因是你实际上从未计算多项式乘法结果的程度,你只使用因子的度数。

我能够通过S使用以下两个引理进行归纳来证明这一点:

lemma degree_setprod_le: "degree (∏i∈S. f i) ≤ (∑i∈S. degree (f i))"根据S是否有限,然后在S上归纳,并使用库引理degree_mult_le来解决归纳步骤的证明。

lemma coeff_mult_sum: "degree p ≤ m ⟹ degree q ≤ n ⟹ coeff (p * q) (m + n) = coeff p m * coeff q n"通过案例分析证明degree p < mdegree p = m(类似于qn)。在不足的情况下,图书馆引理coeff_eq_0表明双方都是零;最后的案例来自图书馆引理coeff_mult_degree_sum

答案 1 :(得分:2)

问题很简单,如果你没有一个积分域,当乘以两个多项式时系数可能变为零,实际上,即使整个多项式也可以变为零。例如,考虑交换环ℤ/4ℤ,即整数模4.然后多项式2X具有1阶,但2X·2X =4X²= 0具有度-∞(或0,由Isabelle惯例)。

你需要这样的事实,即没有零除数。

在相关的说明中:它被称为“idom”,用于“整体域”,而不是“ideom”。