371 by (metis cong_mult_lcancel_int) |
371 by (metis cong_mult_lcancel_int) |
372 then show ?thesis |
372 then show ?thesis |
373 by (simp add: A_card_eq cong_sym_int) |
373 by (simp add: A_card_eq cong_sym_int) |
374 qed |
374 qed |
375 |
375 |
376 (*NOT WORKING. Old_Number_Theory/Euler.thy needs to be translated, but it's |
|
377 quite a mess and should better be completely redone. |
|
378 |
|
379 theorem gauss_lemma: "(Legendre a p) = (-1) ^ (card E)" |
376 theorem gauss_lemma: "(Legendre a p) = (-1) ^ (card E)" |
380 proof - |
377 proof - |
381 from Euler_Criterion p_prime p_ge_2 have |
378 from euler_criterion p_prime p_ge_2 have |
382 "[(Legendre a p) = a^(nat (((p) - 1) div 2))] (mod p)" |
379 "[(Legendre a p) = a^(nat (((p) - 1) div 2))] (mod p)" |
383 by auto |
380 by auto |
|
381 moreover have "int ((p - 1) div 2) =(int p - 1) div 2" using p_eq2 by linarith |
|
382 hence "[a ^ nat (int ((p - 1) div 2)) = a ^ nat ((int p - 1) div 2)] (mod int p)" by force |
384 moreover note pre_gauss_lemma |
383 moreover note pre_gauss_lemma |
385 ultimately have "[(Legendre a p) = (-1) ^ (card E)] (mod p)" |
384 ultimately have "[(Legendre a p) = (-1) ^ (card E)] (mod p)" using cong_trans_int by blast |
386 by (rule cong_trans_int) |
|
387 moreover from p_a_relprime have "(Legendre a p) = 1 | (Legendre a p) = (-1)" |
385 moreover from p_a_relprime have "(Legendre a p) = 1 | (Legendre a p) = (-1)" |
388 by (auto simp add: Legendre_def) |
386 by (auto simp add: Legendre_def) |
389 moreover have "(-1::int) ^ (card E) = 1 | (-1::int) ^ (card E) = -1" |
387 moreover have "(-1::int) ^ (card E) = 1 | (-1::int) ^ (card E) = -1" |
390 by (rule neg_one_power) |
388 using neg_one_even_power neg_one_odd_power by blast |
|
389 moreover have "[1 \<noteq> - 1] (mod int p)" |
|
390 using cong_altdef_int nonzero_mod_p[of 2] p_odd_int by fastforce |
391 ultimately show ?thesis |
391 ultimately show ?thesis |
392 by (auto simp add: p_ge_2 one_not_neg_one_mod_m zcong_sym) |
392 by (auto simp add: cong_sym_int) |
393 qed |
393 qed |
394 *) |
|
395 |
394 |
396 end |
395 end |
397 |
396 |
398 end |
397 end |