Mathlib v3 is deprecated. Go to Mathlib v4

Commit 2020-04-24 23:37 e918f726

View on Github →

refactor(zmod): merge zmodp into zmod, use [fact p.prime] for tc search (#2511) This PR introduces the class fact P := P for P : Prop, which is a way to inject elementary propositions into the type class system. This desing is inspired by @cipher1024 's https://gist.github.com/cipher1024/9bd785a75384a4870b331714ec86ad6f#file-zmod_redesign-lean. We use this to endow zmod p with a field instance under the assumption [fact p.prime]. As a consequence, the type zmodp is no longer needed, which removes a lot of duplicate code. Besides that, we redefine zmod n, so that n is a natural number instead of a positive natural number, and zmod 0 is now definitionally the integers. To preserve computational properties, zmod n is not defined as quotient type, but rather as int and fin n, depending on whether n is 0 or (k+1). The rest of this PR is adapting the library to the new definitions (most notably quadratic reciprocity and Lagrange's four squares theorem). Future work: Refactor the padics to use [fact p.prime] instead of making nat.prime a class in those files. This will address #1601 and #1648. Once that is done, we can clean up the mess in char_p (where the imports are really tangled) and finally get some movement in #1564.

Estimated changes

added def fin.comm_ring
added def fin.has_neg
added theorem fin.of_nat_eq_coe
added theorem fin.one_val
added theorem fin.val_add
added theorem fin.val_mul
added theorem fin.zero_val
deleted theorem zmod.add_val
added theorem zmod.card
deleted theorem zmod.card_zmod
modified def zmod.cast
added theorem zmod.cast_add
added def zmod.cast_hom
added theorem zmod.cast_hom_apply
added theorem zmod.cast_id
added theorem zmod.cast_int_cast
deleted theorem zmod.cast_mod_int'
deleted theorem zmod.cast_mod_int
deleted theorem zmod.cast_mod_nat'
modified theorem zmod.cast_mod_nat
added theorem zmod.cast_mul
added theorem zmod.cast_nat_cast
added theorem zmod.cast_one
added theorem zmod.cast_self'
added theorem zmod.cast_self
deleted theorem zmod.cast_self_eq_zero
modified theorem zmod.cast_unit_of_coprime
modified theorem zmod.cast_val
deleted theorem zmod.cast_val_cast_of_dvd
added theorem zmod.cast_zero
deleted theorem zmod.coe_val_cast_int
modified theorem zmod.coe_val_min_abs
deleted theorem zmod.eq_iff_modeq_int'
deleted theorem zmod.eq_iff_modeq_int
deleted theorem zmod.eq_iff_modeq_nat'
modified theorem zmod.eq_iff_modeq_nat
deleted theorem zmod.eq_zero_iff_dvd_int
deleted theorem zmod.eq_zero_iff_dvd_nat
added def zmod.inv
added theorem zmod.inv_coe_unit
added theorem zmod.inv_mul_of_unit
added theorem zmod.inv_zero
modified theorem zmod.le_div_two_iff_lt_neg
deleted theorem zmod.mk_eq_cast
added theorem zmod.mul_inv_eq_gcd
added theorem zmod.mul_inv_of_unit
deleted theorem zmod.mul_val
modified theorem zmod.nat_abs_val_min_abs_le
added theorem zmod.nat_cast_val
modified theorem zmod.ne_neg_self
modified theorem zmod.neg_eq_self_mod_two
added theorem zmod.neg_one_ne_one
modified theorem zmod.neg_val'
modified theorem zmod.neg_val
deleted theorem zmod.one_val
added theorem zmod.prime_ne_zero
modified def zmod.unit_of_coprime
added def zmod.val
added theorem zmod.val_add
deleted theorem zmod.val_cast_int
modified theorem zmod.val_cast_nat
modified theorem zmod.val_cast_of_lt
modified theorem zmod.val_eq_ite_val_min_abs
added theorem zmod.val_eq_zero
added theorem zmod.val_injective
added theorem zmod.val_lt
modified def zmod.val_min_abs
modified theorem zmod.val_min_abs_eq_zero
modified theorem zmod.val_min_abs_zero
added theorem zmod.val_mul
added theorem zmod.val_one
added theorem zmod.val_zero
deleted theorem zmod.zero_val
modified def zmod
deleted theorem zmodp.add_val
deleted theorem zmodp.card_zmodp
deleted theorem zmodp.cast_mod_int
deleted theorem zmodp.cast_mod_nat
deleted theorem zmodp.cast_self_eq_zero:
deleted theorem zmodp.cast_val
deleted theorem zmodp.coe_val_cast_int
deleted theorem zmodp.coe_val_min_abs
deleted theorem zmodp.eq_iff_modeq_int
deleted theorem zmodp.eq_iff_modeq_nat
deleted theorem zmodp.eq_zero_iff_dvd_int
deleted theorem zmodp.eq_zero_iff_dvd_nat
deleted theorem zmodp.mk_eq_cast
deleted theorem zmodp.mul_inv_eq_gcd
deleted theorem zmodp.mul_val
deleted theorem zmodp.ne_neg_self
deleted theorem zmodp.one_val
deleted theorem zmodp.prime_ne_zero
deleted theorem zmodp.val_cast_int
deleted theorem zmodp.val_cast_nat
deleted theorem zmodp.val_cast_of_lt
deleted def zmodp.val_min_abs
deleted theorem zmodp.val_min_abs_eq_zero
deleted theorem zmodp.val_min_abs_zero
deleted theorem zmodp.zero_val
deleted def zmodp
added theorem zmod.card_units
added theorem zmod.eisenstein_lemma
added theorem zmod.euler_criterion
added theorem zmod.fermat_little
added theorem zmod.gauss_lemma
added theorem zmod.legendre_sym_two
added theorem zmod.wilsons_lemma
deleted theorem zmodp.card_units_zmodp
deleted theorem zmodp.eisenstein_lemma
deleted theorem zmodp.euler_criterion
deleted theorem zmodp.fermat_little
deleted theorem zmodp.gauss_lemma
deleted def zmodp.legendre_sym
deleted theorem zmodp.legendre_sym_eq_pow
deleted theorem zmodp.legendre_sym_two
deleted theorem zmodp.prod_Ico_one_prime
deleted theorem zmodp.wilsons_lemma