src/HOL/Algebra/poly/PolyHomo.ML
changeset 11093 62c2e0af1d30
parent 8707 5de763446504
child 11701 3d51fbf81c17
equal deleted inserted replaced
11092:69c1abb9a129 11093:62c2e0af1d30
    53 by (rtac CauchySum 2);
    53 by (rtac CauchySum 2);
    54 by (asm_simp_tac (simpset() addsimps [boundI, deg_aboveD]) 2);
    54 by (asm_simp_tac (simpset() addsimps [boundI, deg_aboveD]) 2);
    55 by (asm_simp_tac (simpset() addsimps [boundI, deg_aboveD]) 2);
    55 by (asm_simp_tac (simpset() addsimps [boundI, deg_aboveD]) 2);
    56 (* getting a^i and a^(k-i) together is difficult, so we do is manually *)
    56 (* getting a^i and a^(k-i) together is difficult, so we do is manually *)
    57 by (res_inst_tac [("s", 
    57 by (res_inst_tac [("s", 
    58 "        SUM (deg aa + deg b) \
    58 "        setsum  \
    59 \           (%k. SUM k \
    59 \           (%k. setsum \
    60 \                 (%i. phi (coeff i aa) * (phi (coeff (k - i) b) * \
    60 \                 (%i. phi (coeff i aa) * (phi (coeff (k - i) b) * \
    61 \                      (a ^ i * a ^ (k - i)))))")] trans 1);
    61 \                      (a ^ i * a ^ (k - i)))) {..k}) \
       
    62 \           {..deg aa + deg b}")] trans 1);
    62 by (asm_simp_tac (simpset()
    63 by (asm_simp_tac (simpset()
    63     addsimps [power_mult, leD RS add_diff_inverse, SUM_ldistr]) 1);
    64     addsimps [power_mult, leD RS add_diff_inverse, SUM_ldistr]) 1);
    64 by (simp_tac (simpset() addsimps m_ac) 1);
    65 by (simp_tac (simpset() addsimps m_ac) 1);
    65 by (simp_tac (simpset() addsimps m_ac) 1);
    66 by (simp_tac (simpset() addsimps m_ac) 1);
    66 (* <1> commutes *)
    67 (* <1> commutes *)
    70 Goalw [EVAL2_def]
    71 Goalw [EVAL2_def]
    71   "!! phi::'a::ring=>'b::ring. EVAL2 phi a (const b) = phi b";
    72   "!! phi::'a::ring=>'b::ring. EVAL2 phi a (const b) = phi b";
    72 by (Simp_tac 1);
    73 by (Simp_tac 1);
    73 qed "EVAL2_const";
    74 qed "EVAL2_const";
    74 
    75 
    75 (* This is probably redundant *)
       
    76 Goalw [EVAL2_def]
    76 Goalw [EVAL2_def]
    77   "!! phi::'a::ring=>'b::ring. homo phi ==> EVAL2 phi a (monom 1) = a";
    77   "!! phi::'a::domain=>'b::ring. homo phi ==> EVAL2 phi a (monom 1) = a";
       
    78 (* Must be able to distinguish 0 from <1>, hence 'a::domain *)
    78 by (Asm_simp_tac 1);
    79 by (Asm_simp_tac 1);
    79 qed "EVAL2_monom1";
    80 qed "EVAL2_monom1";
    80 
    81 
    81 Goalw [EVAL2_def]
    82 Goalw [EVAL2_def]
    82   "!! phi::'a::ring=>'b::ring. homo phi ==> EVAL2 phi a (monom n) = a ^ n";
    83   "!! phi::'a::domain=>'b::ring. homo phi ==> EVAL2 phi a (monom n) = a ^ n";
    83 by (Simp_tac 1);
    84 by (Simp_tac 1);
    84 by (case_tac "n" 1); 
    85 by (case_tac "n" 1); 
    85 by Auto_tac;
    86 by Auto_tac;
    86 qed "EVAL2_monom";
    87 qed "EVAL2_monom";
    87 
    88 
    98 
    99 
    99 Goalw [EVAL_def] "!! a::'a::ring. EVAL a (const b) = b";
   100 Goalw [EVAL_def] "!! a::'a::ring. EVAL a (const b) = b";
   100 by (asm_simp_tac (simpset() addsimps [EVAL2_const]) 1);
   101 by (asm_simp_tac (simpset() addsimps [EVAL2_const]) 1);
   101 qed "EVAL_const";
   102 qed "EVAL_const";
   102 
   103 
   103 Goalw [EVAL_def] "!! a::'a::ring. EVAL a (monom n) = a ^ n";
   104 Goalw [EVAL_def] "!! a::'a::domain. EVAL a (monom n) = a ^ n";
   104 by (asm_simp_tac (simpset() addsimps [EVAL2_monom]) 1);
   105 by (asm_simp_tac (simpset() addsimps [EVAL2_monom]) 1);
   105 qed "EVAL_monom";
   106 qed "EVAL_monom";
   106 
   107 
   107 Goalw [EVAL_def] "!! a::'a::ring. EVAL a (b *s p) = b * EVAL a p";
   108 Goalw [EVAL_def] "!! a::'a::ring. EVAL a (b *s p) = b * EVAL a p";
   108 by (asm_simp_tac (simpset() addsimps [EVAL2_smult]) 1);
   109 by (asm_simp_tac (simpset() addsimps [EVAL2_smult]) 1);
   109 qed "EVAL_smult";
   110 qed "EVAL_smult";
   110 
   111 
   111 (* Examples *)
   112 (* Examples *)
   112 
   113 
   113 Goal
   114 Goal
   114   "EVAL (x::'a::ring) (a*X^2 + b*X^1 + c*X^0) = a * x ^ 2 + b * x ^ 1 + c";
   115   "EVAL (x::'a::domain) (a*X^2 + b*X^1 + c*X^0) = a * x ^ 2 + b * x ^ 1 + c";
   115 by (asm_simp_tac (simpset() delsimps [power_Suc]
   116 by (asm_simp_tac (simpset() delsimps [power_Suc]
   116     addsimps [EVAL_homo, EVAL_monom, EVAL_smult]) 1);
   117     addsimps [EVAL_homo, EVAL_monom, EVAL_smult]) 1);
   117 result();
   118 result();
   118 
   119 
   119 Goal
   120 Goal
   120   "EVAL (y::'a::ring) \
   121   "EVAL (y::'a::domain) \
   121 \    (EVAL (const x) (monom 1 + const (a*X^2 + b*X^1 + c*X^0))) = \
   122 \    (EVAL (const x) (monom 1 + const (a*X^2 + b*X^1 + c*X^0))) = \
   122 \  x ^ 1 + (a * y ^ 2 + b * y ^ 1 + c)";
   123 \  x ^ 1 + (a * y ^ 2 + b * y ^ 1 + c)";
   123 by (asm_simp_tac (simpset() delsimps [power_Suc]
   124 by (asm_simp_tac (simpset() delsimps [power_Suc]
   124     addsimps [EVAL_homo, EVAL_monom, EVAL_smult, EVAL_const]) 1);
   125     addsimps [EVAL_homo, EVAL_monom, EVAL_smult, EVAL_const]) 1);
   125 result();
   126 result();