← Session 33 — ii′-3b/3c crux + F-D finding; Lagarias letter package
thinking (5209 chars)
Still fails at the rcases (line 10). So `rcases hs with hb | hb | hb | hb` on the union IS what fails — it recurses into the pieces and cases the Eq. The `.1` in the equation: `... = s.1` — so rcases destructured s itself?? `s.1` — for ℂ (structure with re/im), `s.1` = s.re. Hmm — wait: maybe `×ℂ` = reProdIm is defined as `equivRealProdCLM ⁻¹' (A ×ˢ B)`?? — membership: (equivRealProdCLM.symm?...) — if membership forces s to be viewed as a PAIR (s.1, s.2)... and rcases destructures (s.re, s.im)... The Eq `(↑(2√n) + ↑T·I).re = s.1` — if s were destructured into a pair ⟨s.1, s.2⟩ then s.1 is a VARIABLE and subst works — but the error says FAILED to solve — so s.1 is NOT a fresh variable — it's the projection of the original s.
Whatever. New approach: handle each piece via `Set.mem_union.mp` applied MANUALLY as haves (no rcases on the union):
```lean
have hb4 := hs
rw [RectangleBorder] at hb4
-- manually peel: hb4 : s ∈ ((A ∪ B) ∪ C) ∪ D
rcases hb4 with hb | hb | hb | hb -- fails
```
vs
```lean
have h1 := Set.mem_union _ _ hb4 -- h1 : s ∈ (A∪B∪C) ∨ s ∈ D — wait the def's nesting: A ∪ B ∪ C ∪ D = ((A ∪ B) ∪ C) ∪ D
```
Hmm — actually `Set.mem_union : a ∈ s ∪ t ↔ a ∈ s ∨ a ∈ t` — I can `rw [Set.mem_union] at hb4` (which I did) making hb4 a DISJUNCTION (Or) — then rcases on the Or — the Or's components are the piece-memberships — rcases with flat names — and it STILL recursed into the Eq. So rcases on ANY structure containing the Eq cases it. CONFIRMED: the Eq is inside `s ∈ {w.re} ×ℂ ...` — setOf membership → And(re-membership(Eq), im-membership) — rcases recurses automatically into setOf content.
THE FIX: keep the singleton memberships OPAQUE to rcases by converting them with `Set.mem_singleton_iff` FIRST — but that's what produces the Eq... The Eq IS the problem — rcases cases-es Eqs with non-defeq sides. So: prevent the Eq from forming — rewrite `s.re ∈ {w.re}` to `s.re = w.re`?? — that IS the Eq.
Alternative: convert the singleton membership into a NAMED hypothesis via have + Set.mem_singleton_iff.mp, with the PIECES destructured by projection (not rcases):
```lean
rw [RectangleBorder, Set.mem_union, Set.mem_union, Set.mem_union] at hs
-- hs is now an Or of piece-memberships
rcases hs with hb | hb | hb | hb -- FAILS
```
→
```lean
-- DON'T rcases; use Or.elim manually? In tactic mode:
rcases hs with hb | hb | hb | hb -- fails regardless
```
Hmm OK — the ONLY way is to make the pieces not-Eq-structured when rcases hits them. Idea: rewrite `s.re ∈ {w.re}` into `s.re = w.re` is the Eq — but what if I rewrite it into `w.re = s.re`?? — same Eq (flipped).
Idea 2: `Set.mem_singleton_iff.mp` per piece BEFORE rcases — can't, the pieces are inside the union.
Idea 3: `Set.eq_of_mem_singleton`?? — same Eq.
Idea 4: avoid destructuring by using `Set.mem_union` eliminations via FUNCTION application (term mode):
```lean
have key : (s.im = z.im ∧ s.re ∈ Set.uIcc z.re w.re) ∨ (s.re = z.re ∧ s.im ∈ Set.uIcc z.im w.im) ∨
(s.im = w.im ∧ s.re ∈ Set.uIcc z.re w.re) ∨ (s.re = w.re ∧ s.im ∈ Set.uIcc z.im w.im) := by
rw [RectangleBorder] at hs
rcases hs with hb | hb | hb | hb -- STILL FAILS
```
Idea 5: change the border form: introduce the pieces as separate hypotheses with a custom simp-set that turns EVERYTHING into iff-form WITHOUT forming Eqs — impossible, singleton membership IS an Eq.
Idea 6: `simp only [RectangleBorder, Set.mem_union, Set.mem_singleton_iff, Complex.mem_reProdIm?]` — if Complex.mem_reProdIm exists as an iff, the pieces become And's with the singleton-Eqs already as Eqs — rcases still cases them.
Idea 7: THE REAL FIX — don't let rcases touch it: `have ⟨h | h | h | h⟩ := hs`?? — that's obtain, same thing.
Idea 8: use `match hs with`... same.
Idea 9: prove the four-case disjunction lemma ONCE via a DIFFERENT route: show the border ⊆ the four Prop-forms via intro/rcases-free:
```lean
lemma border_decomp {z w s : ℂ} (hs : s ∈ RectangleBorder z w) :
s.im = z.im ∨ s.re = z.re ∨ s.im = w.im ∨ s.re = w.re := by
have hs4 := hs
simp only [RectangleBorder, Set.mem_union, Complex.mem_reProdIm, Set.mem_singleton_iff] at hs4
-- hs4 : (s.re ∈ [[z.re, w.re]] ∧ s.im = z.im) ∨ (s.re = z.re ∧ s.im ∈ [[..]]) ∨ ...
tauto
```
Wait — `tauto` on the disjunction: hs4 : (A∧B) ∨ (C∧D) ∨ (E∧F) ∨ (G∧H) ⊢ B ∨ C ∨ F ∨ G — tauto should close (propositional) — and rcases never fires! The key: `Complex.mem_reProdIm` — does it exist? If reProdIm membership is defeq to the And, `Set.mem_singleton_iff` rewrites the singleton memberships to Eqs at the HYPOTHESIS level (rw, not cases) ✓ then tauto. If Complex.mem_reProdIm doesn't exist, use `Set.mem_setOf_eq`? reProdIm's def: `Complex.reProdIm s t = {z | z.re ∈ s ∧ z.im ∈ t}`? — if that's the def, membership is defeq to the And and simp only [Set.mem_setOf_eq]... deprecated (banked: Set.mem_setOf_eq deprecated). Hmm — membership in a setOf is defeq — simp only [] might not rewrite. Use `show` to convert: since defeq, `have hs5 : (s.re ∈ [[z.re, w.re]] ∧ s.im ∈ {z.im}) ∨ ... := hs` — defeq assignment! Then rw [Set.mem_singleton_iff] at hs5 (rewrites the singleton memberships to Eqs — rw works on memberships ✓). Then tauto.
Test this.
The Eq inside the setOf memberships is what rcases cases-es. Testing the defeq-assignment + rw + tauto route.
tool: Bash
input
{
"command": "cd D:/Python/Quantum/research/lean/NguyenRH1 && cat > Scratch.lean << 'EOF'\nimport Mathlib\nimport NguyenRH1.LiSides\nopen Zeta23 Complex Filter Topology\nnoncomputable section\nnamespace NguyenRH1\nexample {n : \u2115} {T : \u211d} (s : \u2102)\n (hs : s \u2208 RectangleBorder (((-5/2 : \u211d) : \u2102) - (T : \u211d) * Complex.I)\n (((2 * Real.sqrt n : \u211d) : \u2102) + (T : \u211d) * Complex.I)) : True := by\n rw [RectangleBorder, Set.mem_union, Set.mem_union, Set.mem_union,\n Set.mem_singleton_iff, Set.mem_singleton_iff, Set.mem_singleton_iff,\n Set.mem_singleton_iff] at hs\n rcases hs with hb | hb | hb | hb\n \u00b7 have him := hb.2\n trivial\n \u00b7 have hre := hb.1\n trivial\n \u00b7 have him := hb.2\n trivial\n \u00b7 have hre := hb.1\n trivial\nend NguyenRH1\nEOF\nexport PATH=\"$HOME/.elan/bin:$PATH\" && lake env lean Scratch.lean 2>&1 | head -14",
"description": "Test singleton-iff rewrite before rcases",
"timeout": 300000
}
raw content_json (database row)
[{"type":"thinking","thinking":"Still fails at the rcases (line 10). So `rcases hs with hb | hb | hb | hb` on the union IS what fails — it recurses into the pieces and cases the Eq. The `.1` in the equation: `... = s.1` — so rcases destructured s itself?? `s.1` — for ℂ (structure with re/im), `s.1` = s.re. Hmm — wait: maybe `×ℂ` = reProdIm is defined as `equivRealProdCLM ⁻¹' (A ×ˢ B)`?? — membership: (equivRealProdCLM.symm?...) — if membership forces s to be viewed as a PAIR (s.1, s.2)... and rcases destructures (s.re, s.im)... The Eq `(↑(2√n) + ↑T·I).re = s.1` — if s were destructured into a pair ⟨s.1, s.2⟩ then s.1 is a VARIABLE and subst works — but the error says FAILED to solve — so s.1 is NOT a fresh variable — it's the projection of the original s.\n\nWhatever. New approach: handle each piece via `Set.mem_union.mp` applied MANUALLY as haves (no rcases on the union):\n\n```lean\n have hb4 := hs\n rw [RectangleBorder] at hb4\n -- manually peel: hb4 : s ∈ ((A ∪ B) ∪ C) ∪ D\n rcases hb4 with hb | hb | hb | hb -- fails\n```\n\nvs\n\n```lean\n have h1 := Set.mem_union _ _ hb4 -- h1 : s ∈ (A∪B∪C) ∨ s ∈ D — wait the def's nesting: A ∪ B ∪ C ∪ D = ((A ∪ B) ∪ C) ∪ D\n```\n\nHmm — actually `Set.mem_union : a ∈ s ∪ t ↔ a ∈ s ∨ a ∈ t` — I can `rw [Set.mem_union] at hb4` (which I did) making hb4 a DISJUNCTION (Or) — then rcases on the Or — the Or's components are the piece-memberships — rcases with flat names — and it STILL recursed into the Eq. So rcases on ANY structure containing the Eq cases it. CONFIRMED: the Eq is inside `s ∈ {w.re} ×ℂ ...` — setOf membership → And(re-membership(Eq), im-membership) — rcases recurses automatically into setOf content.\n\nTHE FIX: keep the singleton memberships OPAQUE to rcases by converting them with `Set.mem_singleton_iff` FIRST — but that's what produces the Eq... The Eq IS the problem — rcases cases-es Eqs with non-defeq sides. So: prevent the Eq from forming — rewrite `s.re ∈ {w.re}` to `s.re = w.re`?? — that IS the Eq.\n\nAlternative: convert the singleton membership into a NAMED hypothesis via have + Set.mem_singleton_iff.mp, with the PIECES destructured by projection (not rcases):\n\n```lean\n rw [RectangleBorder, Set.mem_union, Set.mem_union, Set.mem_union] at hs\n -- hs is now an Or of piece-memberships\n rcases hs with hb | hb | hb | hb -- FAILS\n```\n→ \n```lean\n -- DON'T rcases; use Or.elim manually? In tactic mode: \n rcases hs with hb | hb | hb | hb -- fails regardless\n```\n\nHmm OK — the ONLY way is to make the pieces not-Eq-structured when rcases hits them. Idea: rewrite `s.re ∈ {w.re}` into `s.re = w.re` is the Eq — but what if I rewrite it into `w.re = s.re`?? — same Eq (flipped).\n\nIdea 2: `Set.mem_singleton_iff.mp` per piece BEFORE rcases — can't, the pieces are inside the union.\n\nIdea 3: `Set.eq_of_mem_singleton`?? — same Eq.\n\nIdea 4: avoid destructuring by using `Set.mem_union` eliminations via FUNCTION application (term mode): \n```lean\n have key : (s.im = z.im ∧ s.re ∈ Set.uIcc z.re w.re) ∨ (s.re = z.re ∧ s.im ∈ Set.uIcc z.im w.im) ∨\n (s.im = w.im ∧ s.re ∈ Set.uIcc z.re w.re) ∨ (s.re = w.re ∧ s.im ∈ Set.uIcc z.im w.im) := by\n rw [RectangleBorder] at hs\n rcases hs with hb | hb | hb | hb -- STILL FAILS\n```\n\nIdea 5: change the border form: introduce the pieces as separate hypotheses with a custom simp-set that turns EVERYTHING into iff-form WITHOUT forming Eqs — impossible, singleton membership IS an Eq.\n\nIdea 6: `simp only [RectangleBorder, Set.mem_union, Set.mem_singleton_iff, Complex.mem_reProdIm?]` — if Complex.mem_reProdIm exists as an iff, the pieces become And's with the singleton-Eqs already as Eqs — rcases still cases them.\n\nIdea 7: THE REAL FIX — don't let rcases touch it: `have ⟨h | h | h | h⟩ := hs`?? — that's obtain, same thing.\n\nIdea 8: use `match hs with`... same.\n\nIdea 9: prove the four-case disjunction lemma ONCE via a DIFFERENT route: show the border ⊆ the four Prop-forms via intro/rcases-free: \n\n```lean\nlemma border_decomp {z w s : ℂ} (hs : s ∈ RectangleBorder z w) :\n s.im = z.im ∨ s.re = z.re ∨ s.im = w.im ∨ s.re = w.re := by\n have hs4 := hs\n simp only [RectangleBorder, Set.mem_union, Complex.mem_reProdIm, Set.mem_singleton_iff] at hs4\n -- hs4 : (s.re ∈ [[z.re, w.re]] ∧ s.im = z.im) ∨ (s.re = z.re ∧ s.im ∈ [[..]]) ∨ ...\n tauto\n```\nWait — `tauto` on the disjunction: hs4 : (A∧B) ∨ (C∧D) ∨ (E∧F) ∨ (G∧H) ⊢ B ∨ C ∨ F ∨ G — tauto should close (propositional) — and rcases never fires! The key: `Complex.mem_reProdIm` — does it exist? If reProdIm membership is defeq to the And, `Set.mem_singleton_iff` rewrites the singleton memberships to Eqs at the HYPOTHESIS level (rw, not cases) ✓ then tauto. If Complex.mem_reProdIm doesn't exist, use `Set.mem_setOf_eq`? reProdIm's def: `Complex.reProdIm s t = {z | z.re ∈ s ∧ z.im ∈ t}`? — if that's the def, membership is defeq to the And and simp only [Set.mem_setOf_eq]... deprecated (banked: Set.mem_setOf_eq deprecated). Hmm — membership in a setOf is defeq — simp only [] might not rewrite. Use `show` to convert: since defeq, `have hs5 : (s.re ∈ [[z.re, w.re]] ∧ s.im ∈ {z.im}) ∨ ... := hs` — defeq assignment! Then rw [Set.mem_singleton_iff] at hs5 (rewrites the singleton memberships to Eqs — rw works on memberships ✓). Then tauto.\n\nTest this.","signature":""},{"type":"text","text":"The Eq inside the setOf memberships is what rcases cases-es. Testing the defeq-assignment + rw + tauto route."},{"type":"tool_use","id":"Bash_278","name":"Bash","input":{"command":"cd D:/Python/Quantum/research/lean/NguyenRH1 && cat > Scratch.lean << 'EOF'\nimport Mathlib\nimport NguyenRH1.LiSides\nopen Zeta23 Complex Filter Topology\nnoncomputable section\nnamespace NguyenRH1\nexample {n : ℕ} {T : ℝ} (s : ℂ)\n (hs : s ∈ RectangleBorder (((-5/2 : ℝ) : ℂ) - (T : ℝ) * Complex.I)\n (((2 * Real.sqrt n : ℝ) : ℂ) + (T : ℝ) * Complex.I)) : True := by\n rw [RectangleBorder, Set.mem_union, Set.mem_union, Set.mem_union,\n Set.mem_singleton_iff, Set.mem_singleton_iff, Set.mem_singleton_iff,\n Set.mem_singleton_iff] at hs\n rcases hs with hb | hb | hb | hb\n · have him := hb.2\n trivial\n · have hre := hb.1\n trivial\n · have him := hb.2\n trivial\n · have hre := hb.1\n trivial\nend NguyenRH1\nEOF\nexport PATH=\"$HOME/.elan/bin:$PATH\" && lake env lean Scratch.lean 2>&1 | head -14","description":"Test singleton-iff rewrite before rcases","timeout":300000},"extra_content":null}]