Search code examples
isabelle

Fix a field with characteristic different from 2 in Isabelle


I did a proof for elliptic curves taking as a base field the reals.

Now I want to change the reals by an arbitrary field which has characteristic different from 2, so that from the equation 2x = 0 one can deduce that x = 0.

How does one phrase this in a proof assistant like Isabelle?


Solution

  • In essence, you can use

    class ell_field = field +
      assumes zero_ne_two: "2 ≠ 0"
    

    For example, see The Group Law for Elliptic Curves by Stefan Berghofer.


    I assume that you wish to work with the class field from the main library of the object logic HOL. Unfortunately, I am not aware of a general treatment of the ring characteristics in the aforementioned library (hopefully, if it does exist, someone will point it out for us). Therefore, I devised my own definitional framework to give this answer a context:

    context semiring_1
    begin
    
    definition characteristic :: "'a itself ⇒ nat" where
      "characteristic a = 
        (if (∃n. n ≥ 1 ∧ of_nat n = 0) 
        then (LEAST n. n ≥ 1 ∧ of_nat n = 0) 
        else 0)"
    
    end
    
    class ell_field = field +
      assumes zero_ne_two: "2 ≠ 0"
    begin
    
    lemma x2: "2 * x = 0 ⟹ x = 0"
      by (simp add: zero_ne_two)
    
    lemma "characteristic TYPE('a) ≠ 2"
    proof(rule ccontr, simp)
      assume c2: "characteristic TYPE('a) = 2"
      define P where "P = (λn. (n ≥ 1 ∧ of_nat n = 0))" 
      from c2 have ex: "∃n. P n" 
        unfolding P_def characteristic_def by presburger
      with c2 have least_2: "(LEAST n. P n) = 2"
        unfolding characteristic_def P_def by auto
      from LeastI2_ex[OF ex, of P] have "P (LEAST n. P n)" by simp
      then have "2 = 0" unfolding least_2 unfolding P_def by simp
      with zero_ne_two show False by simp
    qed
    
    end