TS0003 · theorem body

sum_two_squares_mod_four_cases

Alpha v34 checked-use · independently kernel and Lean verified; not Stable

A sum of two natural squares has residue zero, one, or two modulo four.

Current library: Alpha v34, 4,223 checked-use theorems; Stable remains 432. Historical first admissions, original proof editions, and non-admitted aliases are preserved. Exact original first-admission records.

Statement with defined notation

∀ a. ∀ b. (∃ x. a · a + b · b = 4 · x + 0) ∨ Mod4One(a · a + b · b) ∨ (∃ x. a · a + b · b = 4 · x + 2)

Every purple notation token opens its conservative definition. This reading surface never changes the unchanged intuitionistic kernel or confers checked-use authority.

Definitions used by this theorem

In the theorem statement

In local proof propositions

Exact expanded first-order statement
forall a b. ((exists fts_four_sum_zero. a * a + b * b = 4 * fts_four_sum_zero + 0) \/ (exists fts_four_sum_one. a * a + b * b = 4 * fts_four_sum_one + 1)) \/ (exists fts_four_sum_two. a * a + b * b = 4 * fts_four_sum_two + 2)

Proof neighborhood

Direct theorem prerequisites

TS0002 square_mod_four_zero_or_one mul_add · Stable closed add_assoc · Stable closed add_comm · Stable closed

Direct theorem dependents

Definition-aware tactic body

Only propositions whose conservative expansion has been checked for exact first-order equivalence are compacted. Every changed line retains its immutable exact replay command.

Read the argument

Proof checkpoints

40 script commands · 15 reading checkpoints · 2 local claims

This is a reading aid, not a new proof or a proof-tree certificate. Checkpoint groups are consecutive commands, not inferred branch boundaries. Every step links to the preserved script.

Definition notation is shown below. Open the paired exact edition for the original native formulas. Source pairing is not a new equivalence certificate.

Named ingredients (1)
01Fix variables and assumptionsL1–2

Work with arbitrary variables or the premises of the current implication.

  1. L1
    intro a
  2. L2
    intro b
02Establish haL3–5

Establish this local claim before using it. It is not an additional assumption.

  1. L3
    have ha : (∃ x. a · a = 4 · x + 0) ∨ Mod4One(a · a)Definitions: Mod4One(a · a)Original native command in the exact edition
  2. L4
    specialize square_mod_four_zero_or_one a
  3. L5
    exact square_mod_four_zero_or_one
03Establish hbL6–8

Establish this local claim before using it. It is not an additional assumption.

  1. L6
    have hb : (∃ x. b · b = 4 · x + 0) ∨ Mod4One(b · b)Definitions: Mod4One(b · b)Original native command in the exact edition
  2. L7
    specialize square_mod_four_zero_or_one b
  3. L8
    exact square_mod_four_zero_or_one
04Separate the logical casesL9–14

Follow the explicit conjunction, disjunction, witness, or contradiction step recorded below.

  1. L9
    cases ha
  2. L10
    cases ha_left
  3. L11
    cases hb
  4. L12
    cases hb_left
  5. L13
    left
  6. L14
    left
05Construct an explicit witnessL15–15

Supply the displayed value, then prove that it has the required property.

  1. L15
    exists x + x1
06Calculate and transport equalitiesL16–18

Carry out the recorded arithmetic or equality steps; inspect the exact commands for their direction and premises.

  1. L16
    rewrite ha_left_witness
  2. L17
    rewrite hb_left_witness
  3. L18
    simp [mul_add]
07Separate the logical casesL19–21

Follow the explicit conjunction, disjunction, witness, or contradiction step recorded below.

  1. L19
    cases hb_right
  2. L20
    left
  3. L21
    right
08Construct an explicit witnessL22–22

Supply the displayed value, then prove that it has the required property.

  1. L22
    exists x + x1
09Calculate and transport equalitiesL23–25

Carry out the recorded arithmetic or equality steps; inspect the exact commands for their direction and premises.

  1. L23
    rewrite ha_left_witness
  2. L24
    rewrite hb_right_witness
  3. L25
    simp [mul_add, add_assoc]
10Separate the logical casesL26–30

Follow the explicit conjunction, disjunction, witness, or contradiction step recorded below.

  1. L26
    cases ha_right
  2. L27
    cases hb
  3. L28
    cases hb_left
  4. L29
    left
  5. L30
    right
11Construct an explicit witnessL31–31

Supply the displayed value, then prove that it has the required property.

  1. L31
    exists x + x1
12Calculate and transport equalitiesL32–34

Carry out the recorded arithmetic or equality steps; inspect the exact commands for their direction and premises.

  1. L32
    rewrite ha_right_witness
  2. L33
    rewrite hb_left_witness
  3. L34
    simp [mul_add, add_assoc, add_comm]
13Separate the logical casesL35–36

Follow the explicit conjunction, disjunction, witness, or contradiction step recorded below.

  1. L35
    cases hb_right
  2. L36
    right
14Construct an explicit witnessL37–37

Supply the displayed value, then prove that it has the required property.

  1. L37
    exists x + x1
15Calculate and transport equalitiesL38–40

Carry out the recorded arithmetic or equality steps; inspect the exact commands for their direction and premises.

  1. L38
    rewrite ha_right_witness
  2. L39
    rewrite hb_right_witness
  3. L40
    simp [mul_add, add_assoc, add_comm]

Library-wide reading audit

Original defined command ledger · 40 lines
  1. 0001intro a
  2. 0002intro b
  3. 0003have ha : (∃ x. a · a = 4 · x + 0) ∨ Mod4One(a · a)
    Exact native replay linehave ha : (exists q. a * a = 4 * q + 0) \/ (exists q. a * a = 4 * q + 1)
  4. 0004specialize square_mod_four_zero_or_one a
  5. 0005exact square_mod_four_zero_or_one
  6. 0006have hb : (∃ x. b · b = 4 · x + 0) ∨ Mod4One(b · b)
    Exact native replay linehave hb : (exists q. b * b = 4 * q + 0) \/ (exists q. b * b = 4 * q + 1)
  7. 0007specialize square_mod_four_zero_or_one b
  8. 0008exact square_mod_four_zero_or_one
  9. 0009cases ha
  10. 0010cases ha_left
  11. 0011cases hb
  12. 0012cases hb_left
  13. 0013left
  14. 0014left
  15. 0015exists x + x1
  16. 0016rewrite ha_left_witness
  17. 0017rewrite hb_left_witness
  18. 0018simp [mul_add]
  19. 0019cases hb_right
  20. 0020left
  21. 0021right
  22. 0022exists x + x1
  23. 0023rewrite ha_left_witness
  24. 0024rewrite hb_right_witness
  25. 0025simp [mul_add, add_assoc]
  26. 0026cases ha_right
  27. 0027cases hb
  28. 0028cases hb_left
  29. 0029left
  30. 0030right
  31. 0031exists x + x1
  32. 0032rewrite ha_right_witness
  33. 0033rewrite hb_left_witness
  34. 0034simp [mul_add, add_assoc, add_comm]
  35. 0035cases hb_right
  36. 0036right
  37. 0037exists x + x1
  38. 0038rewrite ha_right_witness
  39. 0039rewrite hb_right_witness
  40. 0040simp [mul_add, add_assoc, add_comm]