From 76be65429754589932cacdcac4fa3186983e30d9 Mon Sep 17 00:00:00 2001 From: Cameron Freer Date: Fri, 26 Jun 2026 23:20:00 +0000 Subject: [PATCH 1/7] build: upgrade to Lean v4.32.0-rc1 + mathlib v4.32.0-rc1; drop LeanArchitect fork Dependency bump only (Commit 1 of the upgrade; API fixes follow separately). - lean-toolchain: v4.27.0 -> v4.32.0-rc1. - mathlib: d557daf (v4.27.0-era) -> v4.32.0-rc1. - LeanArchitect: cameronfreer fork (e14a867) -> upstream hanwenzhu d9013cc (v4.32.0-rc1). The fork's sole change was commenting out an explicit batteries pin to dodge a version conflict; at v4.32.0-rc1 upstream LeanArchitect, mathlib, and batteries all resolve to the same batteries commit (954dbc987), so the fork is no longer needed. - Dropped graphon's explicit batteries/Cli requires (Lake warned they break cache-hash computation); they now come transitively from Mathlib. Moved 'require mathlib' LAST so Mathlib's transitive dependency versions take precedence. - lake update + lake exe cache get succeed (8563 mathlib oleans cached); lake env lean reports v4.32.0-rc1. checkdecls left at its old pin (only used by the CI blueprint step, not the build). --- lake-manifest.json | 85 +++++++++++++++++++++++----------------------- lakefile.toml | 28 ++++++--------- lean-toolchain | 2 +- 3 files changed, 54 insertions(+), 61 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index 2baffef..8981d36 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -1,61 +1,41 @@ -{"version": "1.1.0", +{"version": "1.2.0", "packagesDir": ".lake/packages", "packages": - [{"url": "https://github.com/PatrickMassot/checkdecls.git", + [{"url": "https://github.com/leanprover-community/mathlib4", "type": "git", "subDir": null, - "scope": "", - "rev": "3d425859e73fcfbef85b9638c2a91708ef4a22d4", - "name": "checkdecls", + "scope": "leanprover-community", + "rev": "360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56", + "name": "mathlib", "manifestFile": "lake-manifest.json", - "inputRev": "3d425859e73fcfbef85b9638c2a91708ef4a22d4", + "inputRev": "v4.32.0-rc1", "inherited": false, "configFile": "lakefile.lean"}, - {"url": "https://github.com/mhuisi/lean4-cli", + {"url": "https://github.com/PatrickMassot/checkdecls.git", "type": "git", "subDir": null, "scope": "", - "rev": "55c37290ff6186e2e965d68cf853a57c0702db82", - "name": "Cli", - "manifestFile": "lake-manifest.json", - "inputRev": "v4.27.0", - "inherited": false, - "configFile": "lakefile.toml"}, - {"url": "https://github.com/leanprover-community/batteries", - "type": "git", - "subDir": null, - "scope": "leanprover-community", - "rev": "b25b36a7caf8e237e7d1e6121543078a06777c8a", - "name": "batteries", + "rev": "3d425859e73fcfbef85b9638c2a91708ef4a22d4", + "name": "checkdecls", "manifestFile": "lake-manifest.json", - "inputRev": "v4.27.0", + "inputRev": "3d425859e73fcfbef85b9638c2a91708ef4a22d4", "inherited": false, - "configFile": "lakefile.toml"}, - {"url": "https://github.com/cameronfreer/LeanArchitect.git", + "configFile": "lakefile.lean"}, + {"url": "https://github.com/hanwenzhu/LeanArchitect.git", "type": "git", "subDir": null, "scope": "", - "rev": "e14a8675845d75a2c05bb09b662abc0495dacf7f", + "rev": "d9013cc08bd2b5483e837368dfa4cc7ead92a5c2", "name": "LeanArchitect", "manifestFile": "lake-manifest.json", - "inputRev": "e14a867", - "inherited": false, - "configFile": "lakefile.lean"}, - {"url": "https://github.com/leanprover-community/mathlib4", - "type": "git", - "subDir": null, - "scope": "leanprover-community", - "rev": "d557daf6dc764277d2f5cb03daf31d21bc5f01d3", - "name": "mathlib", - "manifestFile": "lake-manifest.json", - "inputRev": "d557daf6dc764277d2f5cb03daf31d21bc5f01d3", + "inputRev": "d9013cc08bd2b5483e837368dfa4cc7ead92a5c2", "inherited": false, "configFile": "lakefile.lean"}, {"url": "https://github.com/leanprover-community/plausible", "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "009dc1e6f2feb2c96c081537d80a0905b2c6498f", + "rev": "f3f26cc72646205ca167117487c008ee1dafe816", "name": "plausible", "manifestFile": "lake-manifest.json", "inputRev": "main", @@ -65,7 +45,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "5ce7f0a355f522a952a3d678d696bd563bb4fd28", + "rev": "c5d5b8fe6e5158def25cd28eb94e4141ad97c843", "name": "LeanSearchClient", "manifestFile": "lake-manifest.json", "inputRev": "main", @@ -75,7 +55,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "8f497d55985a189cea8020d9dc51260af1e41ad2", + "rev": "41f407a8e85b0fdc00910633a8f14754139b63f4", "name": "importGraph", "manifestFile": "lake-manifest.json", "inputRev": "main", @@ -85,17 +65,17 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "c04225ee7c0585effbd933662b3151f01b600e40", + "rev": "e6518a674e62de322b8f79eebeda7bcae2a36bc3", "name": "proofwidgets", "manifestFile": "lake-manifest.json", - "inputRev": "v0.0.85", + "inputRev": "main", "inherited": true, "configFile": "lakefile.lean"}, {"url": "https://github.com/leanprover-community/aesop", "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "cb837cc26236ada03c81837bebe0acd9c70ced7d", + "rev": "b5b9e2bb45ce91e4bc44eaa738c3a8910404ab82", "name": "aesop", "manifestFile": "lake-manifest.json", "inputRev": "master", @@ -105,11 +85,32 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "bd58c9efe2086d56ca361807014141a860ddbf8c", + "rev": "7a62bd13860cd39ac98da16ffc8c24d601353f69", "name": "Qq", "manifestFile": "lake-manifest.json", "inputRev": "master", "inherited": true, + "configFile": "lakefile.toml"}, + {"url": "https://github.com/leanprover-community/batteries", + "type": "git", + "subDir": null, + "scope": "leanprover-community", + "rev": "954dbc9873f3b4534dc9896604593406d0383520", + "name": "batteries", + "manifestFile": "lake-manifest.json", + "inputRev": "main", + "inherited": true, + "configFile": "lakefile.toml"}, + {"url": "https://github.com/leanprover/lean4-cli", + "type": "git", + "subDir": null, + "scope": "leanprover", + "rev": "406ebb8c8e2f7e852a1b47764b42494022ce652c", + "name": "Cli", + "manifestFile": "lake-manifest.json", + "inputRev": "v4.32.0-rc1", + "inherited": true, "configFile": "lakefile.toml"}], "name": "Graphon", - "lakeDir": ".lake"} + "lakeDir": ".lake", + "fixedToolchain": false} diff --git a/lakefile.toml b/lakefile.toml index 066d444..2f59e42 100644 --- a/lakefile.toml +++ b/lakefile.toml @@ -3,31 +3,23 @@ version = "0.1.0" keywords = ["math"] defaultTargets = ["Graphon"] -[[require]] -name = "mathlib" -scope = "leanprover-community" -rev = "d557daf6dc764277d2f5cb03daf31d21bc5f01d3" - [[require]] name = "LeanArchitect" -git = "https://github.com/cameronfreer/LeanArchitect.git" -rev = "e14a867" - -[[require]] -name = "batteries" -scope = "leanprover-community" -git = "https://github.com/leanprover-community/batteries" -rev = "v4.27.0" - -[[require]] -name = "Cli" -git = "https://github.com/mhuisi/lean4-cli" -rev = "v4.27.0" +git = "https://github.com/hanwenzhu/LeanArchitect.git" +rev = "d9013cc08bd2b5483e837368dfa4cc7ead92a5c2" [[require]] name = "checkdecls" git = "https://github.com/PatrickMassot/checkdecls.git" rev = "3d425859e73fcfbef85b9638c2a91708ef4a22d4" +# batteries and Cli are provided transitively by Mathlib; pinning them explicitly +# breaks `lake exe cache get` hash computation (Lake warns to remove them). +# `require mathlib` is LAST so Mathlib's transitive dependency versions take precedence. +[[require]] +name = "mathlib" +scope = "leanprover-community" +rev = "v4.32.0-rc1" + [[lean_lib]] name = "Graphon" diff --git a/lean-toolchain b/lean-toolchain index 5249182..2694eb7 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:v4.27.0 +leanprover/lean4:v4.32.0-rc1 From 3febf790436cfcb0f39f5dc4a253f280a9503536 Mon Sep 17 00:00:00 2001 From: Cameron Freer Date: Sat, 27 Jun 2026 00:11:18 +0000 Subject: [PATCH 2/7] =?UTF-8?q?build:=20#upgrade=20=E2=80=94=20repair=20Gr?= =?UTF-8?q?aphon/Lovasz.lean=20for=20Lean=20v4.32.0-rc1=20/=20mathlib=20v4?= =?UTF-8?q?.32.0-rc1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit API-fix pass (proof bodies only; no statement changes; pre-existing sorries preserved). v4.32 mathlib changes handled: - SimpleGraph structure: symm/loopless fields are now Std.Symm/Std.Irrefl classes. Inline builds use nested-field syntax (symm.symm := …, loopless.irrefl := …); accesses use G.loopless.irrefl / G.irrefl / G.ne_of_adj. - Sym2.mk is now curried (α → α → Sym2 α); Sym2.mk (Quot.out e) reworked via s(p.1, p.2) + Sym2.eq_iff; Sym2.map_pair_eq → Sym2.map_mk. - SimpleGraph.map Adj now carries a Ne component (Ne ⊓ Relation.Map); membership goals go through SimpleGraph.map_adj. - empty 'simp only' now errors (removed); a few convert-leftover goals closed with funext+simp; edgeFinset_bot instance-mismatch worked around with explicit Fintype. lake build Graphon.Lovasz: 0 errors. Sorry inventory unchanged (one incidental docstring reword near a repaired proof). --- Graphon/Lovasz.lean | 121 +++++++++++++++++++++++++------------------- 1 file changed, 68 insertions(+), 53 deletions(-) diff --git a/Graphon/Lovasz.lean b/Graphon/Lovasz.lean index fde7cd4..e1dce88 100644 --- a/Graphon/Lovasz.lean +++ b/Graphon/Lovasz.lean @@ -323,7 +323,7 @@ noncomputable def MultiLabeledGraph.ofSimple {K n : ℕ} rw [if_neg] intro h rw [SimpleGraph.mem_edgeFinset, SimpleGraph.mem_edgeSet] at h - exact F.loopless _ h + exact F.loopless.irrefl _ h /-- **`multiLabeledEvalK` of `ofSimple F` matches the simple-graph σ-sum body** (the analog of `MatrixDetermination.lean:7156`). @@ -1661,9 +1661,9 @@ theorem multiLabeledEvalK_tupleEquiv_invariant_n_zero {T K : ℕ} simp only [ne_eq, Fin.mk.injEq, u, v]; intro h; apply hab; exact Fin.ext h let F : SimpleGraph (Fin (0 + K)) := { Adj := fun a b => (a = u ∧ b = v) ∨ (a = v ∧ b = u) - symm := fun _ _ h => h.elim (fun ⟨h1, h2⟩ => Or.inr ⟨h2, h1⟩) + symm.symm := fun _ _ h => h.elim (fun ⟨h1, h2⟩ => Or.inr ⟨h2, h1⟩) (fun ⟨h1, h2⟩ => Or.inl ⟨h2, h1⟩) - loopless := fun _ h => by + loopless.irrefl := fun _ h => by rcases h with ⟨h1, h2⟩ | ⟨h1, h2⟩ · exact hne (h1.symm.trans h2) · exact hne (h2.symm.trans h1) } @@ -2372,9 +2372,9 @@ private lemma multigraphEval_LL_excess_descends_aux {T K n : ℕ} -- Build the corresponding simple graph and apply h_simple. let F : SimpleGraph (Fin (n + K)) := { Adj := fun a b => a ≠ b ∧ M.mult s(a, b) = 1 - symm := fun a b ⟨hne, hmult⟩ => + symm.symm := fun a b ⟨hne, hmult⟩ => ⟨hne.symm, by rwa [Sym2.eq_swap]⟩ - loopless := fun a ⟨hne, _⟩ => hne rfl } + loopless.irrefl := fun a ⟨hne, _⟩ => hne rfl } haveI : DecidableRel F.Adj := Classical.decRel _ have hmult_eq : ∀ e, M.mult e = (MultiLabeledGraph.ofSimple F).mult e := by intro e @@ -2500,8 +2500,8 @@ private lemma multigraphEval_LL_excess_descends_aux {T K n : ℕ} exact Fin.ext (by have := congr_arg Fin.val h_eq; simpa [aF, bF] using this) let G : SimpleGraph (Fin (0 + K)) := { Adj := fun u v => (u = aF ∧ v = bF) ∨ (u = bF ∧ v = aF) - symm := fun u v => by rintro (⟨h1, h2⟩ | ⟨h1, h2⟩) <;> [right; left] <;> exact ⟨h2, h1⟩ - loopless := fun u h => by + symm.symm := fun u v => by rintro (⟨h1, h2⟩ | ⟨h1, h2⟩) <;> [right; left] <;> exact ⟨h2, h1⟩ + loopless.irrefl := fun u h => by rcases h with ⟨h1, h2⟩ | ⟨h1, h2⟩ · exact h_aF_ne_bF (h1.symm.trans h2) · exact h_aF_ne_bF (h2.symm.trans h1) } @@ -3006,9 +3006,9 @@ private theorem multigraphEval_isolated_unlabeled_unlabeled_doubled_edge_descend -- F_rest: simple graph on Fin (n - 2 + K) with edges from mult-1 edges of M. let F_rest : SimpleGraph (Fin (n - 2 + K)) := { Adj := fun a b => a ≠ b ∧ M.mult s(restEmbed a, restEmbed b) = 1 - symm := fun a b ⟨hne, hmult⟩ => + symm.symm := fun a b ⟨hne, hmult⟩ => ⟨hne.symm, by rwa [Sym2.eq_swap]⟩ - loopless := fun a ⟨hne, _⟩ => hne rfl } + loopless.irrefl := fun a ⟨hne, _⟩ => hne rfl } haveI : DecidableRel F_rest.Adj := Classical.decRel _ -- Step 7 application: instantiate h_simple at F_rest. This gives the -- equality of F_rest's evaluation at ξ vs ξ' for free. @@ -3582,8 +3582,8 @@ private theorem multigraphEval_label_unlabeled_isolated_descends let restEmbed : Fin (n - 1 + K) → Fin (n + K) := @restEmbedAux n K (n - 1) g_rest let F_rest : SimpleGraph (Fin (n - 1 + K)) := { Adj := fun a b => a ≠ b ∧ M.mult s(restEmbed a, restEmbed b) = 1 - symm := fun a b ⟨hne, hmult⟩ => ⟨hne.symm, by rwa [Sym2.eq_swap]⟩ - loopless := fun a ⟨hne, _⟩ => hne rfl } + symm.symm := fun a b ⟨hne, hmult⟩ => ⟨hne.symm, by rwa [Sym2.eq_swap]⟩ + loopless.irrefl := fun a ⟨hne, _⟩ => hne rfl } haveI : DecidableRel F_rest.Adj := Classical.decRel _ have h_simple_F_rest := h_simple (n - 1) F_rest have restEmbed_injective : Function.Injective restEmbed := @@ -4244,9 +4244,9 @@ theorem multigraphEval_in_simpleProfileClosure {T K n : ℕ} · classical let F : SimpleGraph (Fin ((n + 1) + K)) := { Adj := fun a b => a ≠ b ∧ M.mult s(a, b) = 1 - symm := fun a b ⟨hne, hmult⟩ => + symm.symm := fun a b ⟨hne, hmult⟩ => ⟨hne.symm, by rwa [Sym2.eq_swap]⟩ - loopless := fun a ⟨hne, _⟩ => hne rfl } + loopless.irrefl := fun a ⟨hne, _⟩ => hne rfl } haveI : DecidableRel F.Adj := Classical.decRel _ have hmult_eq : ∀ e, M.mult e = (MultiLabeledGraph.ofSimple F).mult e := by intro e @@ -4413,9 +4413,9 @@ theorem multiLabeledEvalK_tupleEquiv_invariant {T K n : ℕ} classical let F : SimpleGraph (Fin ((n + 1) + K)) := { Adj := fun a b => a ≠ b ∧ M.mult s(a, b) = 1 - symm := fun a b ⟨hne, hmult⟩ => + symm.symm := fun a b ⟨hne, hmult⟩ => ⟨hne.symm, by rwa [Sym2.eq_swap]⟩ - loopless := fun a ⟨hne, _⟩ => hne rfl } + loopless.irrefl := fun a ⟨hne, _⟩ => hne rfl } haveI : DecidableRel F.Adj := Classical.decRel _ -- Show M.mult = (MultiLabeledGraph.ofSimple F).mult pointwise. have hmult_eq : ∀ e, M.mult e = (MultiLabeledGraph.ofSimple F).mult e := by @@ -4818,11 +4818,12 @@ theorem tupleEquivSimple_restrict {T k : ℕ} B (ν (Quot.out (s(a, b) : Sym2 (Fin m))).1) (ν (Quot.out (s(a, b) : Sym2 (Fin m))).2) = B (ν a) (ν b) := by intro m ν a b - have h_out_eq : Sym2.mk (Quot.out (s(a, b) : Sym2 (Fin m))) = s(a, b) := + have h_out_eq : s((Quot.out (s(a, b) : Sym2 (Fin m))).1, + (Quot.out (s(a, b) : Sym2 (Fin m))).2) = s(a, b) := Quot.out_eq _ - rcases Sym2.mk_eq_mk_iff.mp h_out_eq with heq | heq - · rw [heq] - · rw [heq]; exact hB _ _ + rcases Sym2.eq_iff.mp h_out_eq with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · rw [h1, h2] + · rw [h1, h2]; exact hB _ _ -- Pivot at position k; shift = succAboveEmb p maps Fin (n+k) → Fin (n+(k+1)). have hk : k < n + (k + 1) := by omega let p : Fin (n + (k + 1)) := ⟨k, hk⟩ @@ -4864,6 +4865,7 @@ theorem tupleEquivSimple_restrict {T k : ℕ} | _ a b => simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq] at * rw [SimpleGraph.mem_edgeSet] at he ⊢ + rw [SimpleGraph.map_adj] exact ⟨a, b, he, rfl, rfl⟩ · -- 2. Injective. intro e1 _ e2 _ hij @@ -4875,6 +4877,7 @@ theorem tupleEquivSimple_restrict {T k : ℕ} induction e using Sym2.ind with | _ x y => rw [SimpleGraph.mem_edgeSet] at he + rw [SimpleGraph.map_adj] at he obtain ⟨a, b, hab, hax, hby⟩ := he refine ⟨s(a, b), ?_, ?_⟩ · rw [SimpleGraph.mem_edgeFinset, SimpleGraph.mem_edgeSet]; exact hab @@ -5340,7 +5343,6 @@ theorem coeffRestrictSimple_equiv {T k : ℕ} have hind := class_eq (fun η => @ite ℝ (tupleEquivSimple B W μ η) (Classical.dec _) 1 0) (fun η η' heq => by - simp only congr 1 refine propext ⟨fun hh => ?_, fun hh => ?_⟩ · intro n F _ @@ -5596,11 +5598,12 @@ theorem tupleEquivSimple_restrict_along {T k T' : ℕ} B (ν (Quot.out (s(a, b) : Sym2 (Fin m))).1) (ν (Quot.out (s(a, b) : Sym2 (Fin m))).2) = B (ν a) (ν b) := by intro m ν a b - have h_out_eq : Sym2.mk (Quot.out (s(a, b) : Sym2 (Fin m))) = s(a, b) := + have h_out_eq : s((Quot.out (s(a, b) : Sym2 (Fin m))).1, + (Quot.out (s(a, b) : Sym2 (Fin m))).2) = s(a, b) := Quot.out_eq _ - rcases Sym2.mk_eq_mk_iff.mp h_out_eq with heq | heq - · rw [heq] - · rw [heq]; exact hB _ _ + rcases Sym2.eq_iff.mp h_out_eq with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · rw [h1, h2] + · rw [h1, h2]; exact hB _ _ -- Build shift : Fin (n + T') → Fin (n + k): label positions via r, -- unlabeled positions shifted by (k - T'). let shiftFun : Fin (n + T') → Fin (n + k) := fun v => @@ -5682,6 +5685,7 @@ theorem tupleEquivSimple_restrict_along {T k T' : ℕ} | _ a b => simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq] at * rw [SimpleGraph.mem_edgeSet] at he ⊢ + rw [SimpleGraph.map_adj] exact ⟨a, b, he, rfl, rfl⟩ · intro e1 _ e2 _ hij exact shift.sym2Map.injective hij @@ -5691,6 +5695,7 @@ theorem tupleEquivSimple_restrict_along {T k T' : ℕ} induction e using Sym2.ind with | _ x y => rw [SimpleGraph.mem_edgeSet] at he + rw [SimpleGraph.map_adj] at he obtain ⟨a, b, hab, hax, hby⟩ := he refine ⟨s(a, b), ?_, ?_⟩ · rw [SimpleGraph.mem_edgeFinset, SimpleGraph.mem_edgeSet]; exact hab @@ -5780,10 +5785,10 @@ theorem tupleEquivSimple_id_bijective {T : ℕ} exact (Fin.mk.injEq _ _ _ _).mp he let F : SimpleGraph (Fin (0 + (S + 1))) := { Adj := fun x y => (x = u ∧ y = v_p) ∨ (x = v_p ∧ y = u) - symm := fun _ _ h => + symm.symm := fun _ _ h => h.elim (fun ⟨h1, h2⟩ => Or.inr ⟨h2, h1⟩) (fun ⟨h1, h2⟩ => Or.inl ⟨h2, h1⟩) - loopless := fun _ h => by + loopless.irrefl := fun _ h => by rcases h with ⟨h1, h2⟩ | ⟨h1, h2⟩ · exact huv_ne (h1.symm.trans h2) · exact huv_ne (h2.symm.trans h1) } @@ -5805,8 +5810,7 @@ theorem tupleEquivSimple_id_bijective {T : ℕ} one_mul, hedge, Finset.prod_singleton] at key -- Unfold τ at u and v_p: u.val = a.val < S+1, v_p.val = b.val < S+1. set p := Quot.out (s(u, v_p) : Sym2 (Fin (0 + (S + 1)))) - have hout : (Sym2.mk p : Sym2 (Fin (0 + (S + 1)))) = s(u, v_p) := - Quot.out_eq _ + have hout : s(p.1, p.2) = s(u, v_p) := Quot.out_eq _ have key' : (p.1 = u ∧ p.2 = v_p) ∨ (p.1 = v_p ∧ p.2 = u) := by have := Sym2.eq_iff.mp hout rcases this with ⟨h1, h2⟩ | ⟨h1, h2⟩ @@ -5864,10 +5868,10 @@ theorem tupleEquivSimple_id_bijective {T : ℕ} intro he; have := congrArg Fin.val he; simp [u', v'] at this let G : SimpleGraph (Fin (1 + (S + 1))) := { Adj := fun x y => (x = u' ∧ y = v') ∨ (x = v' ∧ y = u') - symm := fun _ _ h => + symm.symm := fun _ _ h => h.elim (fun ⟨h1, h2⟩ => Or.inr ⟨h2, h1⟩) (fun ⟨h1, h2⟩ => Or.inl ⟨h2, h1⟩) - loopless := fun _ h => by + loopless.irrefl := fun _ h => by rcases h with ⟨h1, h2⟩ | ⟨h1, h2⟩ · exact hne' (h1.symm.trans h2) · exact hne' (h2.symm.trans h1) } @@ -5903,7 +5907,7 @@ theorem tupleEquivSimple_id_bijective {T : ℕ} congr 1 -- Use Quot.out + Sym2 case-split. set p := Quot.out (s(u', v') : Sym2 (Fin (1 + (S + 1)))) - have hout : Sym2.mk p = s(u', v') := Quot.out_eq _ + have hout : s(p.1, p.2) = s(u', v') := Quot.out_eq _ have key : (p.1 = u' ∧ p.2 = v') ∨ (p.1 = v' ∧ p.2 = u') := by have := Sym2.eq_iff.mp hout rcases this with ⟨h1, h2⟩ | ⟨h1, h2⟩ <;> [left; right] <;> @@ -6123,9 +6127,9 @@ theorem tupleEquivSimple_ext_eq_of_surj {T k : ℕ} -- Define the single-edge graph inline. let F : SimpleGraph (Fin (0 + (k + 1))) := { Adj := fun x y => (x = u ∧ y = v) ∨ (x = v ∧ y = u) - symm := fun _ _ h => + symm.symm := fun _ _ h => h.elim (fun ⟨h1, h2⟩ => Or.inr ⟨h2, h1⟩) (fun ⟨h1, h2⟩ => Or.inl ⟨h2, h1⟩) - loopless := fun _ h => by + loopless.irrefl := fun _ h => by rcases h with ⟨h1, h2⟩ | ⟨h1, h2⟩ · exact hne (h1.symm.trans h2) · exact hne (h2.symm.trans h1) } @@ -6153,7 +6157,7 @@ theorem tupleEquivSimple_ext_eq_of_surj {T k : ℕ} -- Now τ for both sides: positions < k+1 read the label map (snoc α _), -- and there are no positions ≥ k+1 since n' = 0. set p := Quot.out (s(u, v) : Sym2 (Fin (0 + (k + 1)))) - have hout : (Sym2.mk p : Sym2 (Fin (0 + (k + 1)))) = s(u, v) := Quot.out_eq _ + have hout : s(p.1, p.2) = s(u, v) := Quot.out_eq _ -- Case split on which order p represents. have key' : (p.1 = u ∧ p.2 = v) ∨ (p.1 = v ∧ p.2 = u) := by have := Sym2.eq_iff.mp hout @@ -6674,9 +6678,14 @@ theorem InRootedProfileSpan.smul {T : ℕ} {B : Fin T → Fin T → ℝ} {W : Fi theorem rootedProfileFun_bot {T : ℕ} (B : Fin T → Fin T → ℝ) (W : Fin T → ℝ) : rootedProfileFun B W (⊥ : SimpleGraph (Fin (0 + 1))) = fun _ => 1 := by funext v - unfold rootedProfileFun rootedProfile simpleEvalAt - simp - convert (pow_zero (B v v)).symm using 1 + simp only [rootedProfileFun, rootedProfile, simpleEvalAt, + Fintype.sum_unique, Finset.univ_eq_empty, Finset.prod_empty, one_mul] + apply Finset.prod_eq_one + intro e he + have heset : e ∈ (⊥ : SimpleGraph (Fin (0 + 1))).edgeSet := + @Set.mem_toFinset _ _ (⊥ : SimpleGraph (Fin (0 + 1))).fintypeEdgeSet e |>.mp he + rw [SimpleGraph.edgeSet_bot] at heset + exact heset.elim /-- Constant function `1` is in the rooted-profile span (via the empty graph). -/ theorem InRootedProfileSpan.one {T : ℕ} (B : Fin T → Fin T → ℝ) (W : Fin T → ℝ) : @@ -6907,17 +6916,17 @@ theorem ofSimple_rootedProduct_eq_glue {n₁ n₂ : ℕ} rw [hglueCast₂ a, hglueCast₂ b, dif_pos ha0, dif_pos hb0] simp only have h1 : ¬ (SimpleGraph.map (rootedProductEmb₁ n₁ n₂) F₁).Adj a b := by - rw [hab_root]; exact (SimpleGraph.map _ F₁).loopless b + rw [hab_root]; exact (SimpleGraph.map _ F₁).loopless.irrefl b have h2 : ¬ (SimpleGraph.map (rootedProductEmb₂ n₁ n₂) F₂).Adj a b := by - rw [hab_root]; exact (SimpleGraph.map _ F₂).loopless b + rw [hab_root]; exact (SimpleGraph.map _ F₂).loopless.irrefl b rw [if_neg (fun h => h.elim h1 h2)] have hab_val : a.val = b.val := by omega have hF₁ : ¬ F₁.Adj ⟨a.val, ha_lt⟩ ⟨b.val, hb_lt⟩ := by have heq : (⟨a.val, ha_lt⟩ : Fin _) = ⟨b.val, hb_lt⟩ := Fin.ext hab_val - rw [heq]; exact F₁.loopless _ + rw [heq]; exact F₁.loopless.irrefl _ have hF₂ : ¬ F₂.Adj ⟨a.val, by omega⟩ ⟨b.val, by omega⟩ := by have heq : (⟨a.val, by omega⟩ : Fin (n₂ + 1)) = ⟨b.val, by omega⟩ := Fin.ext hab_val - rw [heq]; exact F₂.loopless _ + rw [heq]; exact F₂.loopless.irrefl _ rw [if_neg hF₁, if_neg hF₂] · -- a at root, b in F₁-only. F₂-part = 0 (glueCast₂ b = none). have hb_ge' : ¬ b.val ≥ n₁ + 1 := by omega @@ -7976,6 +7985,7 @@ theorem InTupleMultiEvalSpan.eval_sub_const {T K n : ℕ} InTupleMultiEvalSpan B W (fun ζ => multiLabeledEvalK K n M B W ζ - w) := by have h := (InTupleMultiEvalSpan.of_multi B W M).add (InTupleMultiEvalSpan.const B W (-w)) convert h using 1 + funext ζ; simp [Pi.add_apply, sub_eq_add_neg] /-- A Lagrange factor `(eval M · - eval M η) / (eval M ξ - eval M η)` is in the span. Mirrors `InRootedProfileSpan.lagrange_factor`. -/ @@ -8366,8 +8376,8 @@ theorem tupleEquivMulti_id_preserves_B {T : ℕ} have huv_ne : u ≠ v_p := fun he => hab (Fin.ext ((Fin.mk.injEq _ _ _ _).mp he)) let F : SimpleGraph (Fin (0 + T)) := { Adj := fun x y => (x = u ∧ y = v_p) ∨ (x = v_p ∧ y = u) - symm := fun _ _ h => h.elim (fun ⟨h1, h2⟩ => Or.inr ⟨h2, h1⟩) (fun ⟨h1, h2⟩ => Or.inl ⟨h2, h1⟩) - loopless := fun _ h => by + symm.symm := fun _ _ h => h.elim (fun ⟨h1, h2⟩ => Or.inr ⟨h2, h1⟩) (fun ⟨h1, h2⟩ => Or.inl ⟨h2, h1⟩) + loopless.irrefl := fun _ h => by rcases h with ⟨h1, h2⟩ | ⟨h1, h2⟩ · exact huv_ne (h1.symm.trans h2) · exact huv_ne (h2.symm.trans h1) } @@ -9828,7 +9838,8 @@ private theorem InRootedProfileSpan.profile_sub_const {T n : ℕ} have h₂ : InRootedProfileSpan B W (fun _ => -(rootedProfile B W j F)) := InRootedProfileSpan.const B W _ have h_combined := h₁.add h₂ - convert h_combined using 2 + convert h_combined using 1 + funext v; simp [rootedProfileFun, Pi.add_apply, sub_eq_add_neg] /-- **Lagrange factor**: scaled difference function from `profile_sub_const`. -/ private theorem InRootedProfileSpan.lagrange_factor {T n : ℕ} @@ -10197,11 +10208,12 @@ private theorem rootedProfileEquiv_of_tupleEquivSimple {T K : ℕ} B (ν (Quot.out (s(a, b) : Sym2 (Fin m))).1) (ν (Quot.out (s(a, b) : Sym2 (Fin m))).2) = B (ν a) (ν b) := by intro m ν a b - have h_out_eq : Sym2.mk (Quot.out (s(a, b) : Sym2 (Fin m))) = s(a, b) := + have h_out_eq : s((Quot.out (s(a, b) : Sym2 (Fin m))).1, + (Quot.out (s(a, b) : Sym2 (Fin m))).2) = s(a, b) := Quot.out_eq _ - rcases Sym2.mk_eq_mk_iff.mp h_out_eq with heq | heq - · rw [heq] - · rw [heq]; exact hB _ _ + rcases Sym2.eq_iff.mp h_out_eq with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · rw [h1, h2] + · rw [h1, h2]; exact hB _ _ -- Key identity: for any `ζ : Fin K → Fin T`, -- simpleEvalAt B W G ζ (= K-level eval of G at ζ) equals -- rootedProfile B W (ζ a) F (= K=1 eval of F at ζ a). @@ -10235,6 +10247,7 @@ private theorem rootedProfileEquiv_of_tupleEquivSimple {T K : ℕ} | _ x y => simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq] at * rw [SimpleGraph.mem_edgeSet] at he ⊢ + rw [SimpleGraph.map_adj] exact ⟨x, y, he, rfl, rfl⟩ · -- 2. Injective on F.edgeFinset. intro e1 _ e2 _ hij @@ -10246,6 +10259,7 @@ private theorem rootedProfileEquiv_of_tupleEquivSimple {T K : ℕ} induction e using Sym2.ind with | _ u v => rw [SimpleGraph.mem_edgeSet] at he + rw [SimpleGraph.map_adj] at he obtain ⟨x, y, hxy, hxu, hyv⟩ := he refine ⟨s(x, y), ?_, ?_⟩ · rw [SimpleGraph.mem_edgeFinset, SimpleGraph.mem_edgeSet]; exact hxy @@ -10626,13 +10640,13 @@ ensures `m + 2 ≥ 2`, so the graph has at least one edge. -/ def rootedCycleGraph (m : ℕ) : SimpleGraph (Fin (m + 2)) where Adj a b := (a.val + 1 = b.val) ∨ (b.val + 1 = a.val) ∨ (a.val = 0 ∧ b.val = m + 1) ∨ (a.val = m + 1 ∧ b.val = 0) - symm := fun a b h => by + symm.symm := fun a b h => by rcases h with h | h | ⟨h1, h2⟩ | ⟨h1, h2⟩ · exact Or.inr (Or.inl h) · exact Or.inl h · exact Or.inr (Or.inr (Or.inr ⟨h2, h1⟩)) · exact Or.inr (Or.inr (Or.inl ⟨h2, h1⟩)) - loopless := fun a h => by + loopless.irrefl := fun a h => by rcases h with h | h | ⟨h1, h2⟩ | ⟨h1, h2⟩ · omega · omega @@ -10654,7 +10668,7 @@ instance (m : ℕ) : DecidableRel (rootedCycleGraph m).Adj := by /-- Loopless property unfolding. -/ lemma rootedCycleGraph_not_adj_self {m : ℕ} (a : Fin (m + 2)) : ¬ (rootedCycleGraph m).Adj a a := - (rootedCycleGraph m).loopless a + (rootedCycleGraph m).loopless.irrefl a /-- Sum decomposition: a sum over `Fin (k+1) → α` decomposes as a double sum over the head (element of `α`) and the tail (`Fin k → α`). Re-indexing via @@ -10730,7 +10744,7 @@ lemma rootedCycleGraph_adj_iff_succ {m : ℕ} (a b : Fin (m + 3)) : · intro h rcases h with h | h · rw [← h]; exact cycleSucc_adj a - · rw [← h]; exact (rootedCycleGraph (m + 1)).symm (cycleSucc_adj b) + · rw [← h]; exact (cycleSucc_adj b).symm /-- `cycleSucc` is not its own inverse: `cycleSucc (cycleSucc j) ≠ j` on `Fin (m + 3)` (which has at least 3 elements, so no 2-cycles exist). -/ @@ -10807,7 +10821,8 @@ lemma rootedCycleGraph_edgeProduct_eq {T m : ℕ} intro j _ -- For each j: Quot.out of s(j, cycleSucc j) gives some (a, b) with -- Sym2.mk (a, b) = s(j, cycleSucc j); use Sym2.eq_iff + hB symmetry. - have hp : (Sym2.mk (Quot.out (s(j, cycleSucc j) : Sym2 _))) + have hp : s((Quot.out (s(j, cycleSucc j) : Sym2 _)).1, + (Quot.out (s(j, cycleSucc j) : Sym2 _)).2) = (s(j, cycleSucc j) : Sym2 _) := Quot.out_eq _ rw [Sym2.eq_iff] at hp rcases hp with ⟨h1, h2⟩ | ⟨h1, h2⟩ From 17954b9508ad75948a80ec7c8c2a0484298e1216 Mon Sep 17 00:00:00 2001 From: Cameron Freer Date: Sat, 27 Jun 2026 00:30:17 +0000 Subject: [PATCH 3/7] =?UTF-8?q?build:=20#upgrade=20=E2=80=94=20repair=20Si?= =?UTF-8?q?mpleRank=20+=20CycleKrylov=20for=20Lean=20v4.32.0-rc1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit API-fix pass (proof bodies only; no statement changes; sorries identical to baseline). - SimpleGraph inline builds (rootAttach, k23Arms, k2kArmsStructured): symm/loopless fields → nested-field syntax symm.symm / loopless.irrefl; .symm adjacency access → G.adj_symm / h.symm; G.loopless _ h → G.irrefl h. - Sym2: out_pair_eq / out_pair_eq' reworked off the curried Sym2.mk (s(p.1,p.2) + Sym2.eq_iff instead of Quot.out_eq + Sym2.mk_eq_mk_iff); Sym2.map_pair_eq → Sym2.map_mk. - convert depth/Pi-add residuals closed with ext+simp. #70 rank framework survives the upgrade (verified via #print axioms): multiEvalSubmodule_eq_orbitInvariantSubmodule — clean [propext, choice, Quot.sound] finrank_orbitInvariantSubmodule — clean vertexOrbitRel_of_rootedProfileEquiv — sorryAx via the one intentional residue only. lake build Graphon.CycleKrylov: 0 errors. --- Graphon/CycleKrylov.lean | 38 ++++++++++---------------- Graphon/SimpleRank.lean | 59 ++++++++++++++++++---------------------- 2 files changed, 41 insertions(+), 56 deletions(-) diff --git a/Graphon/CycleKrylov.lean b/Graphon/CycleKrylov.lean index a6cee87..30b0e47 100644 --- a/Graphon/CycleKrylov.lean +++ b/Graphon/CycleKrylov.lean @@ -963,14 +963,12 @@ def k23Arms (a b c : ℕ) : SimpleGraph (Fin (4 + a + b + c + 1)) where (∃ l < 3, ∃ s ≤ armLen a b c l, ((u : ℕ) = armSeq a b c l s ∧ (v : ℕ) = armSeq a b c l (s + 1)) ∨ ((v : ℕ) = armSeq a b c l s ∧ (u : ℕ) = armSeq a b c l (s + 1))) - symm := by - intro u v h + symm.symm := fun u v h => by rcases h with ⟨h1, h2⟩ | ⟨h1, h2⟩ | ⟨l, hl, s, hs, h⟩ · exact Or.inr (Or.inl ⟨h1, h2⟩) · exact Or.inl ⟨h1, h2⟩ · exact Or.inr (Or.inr ⟨l, hl, s, hs, h.symm⟩) - loopless := by - intro u h + loopless.irrefl := fun u h => by rcases h with ⟨h1, h2⟩ | ⟨h1, h2⟩ | ⟨l, hl, s, hs, h⟩ · omega · omega @@ -1133,12 +1131,10 @@ theorem k23Edge_injective (a b c : ℕ) : private theorem out_pair_eq {T' n : ℕ} (Bm : Fin T' → Fin T' → ℝ) (hB : ∀ i j, Bm i j = Bm j i) (τ : Fin n → Fin T') (x y : Fin n) : Bm (τ (Quot.out s(x, y)).1) (τ (Quot.out s(x, y)).2) = Bm (τ x) (τ y) := by - have hout := Quot.out_eq s(x, y) - rw [Sym2.mk_eq_mk_iff] at hout - rcases hout with h | h - · rw [congrArg Prod.fst h, congrArg Prod.snd h] - · simp only [Prod.swap] at h - rw [congrArg Prod.fst h, congrArg Prod.snd h, hB] + have hout : s((Quot.out s(x, y)).1, (Quot.out s(x, y)).2) = s(x, y) := Quot.out_eq _ + rcases Sym2.eq_iff.mp hout with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · rw [h1, h2] + · rw [h1, h2, hB] /-- **Edge-product factorization** for `k23Arms`: the edge product splits into the three root-edge factors times the three independent arm-chain products. -/ @@ -1893,13 +1889,11 @@ def k2kArmsStructured (k : ℕ) (armLen : Fin k → ℕ) : (∃ l : Fin k, ∃ s ≤ armLen l, (u = K2kVertex.armNode k armLen l s ∧ v = K2kVertex.armNode k armLen l (s + 1)) ∨ (v = K2kVertex.armNode k armLen l s ∧ u = K2kVertex.armNode k armLen l (s + 1))) - symm := by - intro u v h + symm.symm := fun u v h => by rcases h with ⟨l, h⟩ | ⟨l, s, hs, h⟩ · exact Or.inl ⟨l, h.symm⟩ · exact Or.inr ⟨l, s, hs, h.symm⟩ - loopless := by - intro u h + loopless.irrefl := fun u h => by rcases h with ⟨l, h⟩ | ⟨l, s, hs, h⟩ · obtain ⟨h1, h2⟩ | ⟨h1, h2⟩ := h <;> (rw [h1] at h2; simp at h2) · obtain ⟨h1, h2⟩ | ⟨h1, h2⟩ := h <;> @@ -1977,12 +1971,10 @@ theorem k2kArmsStructured_edgeFinset (k : ℕ) (armLen : Fin k → ℕ) : theorem out_pair_eq' {T' : ℕ} {V : Type*} (Bm : Fin T' → Fin T' → ℝ) (hB : ∀ i j, Bm i j = Bm j i) (g : V → Fin T') (x y : V) : Bm (g (Quot.out s(x, y)).1) (g (Quot.out s(x, y)).2) = Bm (g x) (g y) := by - have hout := Quot.out_eq s(x, y) - rw [Sym2.mk_eq_mk_iff] at hout - rcases hout with h | h - · rw [congrArg Prod.fst h, congrArg Prod.snd h] - · simp only [Prod.swap] at h - rw [congrArg Prod.fst h, congrArg Prod.snd h, hB] + have hout : s((Quot.out s(x, y)).1, (Quot.out s(x, y)).2) = s(x, y) := Quot.out_eq _ + rcases Sym2.eq_iff.mp hout with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · rw [h1, h2] + · rw [h1, h2, hB] /-- Arm index of a vertex (anchors/internals carry their arm; root/hub `none`). Used to recover `(l, s)` from a chain endpoint in `k2kEdge_injective`. -/ @@ -2612,7 +2604,7 @@ theorem decorateAtSum_edge_disjoint {n m : ℕ} (F : SimpleGraph (Fin (n + 1))) have hk : (hDecorEmb u) (Fin.succ k) = Sum.inr k := by simp [hDecorEmb] rw [hk] at hb'; rw [← hb] at hb'; exact absurd hb' (by simp) subst ha0 hb0 - exact H.loopless 0 hadj' + exact H.irrefl hadj' /-- **Edge-product transport + split** (Commit 1 steps 1–2): the `rootedProfile` edge product over `decorateAt F H u` factors, through `decorVertexEquiv`, into the @@ -2895,7 +2887,7 @@ theorem decorateAll_F_sup_disjoint {n m : ℕ} (F : SimpleGraph (Fin (n + 1))) · rfl · exact absurd (hb'.trans hb.symm) (by simp [embedHCopy]) subst ha0 hb0 - exact H.loopless 0 hadj' + exact H.irrefl hadj' /-- The `Finset.sup` of the `H`-copies has edge finset the disjoint union of the per-copy edge finsets. -/ @@ -3247,7 +3239,7 @@ theorem decorateAllFam_F_sup_disjoint {n : ℕ} {mfam : Fin n → ℕ} · rfl · exact absurd (hb'.trans hb.symm) (by simp [embedHCopyFam]) subst ha0 hb0 - exact (Hfam w).loopless 0 hadj' + exact (Hfam w).irrefl hadj' theorem decorateAllFamSum_sup_edgeFinset {n : ℕ} {mfam : Fin n → ℕ} (Hfam : (w : Fin n) → SimpleGraph (Fin (mfam w + 1))) [∀ w, DecidableRel (Hfam w).Adj] : diff --git a/Graphon/SimpleRank.lean b/Graphon/SimpleRank.lean index 1dac268..a6d3cfc 100644 --- a/Graphon/SimpleRank.lean +++ b/Graphon/SimpleRank.lean @@ -184,7 +184,9 @@ private theorem InRootedProfileSpan.profile_sub_const {T n : ℕ} have h₂ : InRootedProfileSpan B W (fun _ => -(rootedProfile B W j F)) := InRootedProfileSpan.const B W _ have h_combined := h₁.add h₂ - convert h_combined using 2 + convert h_combined using 1 + ext v + simp [rootedProfileFun, Pi.add_apply, sub_eq_add_neg] /-- Lagrange factor: scaled difference function. -/ private theorem InRootedProfileSpan.lagrange_factor {T n : ℕ} @@ -442,18 +444,16 @@ private def rootAttach (n : ℕ) (G : SimpleGraph (Fin (n + 1))) : (u.val = 0 ∧ v.val = 1) ∨ (u.val = 1 ∧ v.val = 0) ∨ (1 ≤ u.val ∧ 1 ≤ v.val ∧ G.Adj ⟨u.val - 1, by omega⟩ ⟨v.val - 1, by omega⟩) - symm := by - intro u v h + symm.symm := fun u v h => by rcases h with ⟨hu, hv⟩ | ⟨hu, hv⟩ | ⟨hu, hv, hadj⟩ · right; left; exact ⟨hv, hu⟩ · left; exact ⟨hv, hu⟩ - · right; right; exact ⟨hv, hu, G.symm hadj⟩ - loopless := by - intro v h + · right; right; exact ⟨hv, hu, G.adj_symm hadj⟩ + loopless.irrefl := fun v h => by rcases h with ⟨h1, h2⟩ | ⟨h1, h2⟩ | ⟨_, _, hadj⟩ · omega · omega - · exact G.loopless _ hadj + · exact G.irrefl hadj private instance rootAttachDecRel (n : ℕ) (G : SimpleGraph (Fin (n + 1))) [DecidableRel G.Adj] : DecidableRel (rootAttach n G).Adj := @@ -497,8 +497,8 @@ private theorem rootAttach_edgeFinset (n : ℕ) (G : SimpleGraph (Fin (n + 1))) induction e' using Sym2.ind with | _ a b => rw [SimpleGraph.mem_edgeSet] at he' - simp only [Sym2.map_pair_eq, Fin.coe_succEmb, SimpleGraph.mem_edgeSet] - exact Or.inr (Or.inr ⟨by simp, by simp, by convert he' using 2⟩) + simp only [Sym2.map_mk, Fin.coe_succEmb, SimpleGraph.mem_edgeSet] + exact Or.inr (Or.inr ⟨by simp, by simp, by convert he' using 2 <;> simp [Fin.val_succ]⟩) /-- The bridge edge is not a shifted `G`-edge. -/ private theorem rootAttach_bridge_not_mem_shifted (n : ℕ) @@ -532,34 +532,27 @@ private theorem rootAttach_prod_eq {k : ℕ} (n : ℕ) (G : SimpleGraph (Fin (n Finset.prod_map G.edgeFinset (Fin.succEmb (n + 1)).sym2Map] congr 1 · -- Bridge edge: resolve Quot.out - have hout := Quot.out_eq s((0 : Fin (n + 2)), ⟨1, by omega⟩) - rw [Sym2.mk_eq_mk_iff] at hout - rcases hout with h | h - · rw [congr_arg Prod.fst h, congr_arg Prod.snd h, h1eq] - · have h1 := congr_arg Prod.fst h; have h2 := congr_arg Prod.snd h - simp only [Prod.swap] at h1 h2 - rw [h1, h2, h1eq, hc] + have hout : s((Quot.out s((0 : Fin (n + 2)), ⟨1, by omega⟩)).1, + (Quot.out s((0 : Fin (n + 2)), ⟨1, by omega⟩)).2) = + s((0 : Fin (n + 2)), ⟨1, by omega⟩) := Quot.out_eq _ + rcases Sym2.eq_iff.mp hout with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · rw [h1, h2, h1eq] + · rw [h1, h2, h1eq, hc] · congr 1; ext e -- Shifted edge: resolve Quot.out of mapped edge (use symmetry of c) induction e using Sym2.ind with | _ a b => - simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq, Fin.coe_succEmb] - have hout := Quot.out_eq s(Fin.succ a, Fin.succ b) - rw [Sym2.mk_eq_mk_iff] at hout - have hout' := Quot.out_eq s(a, b) - rw [Sym2.mk_eq_mk_iff] at hout' - rcases hout with h | h <;> rcases hout' with h' | h' - · rw [congr_arg Prod.fst h, congr_arg Prod.snd h, - congr_arg Prod.fst h', congr_arg Prod.snd h'] - · rw [congr_arg Prod.fst h, congr_arg Prod.snd h] - simp only [Prod.swap] at h' - rw [congr_arg Prod.fst h', congr_arg Prod.snd h', hc] - · simp only [Prod.swap] at h - rw [congr_arg Prod.fst h, congr_arg Prod.snd h, - congr_arg Prod.fst h', congr_arg Prod.snd h', hc] - · simp only [Prod.swap] at h h' - rw [congr_arg Prod.fst h, congr_arg Prod.snd h, - congr_arg Prod.fst h', congr_arg Prod.snd h'] + simp only [Function.Embedding.sym2Map_apply, Sym2.map_mk, Fin.coe_succEmb] + have hout : s((Quot.out s(Fin.succ a, Fin.succ b)).1, + (Quot.out s(Fin.succ a, Fin.succ b)).2) = + s(Fin.succ a, Fin.succ b) := Quot.out_eq _ + have hout' : s((Quot.out s(a, b)).1, (Quot.out s(a, b)).2) = s(a, b) := Quot.out_eq _ + rcases Sym2.eq_iff.mp hout with ⟨h1, h2⟩ | ⟨h1, h2⟩ <;> + rcases Sym2.eq_iff.mp hout' with ⟨h1', h2'⟩ | ⟨h1', h2'⟩ + · rw [h1, h2, h1', h2'] + · rw [h1, h2, h1', h2', hc] + · rw [h1, h2, h1', h2', hc] + · rw [h1, h2, h1', h2'] /-- `rootedProfile` in `Fin.cons` form (bridging `simpleEvalAt`'s dif-based coordinate assignment to the cons-based one). -/ From a88b62818df37f947b7bbc4480ba0cf4b88984f3 Mon Sep 17 00:00:00 2001 From: Cameron Freer Date: Sat, 27 Jun 2026 00:39:20 +0000 Subject: [PATCH 4/7] =?UTF-8?q?build:=20#upgrade=20=E2=80=94=20repair=20co?= =?UTF-8?q?re=20analysis=20chain=20for=20Lean=20v4.32.0-rc1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Basic, Step, HomDensity, CutNorm, Pullback, CutDistance, Approximation, Regularity, Compactness, Counting + leaves (Operator, Sampling, Operations) — all 0 errors. Proof bodies only; sorries identical to baseline. v4.32 API changes handled: - Measure.prod is now noncomputable ⟹ FORCED 'noncomputable' modifier on defs that build through it: Graphon.zero/one/compl, SignedGraphon.sub (Basic), SymmKernel.pullback, Graphon.pullback (Pullback). Modifier-only; no type/statement change. - Sym2.mk curried (HomDensity): Sym2.mk (Quot.out e) → s((out e).1,(out e).2). - empty 'simp only' now errors (Regularity, Compactness): removed / replaced with the follow-up tactic that already closed the goal. - zero_le is now a 0-ary proposition, not zero_le _ (Regularity). - Summable goal: convert+ext → Summable.congr (Compactness). --- Graphon/Basic.lean | 8 ++++---- Graphon/Compactness.lean | 3 +-- Graphon/HomDensity.lean | 3 ++- Graphon/Pullback.lean | 4 ++-- Graphon/Regularity.lean | 12 ++++-------- 5 files changed, 13 insertions(+), 17 deletions(-) diff --git a/Graphon/Basic.lean b/Graphon/Basic.lean index ccb1ca5..4c3efa7 100644 --- a/Graphon/Basic.lean +++ b/Graphon/Basic.lean @@ -214,7 +214,7 @@ variable [IsProbabilityMeasure μ] For a sequence of empty graphs `Gₙ` (graphs with no edges), the edge density between any two sets converges to 0, giving the graphon `W(x,y) = 0` for all `x,y`. -/ -def zero : Graphon α μ where +noncomputable def zero : Graphon α μ where toAEEqFun := AEEqFun.const (α × α) 0 symm' := by have h1 : ∀ᵐ p ∂(μ.prod μ), (AEEqFun.const (α × α) (0 : ℝ) : (α × α) →ₘ[μ.prod μ] ℝ) p = 0 := @@ -232,7 +232,7 @@ def zero : Graphon α μ where For a sequence of complete graphs `Kₙ`, the edge density between any two sets converges to 1, giving the graphon `W(x,y) = 1` for all `x,y`. -/ -def one : Graphon α μ where +noncomputable def one : Graphon α μ where toAEEqFun := AEEqFun.const (α × α) 1 symm' := by have h1 : ∀ᵐ p ∂(μ.prod μ), (AEEqFun.const (α × α) (1 : ℝ) : (α × α) →ₘ[μ.prod μ] ℝ) p = 1 := @@ -268,7 +268,7 @@ Key properties: If `W` is the graphon limit of graphs `Gₙ`, then `compl W` is the limit of the complement graphs `Ḡₙ`. The edge probability `W(x,y)` becomes the non-edge probability `1 - W(x,y)`. -/ -def compl (W : Graphon α μ) : Graphon α μ where +noncomputable def compl (W : Graphon α μ) : Graphon α μ where toAEEqFun := AEEqFun.const (α × α) 1 - W.toAEEqFun symm' := by have hsub_ae : ∀ᵐ p ∂(μ.prod μ), @@ -382,7 +382,7 @@ If `W₁(x,y) ∈ [0,1]` and `W₂(x,y) ∈ [0,1]` a.e., then This operation is fundamental for defining the cut distance: `δ□(U, W) = inf_φ ‖U - W^φ‖_□` where `W^φ` is a pullback of `W`. -/ -def sub (W₁ W₂ : Graphon α μ) : SignedGraphon α μ where +noncomputable def sub (W₁ W₂ : Graphon α μ) : SignedGraphon α μ where toAEEqFun := W₁.toAEEqFun - W₂.toAEEqFun symm' := by have hsub_ae := AEEqFun.coeFn_sub W₁.toAEEqFun W₂.toAEEqFun diff --git a/Graphon/Compactness.lean b/Graphon/Compactness.lean index 0f570a6..aa0cdba 100644 --- a/Graphon/Compactness.lean +++ b/Graphon/Compactness.lean @@ -792,7 +792,7 @@ private theorem exists_cutNormDiff_cauchy_realignment summable_geometric_of_lt_one (by positivity) (by norm_num) have h2 := h.mul_left 2 simp only [one_div] at h2 - convert h2 using 1; ext k; rw [inv_pow]; ring + exact h2.congr (fun k => by rw [inv_pow]; ring) refine ⟨f, hf, δ, hδ_sum, hδ_pos, fun k => ?_⟩ -- Key calc: f (k+1) = f k . trans (σ k), so ⇑(f (k+1)) = σ_k ∘ f_k -- pb(V(k+1), f_{k+1}) = pb(V(k+1), σ_k ∘ f_k) = pb(pb(V(k+1), σ_k), f_k) @@ -1171,7 +1171,6 @@ private theorem exists_limit_measure_of_summable (by simp [hc_empty]) (by intro f hf h_disj - simp only [] rw [hc_additive hf h_disj] exact ENNReal.ofReal_tsum_of_nonneg (fun i => hc_nn (f i) (hf i)) (Summable.of_nonneg_of_le (fun i => hc_nn (f i) (hf i)) diff --git a/Graphon/HomDensity.lean b/Graphon/HomDensity.lean index eaed6c5..ce3759e 100644 --- a/Graphon/HomDensity.lean +++ b/Graphon/HomDensity.lean @@ -120,7 +120,8 @@ theorem homDensity_bot (W : Graphon α μ) : theorem edge_out_ne {F : SimpleGraph V} [DecidableRel F.Adj] {e : Sym2 V} (he : e ∈ F.edgeSet) : (Quot.out e).1 ≠ (Quot.out e).2 := by have h_not_diag := F.not_isDiag_of_mem_edgeSet he - have h_eq : e = Sym2.mk (Quot.out e) := (Quot.out_eq e).symm + have h_eq : e = s((Quot.out e).1, (Quot.out e).2) := by + simp [Sym2.mk, Quot.out_eq] rw [h_eq, Sym2.mk_isDiag_iff] at h_not_diag exact h_not_diag diff --git a/Graphon/Pullback.lean b/Graphon/Pullback.lean index 0f0abab..578f7aa 100644 --- a/Graphon/Pullback.lean +++ b/Graphon/Pullback.lean @@ -62,7 +62,7 @@ theorem measurePreserving_prodMap_self {φ : α → β} (hφ : MeasurePreserving Given a symmetric kernel `W : β × β → ℝ` and a measure-preserving map `φ : α → β`, the pullback `W^φ(x, y) = W(φ(x), φ(y))` is again a symmetric kernel on `α`. -/ -def pullback (W : SymmKernel β ν) (φ : α → β) (hφ : MeasurePreserving φ μ ν) : +noncomputable def pullback (W : SymmKernel β ν) (φ : α → β) (hφ : MeasurePreserving φ μ ν) : SymmKernel α μ where toAEEqFun := W.toAEEqFun.compMeasurePreserving (Prod.map φ φ) (measurePreserving_prodMap_self hφ) symm' := by @@ -117,7 +117,7 @@ This operation is fundamental for defining the cut distance: Key property: `t(F, W^φ) = t(F, W)` for all graphs F (proved in `homDensity_pullback`). -/ @[blueprint "def:pullback" (title := /-- Pullback of a graphon -/)] -def pullback (W : Graphon β ν) (φ : α → β) (hφ : MeasurePreserving φ μ ν) : +noncomputable def pullback (W : Graphon β ν) (φ : α → β) (hφ : MeasurePreserving φ μ ν) : Graphon α μ where toSymmKernel := W.toSymmKernel.pullback φ hφ ae_mem_Icc := by diff --git a/Graphon/Regularity.lean b/Graphon/Regularity.lean index 9b393c8..7ef5542 100644 --- a/Graphon/Regularity.lean +++ b/Graphon/Regularity.lean @@ -139,8 +139,7 @@ theorem tAverage_measurable (W : Graphon α μ) (T : Set α) (hT : MeasurableSet -- Use StronglyMeasurable.integral_prod_right for restricted measure have h1 : StronglyMeasurable fun x => ∫ y, W.toAEEqFun (x, y) ∂(μ.restrict T) := StronglyMeasurable.integral_prod_right W.toAEEqFun.stronglyMeasurable - simp only [Measure.restrict_apply'] at h1 ⊢ - convert h1 using 1 + exact h1 exact h_int.measurable /-- The T-average takes values in [0, 1] for a.e. x when W is a graphon. @@ -362,7 +361,6 @@ theorem tAverage_sq_le_defect_div (W : Graphon α μ) (S T : Set α) have h2 : (W.toAEEqFun (x, y) - c) ^ 2 ≤ 4 := by obtain ⟨h1a, h1b⟩ := abs_le.mp h1 have := sq_le_sq' h1a h1b - simp only at this linarith [sq_nonneg (W.toAEEqFun (x, y) - c)] rw [abs_of_nonneg (sq_nonneg _)] exact h2 @@ -580,7 +578,6 @@ theorem defect_eq_within_plus_between (W : Graphon α μ) (S T : Set α) have h2 : (W.toAEEqFun (x, y) - c) ^ 2 ≤ 4 := by obtain ⟨h1a, h1b⟩ := abs_le.mp h1 have := sq_le_sq' h1a h1b - simp only at this linarith [sq_nonneg (W.toAEEqFun (x, y) - c)] rw [abs_of_nonneg (sq_nonneg _)] exact h2 @@ -629,7 +626,6 @@ theorem defect_eq_within_plus_between (W : Graphon α μ) (S T : Set α) rw [abs_le]; constructor <;> linarith [ha.1, ha.2, hb.1, hb.2] obtain ⟨h1a, h1b⟩ := abs_le.mp h1 have := sq_le_sq' h1a h1b - simp only at this linarith [sq_nonneg (a - b)] -- Integrability of (W - W_T)² on T for a.e. x @@ -835,7 +831,7 @@ theorem exists_variance_cut (f : α → ℝ) (S : Set α) (hS : MeasurableSet S) rw [ae_restrict_iff' hS] -- The set (A_high ∪ A_low) ∩ S has measure 0 have h_null_in_S : μ ((A_high ∪ A_low) ∩ S) = 0 := by - apply le_antisymm _ (zero_le _) + apply le_antisymm _ (zero_le) calc μ ((A_high ∪ A_low) ∩ S) ≤ μ (A_high ∪ A_low) := measure_mono Set.inter_subset_left _ = 0 := h_union_zero -- Outside this null set, the bound holds @@ -4697,7 +4693,7 @@ theorem exists_measurable_subset_of_measure [StandardBorelSpace α] [NoAtoms μ] refine ⟨?_, ?_, ?_, ?_⟩ · show MeasurableSet (step 0).2; rw [h0]; exact hS · show (step 0).2 ⊆ S; rw [h0] - · show (step 0).1 ≤ r; rw [h0]; exact zero_le r + · show (step 0).1 ≤ r; rw [h0]; exact zero_le · show r - (step 0).1 ≤ μ (step 0).2; rw [h0]; simpa using hr | succ n ih => obtain ⟨hR_meas, hR_sub, hacc_le, hgap⟩ := ih @@ -4896,7 +4892,7 @@ private theorem exists_equal_measure_partition [StandardBorelSpace α] [NoAtoms -- Show q ≤ μ R (since μ R = (m+1) * q ≥ q) have hq_le : q ≤ μ R := by rw [hR_mu] - exact le_mul_of_one_le_left (zero_le q) + exact le_mul_of_one_le_left (zero_le) (by exact_mod_cast Nat.one_le_iff_ne_zero.mpr (Nat.succ_ne_zero m)) -- Apply IVT oracle to get a piece T ⊆ R with μ T = q obtain ⟨T, hT_meas, hT_sub, hT_mu⟩ := exists_measurable_subset_of_measure hR_meas hq_le From 1947fa523b823f74a58ab3ee4926247b0847515b Mon Sep 17 00:00:00 2001 From: Cameron Freer Date: Sat, 27 Jun 2026 01:29:16 +0000 Subject: [PATCH 5/7] =?UTF-8?q?build:=20#upgrade=20=E2=80=94=20repair=20Ma?= =?UTF-8?q?trixDetermination=20for=20Lean=20v4.32.0-rc1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The heavy file (103 errors). Proof bodies only; no statement changes; sorries identical to baseline (incl. the frozen-motif and Lovász-infrastructure sorries). v4.32 API changes handled: - ~64 inline SimpleGraph builds / Sym2 sites: symm/loopless → Std.Symm/Std.Irrefl nested-field syntax; Sym2.map_pair_eq → Sym2.map_mk; curried Sym2.mk reworks. - Equiv.Perm inverse: π⁻¹ vs .symm — bridged with Equiv.Perm.inv_def so Equiv.apply_symm_apply / Equiv.symm_apply_apply fire again. lake build Graphon.MatrixDetermination: 0 errors. --- Graphon/MatrixDetermination.lean | 596 +++++++++++++++---------------- 1 file changed, 297 insertions(+), 299 deletions(-) diff --git a/Graphon/MatrixDetermination.lean b/Graphon/MatrixDetermination.lean index 0ab8168..468cce9 100644 --- a/Graphon/MatrixDetermination.lean +++ b/Graphon/MatrixDetermination.lean @@ -89,9 +89,9 @@ noncomputable def wDeg {k : ℕ} (c : Fin k → Fin k → ℝ) (w : Fin k → /-- Star graph on m+1 vertices: vertex 0 is adjacent to vertices 1, ..., m. -/ def starGraph (m : ℕ) : SimpleGraph (Fin (m + 1)) where Adj u v := (u = 0 ∧ v ≠ 0) ∨ (u ≠ 0 ∧ v = 0) - symm := fun {u v} h => by + symm.symm := fun u v h => by rcases h with ⟨hu, hv⟩ | ⟨hu, hv⟩ <;> [right; left] <;> exact ⟨hv, hu⟩ - loopless := fun v h => by + loopless.irrefl := fun v h => by rcases h with ⟨h1, h2⟩ | ⟨h1, h2⟩ · exact h2 h1 · exact h1 h2 @@ -170,12 +170,12 @@ private theorem starGraph_prod_eq {k : ℕ} (m : ℕ) (c : Fin k → Fin k → ∏ j : Fin m, c (σ 0) (σ j.succ) := by rw [starGraph_edgeFinset, Finset.prod_image (starEdge_injOn m)] congr 1; ext j - have hout := Quot.out_eq s((0 : Fin (m + 1)), j.succ) - rw [Sym2.mk_eq_mk_iff] at hout - rcases hout with h | h - · rw [congr_arg Prod.fst h, congr_arg Prod.snd h] - · have h1 := congr_arg Prod.fst h; have h2 := congr_arg Prod.snd h - simp only [Prod.swap] at h1 h2; rw [h1, h2, hc] + have hout : s((Quot.out s((0 : Fin (m + 1)), j.succ)).1, + (Quot.out s((0 : Fin (m + 1)), j.succ)).2) = s(0, j.succ) := Quot.out_eq _ + rw [Sym2.eq_iff] at hout + rcases hout with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · rw [h1, h2] + · rw [h1, h2, hc] set_option maxHeartbeats 800000 in private theorem weightedHomSum_starGraph {k : ℕ} (m : ℕ) (c : Fin k → Fin k → ℝ) @@ -218,13 +218,13 @@ def doubleStarGraph (m p : ℕ) : SimpleGraph (Fin (m + p + 2)) where (v.val = 0 ∧ (u.val = 1 ∨ (2 ≤ u.val ∧ u.val ≤ m + 1))) ∨ (u.val = 1 ∧ m + 2 ≤ v.val) ∨ (v.val = 1 ∧ m + 2 ≤ u.val) - symm := fun {u v} h => by + symm.symm := fun u v h => by rcases h with h | h | h | h · right; left; exact ⟨h.1, h.2⟩ · left; exact ⟨h.1, h.2⟩ · right; right; right; exact ⟨h.1, h.2⟩ · right; right; left; exact ⟨h.1, h.2⟩ - loopless := fun v h => by + loopless.irrefl := fun v h => by rcases h with ⟨h1, h2⟩ | ⟨h1, h2⟩ | ⟨h1, h2⟩ | ⟨h1, h2⟩ · rcases h2 with h2 | ⟨h2, _⟩ <;> omega · rcases h2 with h2 | ⟨h2, _⟩ <;> omega @@ -363,26 +363,29 @@ private theorem doubleStarGraph_prod_eq {k : ℕ} (m p : ℕ) (c : Fin k → Fin Finset.prod_image (doubleStarEdge_right_injOn m p)] congr 1 · congr 1 - · have hout := Quot.out_eq s((0 : Fin (m+p+2)), ⟨1, by omega⟩) - rw [Sym2.mk_eq_mk_iff] at hout - rcases hout with h | h - · rw [congr_arg Prod.fst h, congr_arg Prod.snd h] - · have h1 := congr_arg Prod.fst h; have h2 := congr_arg Prod.snd h - simp only [Prod.swap] at h1 h2; rw [h1, h2, hc] + · have hout : s((Quot.out s((0 : Fin (m+p+2)), ⟨1, by omega⟩)).1, + (Quot.out s((0 : Fin (m+p+2)), ⟨1, by omega⟩)).2) = + s(0, ⟨1, by omega⟩) := Quot.out_eq _ + rw [Sym2.eq_iff] at hout + rcases hout with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · rw [h1, h2] + · rw [h1, h2, hc] · congr 1; ext j - have hout := Quot.out_eq s((0 : Fin (m+p+2)), ⟨j.val + 2, by omega⟩) - rw [Sym2.mk_eq_mk_iff] at hout - rcases hout with h | h - · rw [congr_arg Prod.fst h, congr_arg Prod.snd h] - · have h1 := congr_arg Prod.fst h; have h2 := congr_arg Prod.snd h - simp only [Prod.swap] at h1 h2; rw [h1, h2, hc] + have hout : s((Quot.out s((0 : Fin (m+p+2)), ⟨j.val + 2, by omega⟩)).1, + (Quot.out s((0 : Fin (m+p+2)), ⟨j.val + 2, by omega⟩)).2) = + s(0, ⟨j.val + 2, by omega⟩) := Quot.out_eq _ + rw [Sym2.eq_iff] at hout + rcases hout with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · rw [h1, h2] + · rw [h1, h2, hc] · congr 1; ext j - have hout := Quot.out_eq s((⟨1, by omega⟩ : Fin (m+p+2)), ⟨j.val + m + 2, by omega⟩) - rw [Sym2.mk_eq_mk_iff] at hout - rcases hout with h | h - · rw [congr_arg Prod.fst h, congr_arg Prod.snd h] - · have h1 := congr_arg Prod.fst h; have h2 := congr_arg Prod.snd h - simp only [Prod.swap] at h1 h2; rw [h1, h2, hc] + have hout : s((Quot.out s((⟨1, by omega⟩ : Fin (m+p+2)), ⟨j.val + m + 2, by omega⟩)).1, + (Quot.out s((⟨1, by omega⟩ : Fin (m+p+2)), ⟨j.val + m + 2, by omega⟩)).2) = + s(⟨1, by omega⟩, ⟨j.val + m + 2, by omega⟩) := Quot.out_eq _ + rw [Sym2.eq_iff] at hout + rcases hout with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · rw [h1, h2] + · rw [h1, h2, hc] /-- The sum over `Fin (m + p) → Fin k` of a product that factors into independent left and right parts equals the product of the individual sums. -/ @@ -704,7 +707,7 @@ def profileStarGraph (m r p : ℕ) : SimpleGraph (Fin (m + r * (p + 1) + 1)) whe ∃ l : Fin p, v = profileLeafPos m p b l) ∨ (∃ b : Fin r, v = profileBridgePos m p b ∧ ∃ l : Fin p, u = profileLeafPos m p b l) - symm := fun {u v} h => by + symm.symm := fun u v h => by rcases h with h | h | ⟨b, h⟩ | ⟨b, h⟩ | ⟨b, h₁, l, h₂⟩ | ⟨b, h₁, l, h₂⟩ · right; left; exact h · left; exact h @@ -712,7 +715,7 @@ def profileStarGraph (m r p : ℕ) : SimpleGraph (Fin (m + r * (p + 1) + 1)) whe · right; right; left; exact ⟨b, h⟩ · right; right; right; right; right; exact ⟨b, h₁, l, h₂⟩ · right; right; right; right; left; exact ⟨b, h₁, l, h₂⟩ - loopless := fun v h => by + loopless.irrefl := fun v h => by simp only [profileBridgePos, profileLeafPos] at h rcases h with ⟨h1, h2, _⟩ | ⟨h1, h2, _⟩ | ⟨b, h1, h2⟩ | ⟨b, h1, h2⟩ | ⟨b, h1, l, h2⟩ | ⟨b, h1, l, h2⟩ @@ -892,29 +895,30 @@ private theorem profileStarGraph_prod_eq {k : ℕ} (m r p : ℕ) congr 1 · congr 1 · congr 1; ext j - have hout := Quot.out_eq s((0 : Fin (m + r * (p + 1) + 1)), ⟨j.val + 1, by omega⟩) - rw [Sym2.mk_eq_mk_iff] at hout - rcases hout with h | h - · rw [congr_arg Prod.fst h, congr_arg Prod.snd h] - · have h1 := congr_arg Prod.fst h; have h2 := congr_arg Prod.snd h - simp only [Prod.swap] at h1 h2; rw [h1, h2, hc] + have hout : s((Quot.out s((0 : Fin (m + r * (p + 1) + 1)), ⟨j.val + 1, by omega⟩)).1, + (Quot.out s((0 : Fin (m + r * (p + 1) + 1)), ⟨j.val + 1, by omega⟩)).2) = + s(0, ⟨j.val + 1, by omega⟩) := Quot.out_eq _ + rw [Sym2.eq_iff] at hout + rcases hout with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · rw [h1, h2] + · rw [h1, h2, hc] · congr 1; ext b - have hout := Quot.out_eq - s((0 : Fin (m + r * (p + 1) + 1)), profileBridgePos m p b) - rw [Sym2.mk_eq_mk_iff] at hout - rcases hout with h | h - · rw [congr_arg Prod.fst h, congr_arg Prod.snd h] - · have h1 := congr_arg Prod.fst h; have h2 := congr_arg Prod.snd h - simp only [Prod.swap] at h1 h2; rw [h1, h2, hc] + have hout : s((Quot.out s((0 : Fin (m + r * (p + 1) + 1)), profileBridgePos m p b)).1, + (Quot.out s((0 : Fin (m + r * (p + 1) + 1)), profileBridgePos m p b)).2) = + s(0, profileBridgePos m p b) := Quot.out_eq _ + rw [Sym2.eq_iff] at hout + rcases hout with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · rw [h1, h2] + · rw [h1, h2, hc] · rw [Fintype.prod_prod_type] congr 1; ext b; congr 1; ext l - have hout := Quot.out_eq - s(profileBridgePos m p b, profileLeafPos m p b l) - rw [Sym2.mk_eq_mk_iff] at hout - rcases hout with h | h - · rw [congr_arg Prod.fst h, congr_arg Prod.snd h] - · have h1 := congr_arg Prod.fst h; have h2 := congr_arg Prod.snd h - simp only [Prod.swap] at h1 h2; rw [h1, h2, hc] + have hout : s((Quot.out s(profileBridgePos m p b, profileLeafPos m p b l)).1, + (Quot.out s(profileBridgePos m p b, profileLeafPos m p b l)).2) = + s(profileBridgePos m p b, profileLeafPos m p b l) := Quot.out_eq _ + rw [Sym2.eq_iff] at hout + rcases hout with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · rw [h1, h2] + · rw [h1, h2, hc] /-- Sum over `Fin (r * n) → Fin k` of a product that factors into r independent blocks equals the product of the individual sums. -/ @@ -1205,7 +1209,7 @@ def multiProfileStarGraph (m L : ℕ) (r p : Fin L → ℕ) : ∃ j : Fin (p l), v = mpLeafPos m r p l b j) ∨ (∃ l : Fin L, ∃ b : Fin (r l), v = mpBridgePos m r p l b ∧ ∃ j : Fin (p l), u = mpLeafPos m r p l b j) - symm := fun {u v} h => by + symm.symm := fun u v h => by rcases h with h | h | ⟨l, b, h⟩ | ⟨l, b, h⟩ | ⟨l, b, h₁, j, h₂⟩ | ⟨l, b, h₁, j, h₂⟩ · right; left; exact h · left; exact h @@ -1213,7 +1217,7 @@ def multiProfileStarGraph (m L : ℕ) (r p : Fin L → ℕ) : · right; right; left; exact ⟨l, b, h⟩ · right; right; right; right; right; exact ⟨l, b, h₁, j, h₂⟩ · right; right; right; right; left; exact ⟨l, b, h₁, j, h₂⟩ - loopless := fun v h => by + loopless.irrefl := fun v h => by simp only [mpBridgePos, mpLeafPos] at h rcases h with ⟨h1, h2, _⟩ | ⟨h1, h2, _⟩ | ⟨l, b, h1, h2⟩ | ⟨l, b, h1, h2⟩ | ⟨l, b, h1, j, h2⟩ | ⟨l, b, h1, j, h2⟩ @@ -1416,29 +1420,33 @@ private theorem multiProfileStarGraph_prod_eq {k : ℕ} (m L : ℕ) (r p : Fin L congr 1 · congr 1 · congr 1; ext j - have hout := Quot.out_eq - s((0 : Fin (m + multiProfileBranchTotal L r p + 1)), ⟨j.val + 1, by omega⟩) - rw [Sym2.mk_eq_mk_iff] at hout - rcases hout with h | h - · rw [congr_arg Prod.fst h, congr_arg Prod.snd h] - · have h1 := congr_arg Prod.fst h; have h2 := congr_arg Prod.snd h - simp only [Prod.swap] at h1 h2; rw [h1, h2, hc] + have hout : s((Quot.out s((0 : Fin (m + multiProfileBranchTotal L r p + 1)), + ⟨j.val + 1, by omega⟩)).1, + (Quot.out s((0 : Fin (m + multiProfileBranchTotal L r p + 1)), + ⟨j.val + 1, by omega⟩)).2) = + s(0, ⟨j.val + 1, by omega⟩) := Quot.out_eq _ + rw [Sym2.eq_iff] at hout + rcases hout with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · rw [h1, h2] + · rw [h1, h2, hc] · congr 1; ext ⟨l, b⟩ - have hout := Quot.out_eq - s((0 : Fin (m + multiProfileBranchTotal L r p + 1)), mpBridgePos m r p l b) - rw [Sym2.mk_eq_mk_iff] at hout - rcases hout with h | h - · rw [congr_arg Prod.fst h, congr_arg Prod.snd h] - · have h1 := congr_arg Prod.fst h; have h2 := congr_arg Prod.snd h - simp only [Prod.swap] at h1 h2; rw [h1, h2, hc] + have hout : s((Quot.out s((0 : Fin (m + multiProfileBranchTotal L r p + 1)), + mpBridgePos m r p l b)).1, + (Quot.out s((0 : Fin (m + multiProfileBranchTotal L r p + 1)), + mpBridgePos m r p l b)).2) = + s(0, mpBridgePos m r p l b) := Quot.out_eq _ + rw [Sym2.eq_iff] at hout + rcases hout with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · rw [h1, h2] + · rw [h1, h2, hc] · congr 1; ext ⟨l, b, j⟩ - have hout := Quot.out_eq - s(mpBridgePos m r p l b, mpLeafPos m r p l b j) - rw [Sym2.mk_eq_mk_iff] at hout - rcases hout with h | h - · rw [congr_arg Prod.fst h, congr_arg Prod.snd h] - · have h1 := congr_arg Prod.fst h; have h2 := congr_arg Prod.snd h - simp only [Prod.swap] at h1 h2; rw [h1, h2, hc] + have hout : s((Quot.out s(mpBridgePos m r p l b, mpLeafPos m r p l b j)).1, + (Quot.out s(mpBridgePos m r p l b, mpLeafPos m r p l b j)).2) = + s(mpBridgePos m r p l b, mpLeafPos m r p l b j) := Quot.out_eq _ + rw [Sym2.eq_iff] at hout + rcases hout with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · rw [h1, h2] + · rw [h1, h2, hc] set_option maxHeartbeats 8000000 in private theorem weightedHomSum_multiProfileStarGraph {k : ℕ} (m L : ℕ) @@ -2345,18 +2353,16 @@ private def rootAttach (n : ℕ) (G : SimpleGraph (Fin (n + 1))) : (u.val = 0 ∧ v.val = 1) ∨ (u.val = 1 ∧ v.val = 0) ∨ (1 ≤ u.val ∧ 1 ≤ v.val ∧ G.Adj ⟨u.val - 1, by omega⟩ ⟨v.val - 1, by omega⟩) - symm := by - intro u v h + symm.symm := fun u v h => by rcases h with ⟨hu, hv⟩ | ⟨hu, hv⟩ | ⟨hu, hv, hadj⟩ · right; left; exact ⟨hv, hu⟩ · left; exact ⟨hv, hu⟩ - · right; right; exact ⟨hv, hu, G.symm hadj⟩ - loopless := by - intro v h + · right; right; exact ⟨hv, hu, hadj.symm⟩ + loopless.irrefl := fun v h => by rcases h with ⟨h1, h2⟩ | ⟨h1, h2⟩ | ⟨_, _, hadj⟩ · omega · omega - · exact G.loopless _ hadj + · exact G.irrefl hadj private instance rootAttachDecRel (n : ℕ) (G : SimpleGraph (Fin (n + 1))) [DecidableRel G.Adj] : DecidableRel (rootAttach n G).Adj := @@ -2403,7 +2409,7 @@ private theorem rootAttach_edgeFinset (n : ℕ) (G : SimpleGraph (Fin (n + 1))) rw [SimpleGraph.mem_edgeSet] at he' simp only [Sym2.map_pair_eq, Fin.coe_succEmb, SimpleGraph.mem_edgeSet] exact Or.inr (Or.inr ⟨by simp [Fin.val_succ], by simp [Fin.val_succ], - by convert he' using 2⟩) + by convert he' using 2 <;> simp [Fin.val_succ]⟩) /-- The bridge edge is not a shifted `G`-edge. -/ private theorem rootAttach_bridge_not_mem_shifted (n : ℕ) @@ -2437,34 +2443,29 @@ private theorem rootAttach_prod_eq {k : ℕ} (n : ℕ) (G : SimpleGraph (Fin (n Finset.prod_map G.edgeFinset (Fin.succEmb (n + 1)).sym2Map] congr 1 · -- Bridge edge: resolve Quot.out - have hout := Quot.out_eq s((0 : Fin (n + 2)), ⟨1, by omega⟩) - rw [Sym2.mk_eq_mk_iff] at hout - rcases hout with h | h - · rw [congr_arg Prod.fst h, congr_arg Prod.snd h, h1eq] - · have h1 := congr_arg Prod.fst h; have h2 := congr_arg Prod.snd h - simp only [Prod.swap] at h1 h2 - rw [h1, h2, h1eq, hc] + have hout : s((Quot.out s((0 : Fin (n + 2)), ⟨1, by omega⟩)).1, + (Quot.out s((0 : Fin (n + 2)), ⟨1, by omega⟩)).2) = + s(0, ⟨1, by omega⟩) := Quot.out_eq _ + rw [Sym2.eq_iff] at hout + rcases hout with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · rw [h1, h2, h1eq] + · rw [h1, h2, h1eq, hc] · congr 1; ext e -- Shifted edge: resolve Quot.out of mapped edge (use symmetry of c) induction e using Sym2.ind with | _ a b => simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq, Fin.coe_succEmb] - have hout := Quot.out_eq s(Fin.succ a, Fin.succ b) - rw [Sym2.mk_eq_mk_iff] at hout - have hout' := Quot.out_eq s(a, b) - rw [Sym2.mk_eq_mk_iff] at hout' - rcases hout with h | h <;> rcases hout' with h' | h' - · rw [congr_arg Prod.fst h, congr_arg Prod.snd h, - congr_arg Prod.fst h', congr_arg Prod.snd h'] - · rw [congr_arg Prod.fst h, congr_arg Prod.snd h] - simp only [Prod.swap] at h' - rw [congr_arg Prod.fst h', congr_arg Prod.snd h', hc] - · simp only [Prod.swap] at h - rw [congr_arg Prod.fst h, congr_arg Prod.snd h, - congr_arg Prod.fst h', congr_arg Prod.snd h', hc] - · simp only [Prod.swap] at h h' - rw [congr_arg Prod.fst h, congr_arg Prod.snd h, - congr_arg Prod.fst h', congr_arg Prod.snd h'] + have hout : s((Quot.out s(Fin.succ a, Fin.succ b)).1, + (Quot.out s(Fin.succ a, Fin.succ b)).2) = s(Fin.succ a, Fin.succ b) := + Quot.out_eq _ + rw [Sym2.eq_iff] at hout + have hout' : s((Quot.out s(a, b)).1, (Quot.out s(a, b)).2) = s(a, b) := Quot.out_eq _ + rw [Sym2.eq_iff] at hout' + rcases hout with ⟨h1, h2⟩ | ⟨h1, h2⟩ <;> rcases hout' with ⟨h1', h2'⟩ | ⟨h1', h2'⟩ + · rw [h1, h2, h1', h2'] + · rw [h1, h2, h1', h2', hc] + · rw [h1, h2, h1', h2', hc] + · rw [h1, h2, h1', h2'] set_option maxHeartbeats 1600000 in /-- Root attachment realizes the weighted adjacency operator: @@ -2516,16 +2517,14 @@ private def rootGlue (n₁ n₂ : ℕ) (F₁ : SimpleGraph (Fin (n₁ + 1))) ((u.val = 0 ∨ n₁ < u.val) ∧ (v.val = 0 ∨ n₁ < v.val) ∧ F₂.Adj ⟨if u.val = 0 then 0 else u.val - n₁, by have := u.isLt; split_ifs <;> omega⟩ ⟨if v.val = 0 then 0 else v.val - n₁, by have := v.isLt; split_ifs <;> omega⟩) - symm := by - intro u v h + symm.symm := fun u v h => by rcases h with ⟨hu, hv, hadj⟩ | ⟨hu, hv, hadj⟩ - · left; exact ⟨hv, hu, by convert F₁.symm hadj using 2 <;> exact Fin.ext rfl⟩ - · right; exact ⟨hv, hu, F₂.symm hadj⟩ - loopless := by - intro v h + · left; exact ⟨hv, hu, by convert hadj.symm using 2 <;> exact Fin.ext rfl⟩ + · right; exact ⟨hv, hu, hadj.symm⟩ + loopless.irrefl := fun v h => by rcases h with ⟨_, _, hadj⟩ | ⟨_, _, hadj⟩ - · exact F₁.loopless _ hadj - · exact F₂.loopless _ hadj + · exact F₁.irrefl hadj + · exact F₂.irrefl hadj private instance rootGlueDecRel (n₁ n₂ : ℕ) (F₁ : SimpleGraph (Fin (n₁ + 1))) (F₂ : SimpleGraph (Fin (n₂ + 1))) [DecidableRel F₁.Adj] [DecidableRel F₂.Adj] : @@ -2665,13 +2664,15 @@ private theorem rootGlue_prod_eq {k : ℕ} (n₁ n₂ : ℕ) induction e using Sym2.ind with | _ a b => simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq, Function.comp_apply] - have hout_new := Quot.out_eq (Sym2.map emb s(a, b)) + have hout_new : s((Quot.out (Sym2.map emb s(a, b))).1, + (Quot.out (Sym2.map emb s(a, b))).2) = Sym2.map emb s(a, b) := + Quot.out_eq _ rw [Sym2.map_pair_eq] at hout_new - have hout_old := Quot.out_eq s(a, b) - rw [Sym2.mk_eq_mk_iff] at hout_new hout_old - rcases hout_new with hn | hn <;> rcases hout_old with ho | ho <;> { - rw [congr_arg Prod.fst hn, congr_arg Prod.snd hn, - congr_arg Prod.fst ho, congr_arg Prod.snd ho] + rw [Sym2.eq_iff] at hout_new + have hout_old : s((Quot.out s(a, b)).1, (Quot.out s(a, b)).2) = s(a, b) := Quot.out_eq _ + rw [Sym2.eq_iff] at hout_old + rcases hout_new with ⟨hn1, hn2⟩ | ⟨hn1, hn2⟩ <;> rcases hout_old with ⟨ho1, ho2⟩ | ⟨ho1, ho2⟩ <;> { + rw [hn1, hn2, ho1, ho2] try rfl try exact hc _ _ } @@ -2842,18 +2843,16 @@ private def leftAttach2 (n : ℕ) (F : SimpleGraph (Fin (n + 2))) : -- Shifted F-edges (∃ a b : Fin (n + 2), F.Adj a b ∧ leftAttach2Shift n a = u ∧ leftAttach2Shift n b = v) - symm := by - intro u v h + symm.symm := fun u v h => by rcases h with ⟨hu, hv⟩ | ⟨hu, hv⟩ | ⟨a, b, hadj, ha, hb⟩ · right; left; exact ⟨hv, hu⟩ · left; exact ⟨hv, hu⟩ - · right; right; exact ⟨b, a, F.symm hadj, hb, ha⟩ - loopless := by - intro v h + · right; right; exact ⟨b, a, hadj.symm, hb, ha⟩ + loopless.irrefl := fun v h => by rcases h with ⟨h1, h2⟩ | ⟨h1, h2⟩ | ⟨a, b, hadj, ha, hb⟩ · omega · omega - · have := (leftAttach2Shift n).injective (ha ▸ hb); exact F.loopless _ (this ▸ hadj) + · have := (leftAttach2Shift n).injective (ha ▸ hb); exact F.irrefl (this ▸ hadj) private instance leftAttach2DecRel (n : ℕ) (F : SimpleGraph (Fin (n + 2))) [DecidableRel F.Adj] : DecidableRel (leftAttach2 n F).Adj := @@ -2940,34 +2939,29 @@ private theorem leftAttach2_prod_eq {k : ℕ} (n : ℕ) (F : SimpleGraph (Fin (n Finset.prod_map F.edgeFinset (leftAttach2Shift n).sym2Map] congr 1 · -- Bridge edge: resolve Quot.out - have hout := Quot.out_eq s((0 : Fin ((n + 1) + 2)), ⟨2, by omega⟩) - rw [Sym2.mk_eq_mk_iff] at hout - rcases hout with h | h - · rw [congr_arg Prod.fst h, congr_arg Prod.snd h] - · have h1 := congr_arg Prod.fst h; have h2 := congr_arg Prod.snd h - simp only [Prod.swap] at h1 h2 - rw [h1, h2, hc] + have hout : s((Quot.out s((0 : Fin ((n + 1) + 2)), ⟨2, by omega⟩)).1, + (Quot.out s((0 : Fin ((n + 1) + 2)), ⟨2, by omega⟩)).2) = + s(0, ⟨2, by omega⟩) := Quot.out_eq _ + rw [Sym2.eq_iff] at hout + rcases hout with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · rw [h1, h2] + · rw [h1, h2, hc] · congr 1; ext e -- Shifted edge: resolve Quot.out of mapped edge (use symmetry of c) induction e using Sym2.ind with | _ a b => simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq] - have hout := Quot.out_eq s(leftAttach2Shift n a, leftAttach2Shift n b) - rw [Sym2.mk_eq_mk_iff] at hout - have hout' := Quot.out_eq s(a, b) - rw [Sym2.mk_eq_mk_iff] at hout' - rcases hout with h | h <;> rcases hout' with h' | h' - · rw [congr_arg Prod.fst h, congr_arg Prod.snd h, - congr_arg Prod.fst h', congr_arg Prod.snd h'] - · rw [congr_arg Prod.fst h, congr_arg Prod.snd h] - simp only [Prod.swap] at h' - rw [congr_arg Prod.fst h', congr_arg Prod.snd h', hc] - · simp only [Prod.swap] at h - rw [congr_arg Prod.fst h, congr_arg Prod.snd h, - congr_arg Prod.fst h', congr_arg Prod.snd h', hc] - · simp only [Prod.swap] at h h' - rw [congr_arg Prod.fst h, congr_arg Prod.snd h, - congr_arg Prod.fst h', congr_arg Prod.snd h'] + have hout : s((Quot.out s(leftAttach2Shift n a, leftAttach2Shift n b)).1, + (Quot.out s(leftAttach2Shift n a, leftAttach2Shift n b)).2) = + s(leftAttach2Shift n a, leftAttach2Shift n b) := Quot.out_eq _ + rw [Sym2.eq_iff] at hout + have hout' : s((Quot.out s(a, b)).1, (Quot.out s(a, b)).2) = s(a, b) := Quot.out_eq _ + rw [Sym2.eq_iff] at hout' + rcases hout with ⟨h1, h2⟩ | ⟨h1, h2⟩ <;> rcases hout' with ⟨h1', h2'⟩ | ⟨h1', h2'⟩ + · rw [h1, h2, h1', h2'] + · rw [h1, h2, h1', h2', hc] + · rw [h1, h2, h1', h2', hc] + · rw [h1, h2, h1', h2'] /-- Left attachment realizes the left adjacency operator for 2-labeled evaluation: `labeledEval2(leftAttach2 F)(i,j) = ∑ₐ wₐ c(i,a) labeledEval2(F)(a,j)`. -/ @@ -3046,18 +3040,16 @@ private def rightAttach2 (n : ℕ) (F : SimpleGraph (Fin (n + 2))) : -- Shifted F-edges (∃ a b : Fin (n + 2), F.Adj a b ∧ rightAttach2Shift n a = u ∧ rightAttach2Shift n b = v) - symm := by - intro u v h + symm.symm := fun u v h => by rcases h with ⟨hu, hv⟩ | ⟨hu, hv⟩ | ⟨a, b, hadj, ha, hb⟩ · right; left; exact ⟨hv, hu⟩ · left; exact ⟨hv, hu⟩ - · right; right; exact ⟨b, a, F.symm hadj, hb, ha⟩ - loopless := by - intro v h + · right; right; exact ⟨b, a, hadj.symm, hb, ha⟩ + loopless.irrefl := fun v h => by rcases h with ⟨h1, h2⟩ | ⟨h1, h2⟩ | ⟨a, b, hadj, ha, hb⟩ · omega · omega - · have := (rightAttach2Shift n).injective (ha ▸ hb); exact F.loopless _ (this ▸ hadj) + · have := (rightAttach2Shift n).injective (ha ▸ hb); exact F.irrefl (this ▸ hadj) private instance rightAttach2DecRel (n : ℕ) (F : SimpleGraph (Fin (n + 2))) [DecidableRel F.Adj] : DecidableRel (rightAttach2 n F).Adj := @@ -3133,33 +3125,28 @@ private theorem rightAttach2_prod_eq {k : ℕ} (n : ℕ) (F : SimpleGraph (Fin ( Finset.prod_insert (rightAttach2_bridge_not_mem_shifted n F), Finset.prod_map F.edgeFinset (rightAttach2Shift n).sym2Map] congr 1 - · have hout := Quot.out_eq s((⟨1, by omega⟩ : Fin ((n + 1) + 2)), ⟨2, by omega⟩) - rw [Sym2.mk_eq_mk_iff] at hout - rcases hout with h | h - · rw [congr_arg Prod.fst h, congr_arg Prod.snd h] - · have h1 := congr_arg Prod.fst h; have h2 := congr_arg Prod.snd h - simp only [Prod.swap] at h1 h2 - rw [h1, h2, hc] + · have hout : s((Quot.out s((⟨1, by omega⟩ : Fin ((n + 1) + 2)), ⟨2, by omega⟩)).1, + (Quot.out s((⟨1, by omega⟩ : Fin ((n + 1) + 2)), ⟨2, by omega⟩)).2) = + s(⟨1, by omega⟩, ⟨2, by omega⟩) := Quot.out_eq _ + rw [Sym2.eq_iff] at hout + rcases hout with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · rw [h1, h2] + · rw [h1, h2, hc] · congr 1; ext e induction e using Sym2.ind with | _ a b => simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq] - have hout := Quot.out_eq s(rightAttach2Shift n a, rightAttach2Shift n b) - rw [Sym2.mk_eq_mk_iff] at hout - have hout' := Quot.out_eq s(a, b) - rw [Sym2.mk_eq_mk_iff] at hout' - rcases hout with h | h <;> rcases hout' with h' | h' - · rw [congr_arg Prod.fst h, congr_arg Prod.snd h, - congr_arg Prod.fst h', congr_arg Prod.snd h'] - · rw [congr_arg Prod.fst h, congr_arg Prod.snd h] - simp only [Prod.swap] at h' - rw [congr_arg Prod.fst h', congr_arg Prod.snd h', hc] - · simp only [Prod.swap] at h - rw [congr_arg Prod.fst h, congr_arg Prod.snd h, - congr_arg Prod.fst h', congr_arg Prod.snd h', hc] - · simp only [Prod.swap] at h h' - rw [congr_arg Prod.fst h, congr_arg Prod.snd h, - congr_arg Prod.fst h', congr_arg Prod.snd h'] + have hout : s((Quot.out s(rightAttach2Shift n a, rightAttach2Shift n b)).1, + (Quot.out s(rightAttach2Shift n a, rightAttach2Shift n b)).2) = + s(rightAttach2Shift n a, rightAttach2Shift n b) := Quot.out_eq _ + rw [Sym2.eq_iff] at hout + have hout' : s((Quot.out s(a, b)).1, (Quot.out s(a, b)).2) = s(a, b) := Quot.out_eq _ + rw [Sym2.eq_iff] at hout' + rcases hout with ⟨h1, h2⟩ | ⟨h1, h2⟩ <;> rcases hout' with ⟨h1', h2'⟩ | ⟨h1', h2'⟩ + · rw [h1, h2, h1', h2'] + · rw [h1, h2, h1', h2', hc] + · rw [h1, h2, h1', h2', hc] + · rw [h1, h2, h1', h2'] /-- Right attachment realizes the right adjacency operator for 2-labeled evaluation: `labeledEval2(rightAttach2 F)(i,j) = ∑ₐ wₐ c(a,j) labeledEval2(F)(i,a)`. -/ @@ -3363,10 +3350,10 @@ private theorem pairOrbitRel_symm {T : ℕ} {B : Fin T → Fin T → ℝ} {W : F {p q : Fin T × Fin T} (h : pairOrbitRel B W p q) : pairOrbitRel B W q p := by obtain ⟨π, ⟨hw, hc⟩, h1, h2⟩ := h refine ⟨π⁻¹, ⟨fun i => ?_, fun i j => ?_⟩, ?_, ?_⟩ - · rw [← hw (π⁻¹ i), Equiv.Perm.apply_inv_self] - · rw [← hc (π⁻¹ i) (π⁻¹ j)]; simp - · rw [← h1, Equiv.Perm.inv_apply_self] - · rw [← h2, Equiv.Perm.inv_apply_self] + · rw [Equiv.Perm.inv_def] at *; rw [← hw (π.symm i), Equiv.apply_symm_apply] + · rw [Equiv.Perm.inv_def] at *; rw [← hc (π.symm i) (π.symm j)]; simp + · rw [Equiv.Perm.inv_def, ← h1, Equiv.symm_apply_apply] + · rw [Equiv.Perm.inv_def, ← h2, Equiv.symm_apply_apply] private theorem pairOrbitRel_trans {T : ℕ} {B : Fin T → Fin T → ℝ} {W : Fin T → ℝ} {p q r : Fin T × Fin T} @@ -3463,8 +3450,8 @@ private theorem pairInvariantSubspace_le_of_orbitIndicators {T : ℕ} private def eraseLabelEdge {n : ℕ} (F : SimpleGraph (Fin (n + 2))) : SimpleGraph (Fin (n + 2)) where Adj u v := F.Adj u v ∧ s(u, v) ≠ s((0 : Fin (n + 2)), 1) - symm u v h := ⟨F.symm h.1, by rw [Sym2.eq_swap]; exact h.2⟩ - loopless v h := F.loopless v h.1 + symm.symm := fun u v h => ⟨h.1.symm, by rw [Sym2.eq_swap]; exact h.2⟩ + loopless.irrefl := fun v h => F.irrefl h.1 private instance eraseLabelEdgeDecRel {n : ℕ} (F : SimpleGraph (Fin (n + 2))) [DecidableRel F.Adj] : DecidableRel (eraseLabelEdge F).Adj := @@ -3484,7 +3471,7 @@ private theorem eraseLabelEdge_of_not_adj {n : ℕ} {F : SimpleGraph (Fin (n + 2 rw [Sym2.eq_iff] at heq rcases heq with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ · exact absurd hadj h - · exact absurd (F.symm hadj) h + · exact absurd hadj.symm h /-- The edge finset of `eraseLabelEdge F` is `F.edgeFinset.erase s(0, 1)`. -/ private theorem eraseLabelEdge_edgeFinset {n : ℕ} (F : SimpleGraph (Fin (n + 2))) @@ -3524,12 +3511,13 @@ private theorem labeledEval2_eraseLabelEdge {k : ℕ} (n : ℕ) (Quot.out s((0 : Fin (n + 2)), 1)).1) ((Fin.cons i (Fin.cons j σ) : Fin (n + 2) → Fin k) (Quot.out s((0 : Fin (n + 2)), 1)).2) = c i j := by - have hout := Quot.out_eq s((0 : Fin (n + 2)), (1 : Fin (n + 2))) - rw [Sym2.mk_eq_mk_iff] at hout - rcases hout with h | h - · rw [congr_arg Prod.fst h, congr_arg Prod.snd h]; rfl - · simp only [Prod.swap] at h - rw [congr_arg Prod.fst h, congr_arg Prod.snd h]; exact hc j i + have hout : s((Quot.out s((0 : Fin (n + 2)), (1 : Fin (n + 2)))).1, + (Quot.out s((0 : Fin (n + 2)), (1 : Fin (n + 2)))).2) = s(0, 1) := + Quot.out_eq _ + rw [Sym2.eq_iff] at hout + rcases hout with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · rw [h1, h2]; simp [Fin.cons_zero, Fin.cons_one] + · rw [h1, h2]; simp [Fin.cons_zero, Fin.cons_one]; exact hc j i rw [hlabel]; ring /-! ### Edge-free gluing -/ @@ -3565,18 +3553,16 @@ private def edgeFreeGlue2 (n₁ n₂ : ℕ) glueShift1 n₁ n₂ a = u ∧ glueShift1 n₁ n₂ b = v) ∨ (∃ a b : Fin (n₂ + 2), F₂.Adj a b ∧ glueShift2 n₁ n₂ a = u ∧ glueShift2 n₁ n₂ b = v) - symm := by - intro u v h + symm.symm := fun u v h => by rcases h with ⟨a, b, hadj, ha, hb⟩ | ⟨a, b, hadj, ha, hb⟩ - · left; exact ⟨b, a, F₁.symm hadj, hb, ha⟩ - · right; exact ⟨b, a, F₂.symm hadj, hb, ha⟩ - loopless := by - intro v h + · left; exact ⟨b, a, hadj.symm, hb, ha⟩ + · right; exact ⟨b, a, hadj.symm, hb, ha⟩ + loopless.irrefl := fun v h => by rcases h with ⟨a, b, hadj, ha, hb⟩ | ⟨a, b, hadj, ha, hb⟩ · have := (glueShift1 n₁ n₂).injective (ha ▸ hb) - exact F₁.loopless _ (this ▸ hadj) + exact F₁.irrefl (this ▸ hadj) · have := (glueShift2 n₁ n₂).injective (ha ▸ hb) - exact F₂.loopless _ (this ▸ hadj) + exact F₂.irrefl (this ▸ hadj) private instance edgeFreeGlue2DecRel (n₁ n₂ : ℕ) (F₁ : SimpleGraph (Fin (n₁ + 2))) (F₂ : SimpleGraph (Fin (n₂ + 2))) [DecidableRel F₁.Adj] [DecidableRel F₂.Adj] : @@ -3698,15 +3684,15 @@ private theorem edgeFreeGlue2_edgeFinset_disjoint (n₁ n₂ : ℕ) False := fun ha hb => by rcases ha with ha₁0 | ha₁1 <;> rcases hb with hb₁0 | hb₁1 · have heq : a₁ = b₁ := Fin.ext (by omega) - exact absurd (heq ▸ he₁') (F₁.loopless a₁) + exact absurd (heq ▸ he₁') F₁.irrefl · rw [show a₁ = (0 : Fin (n₁ + 2)) from Fin.ext ha₁0, show b₁ = (1 : Fin (n₁ + 2)) from Fin.ext hb₁1] at he₁' exact h₁ he₁' · rw [show a₁ = (1 : Fin (n₁ + 2)) from Fin.ext ha₁1, show b₁ = (0 : Fin (n₁ + 2)) from Fin.ext hb₁0] at he₁' - exact h₁ (F₁.symm he₁') + exact h₁ he₁'.symm · have heq : a₁ = b₁ := Fin.ext (by omega) - exact absurd (heq ▸ he₁') (F₁.loopless a₁) + exact absurd (heq ▸ he₁') F₁.irrefl rcases Sym2.eq_iff.mp he₂eq with ⟨h1, h2⟩ | ⟨h1, h2⟩ · -- h1 : glueShift2(a₂) = glueShift1(a₁), h2 : glueShift2(b₂) = glueShift1(b₁) exact finish (small_of_fin_eq a₁ _ h1.symm) (small_of_fin_eq b₁ _ h2.symm) @@ -3742,13 +3728,15 @@ private theorem edgeFreeGlue2_prod_eq {k : ℕ} (n₁ n₂ : ℕ) induction e using Sym2.ind with | _ a b => simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq, Function.comp_apply] - have hout_new := Quot.out_eq (Sym2.map emb s(a, b)) + have hout_new : s((Quot.out (Sym2.map emb s(a, b))).1, + (Quot.out (Sym2.map emb s(a, b))).2) = Sym2.map emb s(a, b) := + Quot.out_eq _ rw [Sym2.map_pair_eq] at hout_new - have hout_old := Quot.out_eq s(a, b) - rw [Sym2.mk_eq_mk_iff] at hout_new hout_old - rcases hout_new with hn | hn <;> rcases hout_old with ho | ho <;> { - rw [congr_arg Prod.fst hn, congr_arg Prod.snd hn, - congr_arg Prod.fst ho, congr_arg Prod.snd ho] + rw [Sym2.eq_iff] at hout_new + have hout_old : s((Quot.out s(a, b)).1, (Quot.out s(a, b)).2) = s(a, b) := Quot.out_eq _ + rw [Sym2.eq_iff] at hout_old + rcases hout_new with ⟨hn1, hn2⟩ | ⟨hn1, hn2⟩ <;> rcases hout_old with ⟨ho1, ho2⟩ | ⟨ho1, ho2⟩ <;> { + rw [hn1, hn2, ho1, ho2] try rfl try exact hc _ _ } @@ -3863,13 +3851,13 @@ private noncomputable def edgeFreeEvalSpan {T : ℕ} (B : Fin T → Fin T → private def addLabelEdge {n : ℕ} (F : SimpleGraph (Fin (n + 2))) : SimpleGraph (Fin (n + 2)) where Adj u v := F.Adj u v ∨ s(u, v) = s((0 : Fin (n + 2)), 1) - symm u v h := by + symm.symm := fun u v h => by rcases h with h | h - · exact Or.inl (F.symm h) + · exact Or.inl h.symm · exact Or.inr (by rwa [Sym2.eq_swap]) - loopless v h := by + loopless.irrefl := fun v h => by rcases h with h | h - · exact F.loopless v h + · exact F.irrefl h · have := Sym2.eq_iff.mp h rcases this with ⟨h1, h2⟩ | ⟨h1, h2⟩ <;> simp_all @@ -3943,7 +3931,7 @@ private theorem eraseLabelEdge_addLabelEdge {n : ℕ} (F : SimpleGraph (Fin (n + rw [Sym2.eq_iff] at heq rcases heq with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ · exact absurd hadj h - · exact absurd (F.symm hadj) h + · exact absurd hadj.symm h /-- For an edge-free graph F, `labeledEval2 (addLabelEdge F) = B i j * labeledEval2 F`. -/ private theorem labeledEval2_addLabelEdge {k : ℕ} (n : ℕ) @@ -4472,20 +4460,22 @@ private theorem tupleEquiv_restrict {T : ℕ} B (ν (Quot.out (s(a, b) : Sym2 (Fin (n + (k + 1))))).1) (ν (Quot.out (s(a, b) : Sym2 (Fin (n + (k + 1))))).2) = B (ν a) (ν b) := by intro ν a b - have h_out_eq : Sym2.mk (Quot.out (s(a, b) : Sym2 (Fin (n + (k + 1))))) = - s(a, b) := Quot.out_eq _ - rcases Sym2.mk_eq_mk_iff.mp h_out_eq with heq | heq - · rw [heq] - · rw [heq]; exact hB _ _ + have h_out_eq : s((Quot.out (s(a, b) : Sym2 (Fin (n + (k + 1))))).1, + (Quot.out (s(a, b) : Sym2 (Fin (n + (k + 1))))).2) = s(a, b) := + Quot.out_eq _ + rcases Sym2.eq_iff.mp h_out_eq with ⟨heq1, heq2⟩ | ⟨heq1, heq2⟩ + · rw [heq1, heq2] + · rw [heq1, heq2]; exact hB _ _ have h_edge' : ∀ (ν : Fin (n + k) → Fin T) (a b : Fin (n + k)), B (ν (Quot.out (s(a, b) : Sym2 (Fin (n + k)))).1) (ν (Quot.out (s(a, b) : Sym2 (Fin (n + k)))).2) = B (ν a) (ν b) := by intro ν a b - have h_out_eq : Sym2.mk (Quot.out (s(a, b) : Sym2 (Fin (n + k)))) = s(a, b) := + have h_out_eq : s((Quot.out (s(a, b) : Sym2 (Fin (n + k)))).1, + (Quot.out (s(a, b) : Sym2 (Fin (n + k)))).2) = s(a, b) := Quot.out_eq _ - rcases Sym2.mk_eq_mk_iff.mp h_out_eq with heq | heq - · rw [heq] - · rw [heq]; exact hB _ _ + rcases Sym2.eq_iff.mp h_out_eq with ⟨heq1, heq2⟩ | ⟨heq1, heq2⟩ + · rw [heq1, heq2] + · rw [heq1, heq2]; exact hB _ _ -- Pivot: position k in Fin (n + (k + 1)). have hk : k < n + (k + 1) := by omega let p : Fin (n + (k + 1)) := ⟨k, hk⟩ @@ -4515,6 +4505,7 @@ private theorem tupleEquiv_restrict {T : ℕ} | _ a b => simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq] at * rw [SimpleGraph.mem_edgeSet] at he ⊢ + rw [SimpleGraph.map_adj] exact ⟨a, b, he, rfl, rfl⟩ · -- 2. Injective on edgeFinset. intro e1 _ e2 _ hij @@ -4525,8 +4516,8 @@ private theorem tupleEquiv_restrict {T : ℕ} rw [SimpleGraph.mem_edgeFinset] at he induction e using Sym2.ind with | _ x y => - rw [SimpleGraph.mem_edgeSet] at he - -- he : (SimpleGraph.map shift F').Adj x y + rw [SimpleGraph.mem_edgeSet, SimpleGraph.map_adj] at he + -- he : ∃ a b, F'.Adj a b ∧ shift a = x ∧ shift b = y obtain ⟨a, b, hab, hax, hby⟩ := he refine ⟨s(a, b), ?_, ?_⟩ · rw [SimpleGraph.mem_edgeFinset, SimpleGraph.mem_edgeSet]; exact hab @@ -4660,11 +4651,12 @@ private theorem tupleEquiv_dom_perm {T : ℕ} B (ν (Quot.out (s(a, b) : Sym2 (Fin (n + k)))).1) (ν (Quot.out (s(a, b) : Sym2 (Fin (n + k)))).2) = B (ν a) (ν b) := by intro ν a b - have h_out_eq : Sym2.mk (Quot.out (s(a, b) : Sym2 (Fin (n + k)))) = s(a, b) := + have h_out_eq : s((Quot.out (s(a, b) : Sym2 (Fin (n + k)))).1, + (Quot.out (s(a, b) : Sym2 (Fin (n + k)))).2) = s(a, b) := Quot.out_eq _ - rcases Sym2.mk_eq_mk_iff.mp h_out_eq with heq | heq - · rw [heq] - · rw [heq]; exact hB _ _ + rcases Sym2.eq_iff.mp h_out_eq with ⟨heq1, heq2⟩ | ⟨heq1, heq2⟩ + · rw [heq1, heq2] + · rw [heq1, heq2]; exact hB _ _ -- The key graph: F = SimpleGraph.map σ_perm.toEmbedding F'. let F : SimpleGraph (Fin (n + k)) := SimpleGraph.map σ_perm.toEmbedding F' haveI hF_dec : DecidableRel F.Adj := Classical.decRel _ @@ -4685,6 +4677,7 @@ private theorem tupleEquiv_dom_perm {T : ℕ} | _ a b => simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq] at * rw [SimpleGraph.mem_edgeSet] at he ⊢ + rw [SimpleGraph.map_adj] exact ⟨a, b, he, rfl, rfl⟩ · intro e1 _ e2 _ hij exact σ_perm.toEmbedding.sym2Map.injective hij @@ -4693,7 +4686,7 @@ private theorem tupleEquiv_dom_perm {T : ℕ} rw [SimpleGraph.mem_edgeFinset] at he induction e using Sym2.ind with | _ x y => - rw [SimpleGraph.mem_edgeSet] at he + rw [SimpleGraph.mem_edgeSet, SimpleGraph.map_adj] at he obtain ⟨a, b, hab, hax, hby⟩ := he refine ⟨s(a, b), ?_, ?_⟩ · rw [SimpleGraph.mem_edgeFinset, SimpleGraph.mem_edgeSet]; exact hab @@ -4805,20 +4798,22 @@ private theorem tupleEquiv_restrict_along {T k T' : ℕ} B (ν (Quot.out (s(a, b) : Sym2 (Fin (n + k)))).1) (ν (Quot.out (s(a, b) : Sym2 (Fin (n + k)))).2) = B (ν a) (ν b) := by intro ν a b - have h_out_eq : Sym2.mk (Quot.out (s(a, b) : Sym2 (Fin (n + k)))) = s(a, b) := + have h_out_eq : s((Quot.out (s(a, b) : Sym2 (Fin (n + k)))).1, + (Quot.out (s(a, b) : Sym2 (Fin (n + k)))).2) = s(a, b) := Quot.out_eq _ - rcases Sym2.mk_eq_mk_iff.mp h_out_eq with heq | heq - · rw [heq] - · rw [heq]; exact hB _ _ + rcases Sym2.eq_iff.mp h_out_eq with ⟨heq1, heq2⟩ | ⟨heq1, heq2⟩ + · rw [heq1, heq2] + · rw [heq1, heq2]; exact hB _ _ have h_edge' : ∀ (ν : Fin (n + T') → Fin T) (a b : Fin (n + T')), B (ν (Quot.out (s(a, b) : Sym2 (Fin (n + T')))).1) (ν (Quot.out (s(a, b) : Sym2 (Fin (n + T')))).2) = B (ν a) (ν b) := by intro ν a b - have h_out_eq : Sym2.mk (Quot.out (s(a, b) : Sym2 (Fin (n + T')))) = s(a, b) := + have h_out_eq : s((Quot.out (s(a, b) : Sym2 (Fin (n + T')))).1, + (Quot.out (s(a, b) : Sym2 (Fin (n + T')))).2) = s(a, b) := Quot.out_eq _ - rcases Sym2.mk_eq_mk_iff.mp h_out_eq with heq | heq - · rw [heq] - · rw [heq]; exact hB _ _ + rcases Sym2.eq_iff.mp h_out_eq with ⟨heq1, heq2⟩ | ⟨heq1, heq2⟩ + · rw [heq1, heq2] + · rw [heq1, heq2]; exact hB _ _ let G : SimpleGraph (Fin (n + k)) := SimpleGraph.map shift H haveI hG_dec : DecidableRel G.Adj := Classical.decRel _ suffices trans : ∀ (θ : Fin k → Fin T), @@ -4837,6 +4832,7 @@ private theorem tupleEquiv_restrict_along {T k T' : ℕ} | _ a b => simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq] at * rw [SimpleGraph.mem_edgeSet] at he ⊢ + rw [SimpleGraph.map_adj] exact ⟨a, b, he, rfl, rfl⟩ · intro e1 _ e2 _ hij exact shift.sym2Map.injective hij @@ -4845,7 +4841,7 @@ private theorem tupleEquiv_restrict_along {T k T' : ℕ} rw [SimpleGraph.mem_edgeFinset] at he induction e using Sym2.ind with | _ x y => - rw [SimpleGraph.mem_edgeSet] at he + rw [SimpleGraph.mem_edgeSet, SimpleGraph.map_adj] at he obtain ⟨a, b, hab, hax, hby⟩ := he refine ⟨s(a, b), ?_, ?_⟩ · rw [SimpleGraph.mem_edgeFinset, SimpleGraph.mem_edgeSet]; exact hab @@ -5212,8 +5208,8 @@ edges of `F` that are *not* between two label positions (both endpoints private def stripLL {n K : ℕ} (F : SimpleGraph (Fin (n + K))) : SimpleGraph (Fin (n + K)) where Adj u v := F.Adj u v ∧ ¬ (u.val < K ∧ v.val < K) - symm := fun _ _ ⟨h1, h2⟩ => ⟨F.symm h1, fun ⟨hu, hv⟩ => h2 ⟨hv, hu⟩⟩ - loopless := fun _ ⟨h1, _⟩ => F.loopless _ h1 + symm.symm := fun _ _ ⟨h1, h2⟩ => ⟨h1.symm, fun ⟨hu, hv⟩ => h2 ⟨hv, hu⟩⟩ + loopless.irrefl := fun _ ⟨h1, _⟩ => F.irrefl h1 private instance stripLL_decidableRel {n K : ℕ} (F : SimpleGraph (Fin (n + K))) [DecidableRel F.Adj] : @@ -5416,10 +5412,10 @@ private theorem tupleEquiv_id_bijective {T : ℕ} exact (Fin.mk.injEq _ _ _ _).mp he let F : SimpleGraph (Fin (0 + (S + 1))) := { Adj := fun x y => (x = u ∧ y = v_p) ∨ (x = v_p ∧ y = u) - symm := fun _ _ h => h.elim + symm.symm := fun _ _ h => h.elim (fun ⟨h1, h2⟩ => Or.inr ⟨h2, h1⟩) (fun ⟨h1, h2⟩ => Or.inl ⟨h2, h1⟩) - loopless := fun _ h => by + loopless.irrefl := fun _ h => by rcases h with ⟨h1, h2⟩ | ⟨h1, h2⟩ · exact huv_ne (h1.symm.trans h2) · exact huv_ne (h2.symm.trans h1) } @@ -5476,10 +5472,10 @@ private theorem tupleEquiv_id_bijective {T : ℕ} intro he; have := congrArg Fin.val he; simp [u', v'] at this let G : SimpleGraph (Fin (1 + (S + 1))) := { Adj := fun x y => (x = u' ∧ y = v') ∨ (x = v' ∧ y = u') - symm := fun _ _ h => h.elim + symm.symm := fun _ _ h => h.elim (fun ⟨h1, h2⟩ => Or.inr ⟨h2, h1⟩) (fun ⟨h1, h2⟩ => Or.inl ⟨h2, h1⟩) - loopless := fun _ h => by + loopless.irrefl := fun _ h => by rcases h with ⟨h1, h2⟩ | ⟨h1, h2⟩ · exact hne' (h1.symm.trans h2) · exact hne' (h2.symm.trans h1) } @@ -5510,8 +5506,7 @@ private theorem tupleEquiv_id_bijective {T : ℕ} rw [hσ] congr 1 set p := Quot.out (s(u', v') : Sym2 (Fin (1 + (S + 1)))) - have hout : Sym2.mk (Quot.out (s(u', v') : Sym2 (Fin (1 + (S + 1))))) = s(u', v') := - Quot.out_eq _ + have hout : s(p.1, p.2) = s(u', v') := Quot.out_eq _ have key : (p.1 = u' ∧ p.2 = v') ∨ (p.1 = v' ∧ p.2 = u') := by have := Sym2.eq_iff.mp hout rcases this with ⟨h1, h2⟩ | ⟨h1, h2⟩ <;> [left; right] <;> exact ⟨h1, h2⟩ @@ -5804,13 +5799,13 @@ private theorem labeledEvalK_glue (K : ℕ) (n₁ n₂ : ℕ) (∃ (hu : u.val < n₁ + K) (hv : v.val < n₁ + K), F₁.Adj ⟨u.val, hu⟩ ⟨v.val, hv⟩) ∨ (∃ (a b : Fin (n₂ + K)), emb₂ a = u ∧ emb₂ b = v ∧ F₂.Adj a b) - symm := fun u v h => by + symm.symm := fun u v h => by rcases h with ⟨hu, hv, hadj⟩ | ⟨a, b, ha, hb, hadj⟩ - · left; exact ⟨hv, hu, F₁.symm hadj⟩ - · right; exact ⟨b, a, hb, ha, F₂.symm hadj⟩ - loopless := fun v h => by + · left; exact ⟨hv, hu, hadj.symm⟩ + · right; exact ⟨b, a, hb, ha, hadj.symm⟩ + loopless.irrefl := fun v h => by rcases h with ⟨_, _, hadj⟩ | ⟨a, b, ha, hb, hadj⟩ - · exact F₁.loopless _ hadj + · exact F₁.irrefl hadj · -- emb₂ a = v = emb₂ b ⟹ a = b (emb₂ injective) ⟹ F₂.loopless contradiction have hab : a = b := by have heq : emb₂ a = emb₂ b := ha.trans hb.symm @@ -5818,7 +5813,7 @@ private theorem labeledEvalK_glue (K : ℕ) (n₁ n₂ : ℕ) by_cases hxa : a.val < K <;> by_cases hxb : b.val < K <;> simp only [hxa, hxb, dif_pos, dif_neg, not_false_eq_true, Fin.mk.injEq] at heq <;> exact Fin.ext (by omega) - subst hab; exact F₂.loopless _ hadj } + subst hab; exact F₂.irrefl hadj } haveI : DecidableRel F₃.Adj := fun u v => if h₁ : ∃ (hu : u.val < n₁ + K) (hv : v.val < n₁ + K), F₁.Adj ⟨u.val, hu⟩ ⟨v.val, hv⟩ then .isTrue (.inl h₁) @@ -6218,9 +6213,9 @@ private lemma llFactor_eq_of_tupleEquiv {T K : ℕ} exact Fin.ext h let F : SimpleGraph (Fin (0 + K)) := { Adj := fun a b => (a = u ∧ b = v) ∨ (a = v ∧ b = u) - symm := fun _ _ h => h.elim (fun ⟨h1, h2⟩ => Or.inr ⟨h2, h1⟩) - (fun ⟨h1, h2⟩ => Or.inl ⟨h2, h1⟩) - loopless := fun _ h => by + symm.symm := fun _ _ h => h.elim (fun ⟨h1, h2⟩ => Or.inr ⟨h2, h1⟩) + (fun ⟨h1, h2⟩ => Or.inl ⟨h2, h1⟩) + loopless.irrefl := fun _ h => by rcases h with ⟨h1, h2⟩ | ⟨h1, h2⟩ · exact hne (h1.symm.trans h2) · exact hne (h2.symm.trans h1) } @@ -6788,11 +6783,11 @@ private theorem DecLabeledGraph.trace_eval {T K n : ℕ} have h1 : τ_LHS u = τ_RHS (e u) := by have := hτ u simp only [τ_LHS, τ_RHS, e, finCongr_apply] - convert this using 0 + simp only [Fin.coe_cast]; exact this have h2 : τ_LHS v = τ_RHS (e v) := by have := hτ v simp only [τ_LHS, τ_RHS, e, finCongr_apply] - convert this using 0 + simp only [Fin.coe_cast]; exact this rw [h1, h2] /-! **`tupleEquiv`-invariance of the traced evaluation** — historical context. @@ -7145,7 +7140,7 @@ private noncomputable def MultiLabeledGraph.ofSimple {K n : ℕ} rw [if_neg] intro h rw [SimpleGraph.mem_edgeFinset, SimpleGraph.mem_edgeSet] at h - exact F.loopless _ h + exact F.irrefl h /-- **`multiLabeledEvalK` of `ofSimple F` matches `labeledEvalK F`.** @@ -7446,7 +7441,7 @@ private theorem DecLabeledGraph.trace_parallel_lu0_descends {T K n : ℕ} have h_not_graph : s(x, x) ∉ D.trace.graph.edgeFinset := by intro hmem rw [SimpleGraph.mem_edgeFinset, SimpleGraph.mem_edgeSet] at hmem - exact D.trace.graph.loopless x hmem + exact D.trace.graph.irrefl hmem show (if hcr : s(x, x) ∈ crossEdges then _ else if s(x, x) ∈ D.trace.graph.edgeFinset then 1 else (0 : ℕ)) = 0 rw [dif_neg h_not_cross, if_neg h_not_graph] } @@ -7688,18 +7683,16 @@ private theorem DecLabeledGraph.trace_eval_tupleEquiv_invariant {T K n : ℕ} D.trace.graph.Adj u v ∨ (∃ a : Fin K, D.trace.lu0Mult a = 1 ∧ ((u.val = a.val ∧ v.val = K) ∨ (u.val = K ∧ v.val = a.val))) - symm := by - intro u v h + symm.symm := fun u v h => by rcases h with h | ⟨a, hm, hor⟩ - · exact Or.inl (D.trace.graph.symm h) + · exact Or.inl h.symm · refine Or.inr ⟨a, hm, ?_⟩ rcases hor with ⟨h1, h2⟩ | ⟨h1, h2⟩ · exact Or.inr ⟨h2, h1⟩ · exact Or.inl ⟨h2, h1⟩ - loopless := by - intro v h + loopless.irrefl := fun v h => by rcases h with h | ⟨a, hm, hor⟩ - · exact D.trace.graph.loopless v h + · exact D.trace.graph.irrefl h · rcases hor with ⟨h1, h2⟩ | ⟨h1, h2⟩ · -- v.val = a.val and v.val = K, but a.val < K; contradiction have := a.isLt; omega @@ -7941,24 +7934,24 @@ private lemma DecLabeledGraph.llFactor_sym2_map_eq {T K n : ℕ} h.1⟩ : Fin K) = x := by apply Fin.ext have := congr_arg Fin.val hl1 - simpa [DecLabeledGraph.labelEmbed] using this + simp only [DecLabeledGraph.labelEmbed] at this; exact this have eq2 : (⟨(Quot.out (Sym2.map (DecLabeledGraph.labelEmbed (n := n)) s(x, y))).2.val, h.2⟩ : Fin K) = y := by apply Fin.ext have := congr_arg Fin.val hl2 - simpa [DecLabeledGraph.labelEmbed] using this + simp only [DecLabeledGraph.labelEmbed] at this; exact this rw [eq1, eq2] · -- Case 2: Quot.out picks (labelEmbed y, labelEmbed x); use hB. have eq1 : (⟨(Quot.out (Sym2.map (DecLabeledGraph.labelEmbed (n := n)) s(x, y))).1.val, h.1⟩ : Fin K) = y := by apply Fin.ext have := congr_arg Fin.val hl1 - simpa [DecLabeledGraph.labelEmbed] using this + simp only [DecLabeledGraph.labelEmbed] at this; exact this have eq2 : (⟨(Quot.out (Sym2.map (DecLabeledGraph.labelEmbed (n := n)) s(x, y))).2.val, h.2⟩ : Fin K) = x := by apply Fin.ext have := congr_arg Fin.val hl2 - simpa [DecLabeledGraph.labelEmbed] using this + simp only [DecLabeledGraph.labelEmbed] at this; exact this rw [eq1, eq2, hB] /-- **Helper 2** for `eval_ofSimple`: the LL-filter of `F.edgeFinset` is @@ -7981,17 +7974,17 @@ private lemma DecLabeledGraph.ll_filter_eq_map {n K : ℕ} have heq : Sym2.map (DecLabeledGraph.labelEmbed (n := n)) (s((⟨(Quot.out e).1.val, hP.1⟩ : Fin K), ⟨(Quot.out e).2.val, hP.2⟩) : Sym2 _) = e := by - simpa [Sym2.map_pair_eq, DecLabeledGraph.labelEmbed, + simp only [Sym2.map_pair_eq, DecLabeledGraph.labelEmbed, show (⟨(Quot.out e).1.val, _⟩ : Fin (n + K)) = (Quot.out e).1 from Fin.ext rfl, show (⟨(Quot.out e).2.val, _⟩ : Fin (n + K)) = (Quot.out e).2 from Fin.ext rfl] - using Quot.out_eq e + exact Quot.out_eq e rw [heq]; exact heF · -- labelEmbedding.sym2Map of preimage equals e. - simpa [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq, + simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq, DecLabeledGraph.labelEmbedding, show (⟨(Quot.out e).1.val, _⟩ : Fin (n + K)) = (Quot.out e).1 from Fin.ext rfl, show (⟨(Quot.out e).2.val, _⟩ : Fin (n + K)) = (Quot.out e).2 from Fin.ext rfl] - using Quot.out_eq e + exact Quot.out_eq e · rintro ⟨a, ha, rfl⟩ -- labelEmbedding.sym2Map a = Sym2.map labelEmbed a (defeq via simp). have hmap_eq : (DecLabeledGraph.labelEmbedding (n := n)).sym2Map a = @@ -8012,23 +8005,23 @@ private lemma DecLabeledGraph.ll_filter_eq_map {n K : ℕ} (s((DecLabeledGraph.labelEmbed (n := n) x : Fin (n + K)), DecLabeledGraph.labelEmbed (n := n) y) : Sym2 _)).1.val = x.val := by have := congr_arg Fin.val h1 - simpa [DecLabeledGraph.labelEmbed] using this + simp only [DecLabeledGraph.labelEmbed] at this; exact this have h2v : (Quot.out (s((DecLabeledGraph.labelEmbed (n := n) x : Fin (n + K)), DecLabeledGraph.labelEmbed (n := n) y) : Sym2 _)).2.val = y.val := by have := congr_arg Fin.val h2 - simpa [DecLabeledGraph.labelEmbed] using this + simp only [DecLabeledGraph.labelEmbed] at this; exact this exact ⟨h1v ▸ x.isLt, h2v ▸ y.isLt⟩ · have h1v : (Quot.out (s((DecLabeledGraph.labelEmbed (n := n) x : Fin (n + K)), DecLabeledGraph.labelEmbed (n := n) y) : Sym2 _)).1.val = y.val := by have := congr_arg Fin.val h1 - simpa [DecLabeledGraph.labelEmbed] using this + simp only [DecLabeledGraph.labelEmbed] at this; exact this have h2v : (Quot.out (s((DecLabeledGraph.labelEmbed (n := n) x : Fin (n + K)), DecLabeledGraph.labelEmbed (n := n) y) : Sym2 _)).2.val = x.val := by have := congr_arg Fin.val h2 - simpa [DecLabeledGraph.labelEmbed] using this + simp only [DecLabeledGraph.labelEmbed] at this; exact this exact ⟨h1v ▸ y.isLt, h2v ▸ x.isLt⟩ /-- Evaluation of `ofSimple F` recovers `labeledEvalK F` exactly. @@ -8102,20 +8095,20 @@ private theorem DecLabeledGraph.eval_ofSimple {T K n : ℕ} · have h1v : (Quot.out (Sym2.map (DecLabeledGraph.labelEmbed (n := n)) s(x, y))).1.val = x.val := by have := congr_arg Fin.val h1 - simpa [Sym2.map_pair_eq, DecLabeledGraph.labelEmbed] using this + simp only [Sym2.map_pair_eq, DecLabeledGraph.labelEmbed] at this; exact this have h2v : (Quot.out (Sym2.map (DecLabeledGraph.labelEmbed (n := n)) s(x, y))).2.val = y.val := by have := congr_arg Fin.val h2 - simpa [Sym2.map_pair_eq, DecLabeledGraph.labelEmbed] using this + simp only [Sym2.map_pair_eq, DecLabeledGraph.labelEmbed] at this; exact this exact ⟨h1v ▸ x.isLt, h2v ▸ y.isLt⟩ · have h1v : (Quot.out (Sym2.map (DecLabeledGraph.labelEmbed (n := n)) s(x, y))).1.val = y.val := by have := congr_arg Fin.val h1 - simpa [Sym2.map_pair_eq, DecLabeledGraph.labelEmbed] using this + simp only [Sym2.map_pair_eq, DecLabeledGraph.labelEmbed] at this; exact this have h2v : (Quot.out (Sym2.map (DecLabeledGraph.labelEmbed (n := n)) s(x, y))).2.val = x.val := by have := congr_arg Fin.val h2 - simpa [Sym2.map_pair_eq, DecLabeledGraph.labelEmbed] using this + simp only [Sym2.map_pair_eq, DecLabeledGraph.labelEmbed] at this; exact this exact ⟨h1v ▸ y.isLt, h2v ▸ x.isLt⟩ rw [dif_pos hcond] -- Apply Helper 1. @@ -8325,7 +8318,7 @@ private theorem product_trace_identity_of_eval_tupleEquiv_invariant intro hmem rw [SimpleGraph.mem_edgeFinset] at hmem simp only [Sym2.map_pair_eq] at hmem - exact p.2.loopless _ hmem + exact p.2.irrefl hmem · intro φ rw [DecLabeledGraph.eval_mul _ _ B hB W φ, hDeval] rw [DecLabeledGraph.eval_ofSimple p.2 B hB W φ] @@ -8983,8 +8976,8 @@ private theorem tr_k_singleton_descends {T K : ℕ} let G : SimpleGraph (Fin ((n + 1) + K)) := { Adj := fun u v => F.Adj ⟨u.val, by have := u.isLt; omega⟩ ⟨v.val, by have := v.isLt; omega⟩ - symm := fun _ _ h => F.symm h - loopless := fun _ h => F.loopless _ h } + symm.symm := fun _ _ h => h.symm + loopless.irrefl := fun _ h => F.irrefl h } haveI : DecidableRel G.Adj := fun u v => inferInstanceAs (Decidable (F.Adj ⟨u.val, _⟩ ⟨v.val, _⟩)) -- Bridge: `∑ t, W t · labeledEvalK (K+1) n F (snoc φ t) = labeledEvalK K (n+1) G φ`. @@ -9014,9 +9007,12 @@ private theorem tr_k_singleton_descends {T K : ℕ} · intro a ha refine Sym2.ind (fun u v _ => ?_) a ha simp only [Sym2.map_pair_eq] - have hout_F := Sym2.rel_iff'.mp (Sym2.eq.mp (Quot.out_eq (s(u, v)))) - have hout_G := Sym2.rel_iff'.mp - (Sym2.eq.mp (Quot.out_eq (s(e u, e v)))) + have hout_F : Quot.out s(u, v) = (u, v) ∨ Quot.out s(u, v) = (v, u) := + Sym2.rel_iff'.mp (Sym2.Rel.is_equivalence.eqvGen_iff.mp + (Quot.eqvGen_exact (Quot.out_eq s(u, v)))) + have hout_G : Quot.out s(e u, e v) = (e u, e v) ∨ Quot.out s(e u, e v) = (e v, e u) := + Sym2.rel_iff'.mp (Sym2.Rel.is_equivalence.eqvGen_iff.mp + (Quot.eqvGen_exact (Quot.out_eq s(e u, e v)))) suffices key : ∀ {m : ℕ} (a b : Fin m) (p : Fin m × Fin m), p = (a, b) ∨ p = (b, a) → ∀ (f : Fin m → Fin T), @@ -9234,7 +9230,7 @@ private theorem exists_decGraph_for_connCol {T K : ℕ} rw [if_neg] intro h rw [Sym2.map_pair_eq, SimpleGraph.mem_edgeFinset, SimpleGraph.mem_edgeSet] at h - exact p.2.loopless _ h + exact p.2.irrefl h /-- **Weighted inner product of two connection-matrix columns descends through the level-`K` `tupleEquiv` quotient** — the Lovász @@ -9911,9 +9907,9 @@ private theorem starKernel_tupleEquiv_invariant {T K : ℕ} simp only [ne_eq, Fin.mk.injEq, u, v]; have := a.isLt; omega let F : SimpleGraph (Fin (0 + (K + 1))) := { Adj := fun x y => (x = u ∧ y = v) ∨ (x = v ∧ y = u) - symm := fun _ _ h => h.elim (fun ⟨h1, h2⟩ => Or.inr ⟨h2, h1⟩) - (fun ⟨h1, h2⟩ => Or.inl ⟨h2, h1⟩) - loopless := fun _ h => by + symm.symm := fun _ _ h => h.elim (fun ⟨h1, h2⟩ => Or.inr ⟨h2, h1⟩) + (fun ⟨h1, h2⟩ => Or.inl ⟨h2, h1⟩) + loopless.irrefl := fun _ h => by rcases h with ⟨h1, h2⟩ | ⟨h1, h2⟩ · exact hne (h1.symm.trans h2) · exact hne (h2.symm.trans h1) } @@ -10484,8 +10480,8 @@ private theorem coeffRestrict_equiv {T : ℕ} let G : SimpleGraph (Fin ((n + 1) + k)) := { Adj := fun u v => F.Adj ⟨u.val, by have := u.isLt; omega⟩ ⟨v.val, by have := v.isLt; omega⟩ - symm := fun _ _ h => F.symm h - loopless := fun _ h => F.loopless _ h } + symm.symm := fun _ _ h => h.symm + loopless.irrefl := fun _ h => F.irrefl h } haveI : DecidableRel G.Adj := fun u v => inferInstanceAs (Decidable (F.Adj ⟨u.val, _⟩ ⟨v.val, _⟩)) -- Bridge: the trace lemma RHS equals labeledEvalK k (n+1) G B W φ. @@ -10525,9 +10521,12 @@ private theorem coeffRestrict_equiv {T : ℕ} -- B(τ_G(Quot.out s(eu,ev)).1)(τ_G(Quot.out s(eu,ev)).2) -- where τ_F, τ_G evaluate the same function on .val. -- Strategy: both sides = B(g(u.val))(g(v.val)) via Quot.out case analysis + hB. - have hout_F := Sym2.rel_iff'.mp (Sym2.eq.mp (Quot.out_eq (s(u, v)))) - have hout_G := Sym2.rel_iff'.mp - (Sym2.eq.mp (Quot.out_eq (s(e u, e v)))) + have hout_F : Quot.out s(u, v) = (u, v) ∨ Quot.out s(u, v) = (v, u) := + Sym2.rel_iff'.mp (Sym2.Rel.is_equivalence.eqvGen_iff.mp + (Quot.eqvGen_exact (Quot.out_eq s(u, v)))) + have hout_G : Quot.out s(e u, e v) = (e u, e v) ∨ Quot.out s(e u, e v) = (e v, e u) := + Sym2.rel_iff'.mp (Sym2.Rel.is_equivalence.eqvGen_iff.mp + (Quot.eqvGen_exact (Quot.out_eq s(e u, e v)))) -- Both sides evaluate B on endpoints of the same unordered pair, but -- Quot.out may choose different orderings. Use B-symmetry. -- Helper: for any (a,b) related to (u,v) in Sym2.Rel, the τ-value @@ -10605,7 +10604,6 @@ private theorem coeffRestrict_equiv {T : ℕ} -- Apply class_eq with g = indicator of [μ]. have := class_eq (fun η => @ite ℝ (tupleEquiv B W μ η) (Classical.dec _) 1 0) (fun η η' heq => by - simp only congr 1 exact propext ⟨fun h n F => (h n F).trans (heq n F), fun h n F => (h n F).trans (heq n F).symm⟩) @@ -10762,9 +10760,9 @@ private theorem labeledEvalK_separates {T : ℕ} -- Build F inline. let F : SimpleGraph (Fin (0 + (K + 1))) := { Adj := fun x y => (x = u ∧ y = v) ∨ (x = v ∧ y = u) - symm := fun _ _ h => h.elim (fun ⟨h1, h2⟩ => Or.inr ⟨h2, h1⟩) - (fun ⟨h1, h2⟩ => Or.inl ⟨h2, h1⟩) - loopless := fun _ h => by + symm.symm := fun _ _ h => h.elim (fun ⟨h1, h2⟩ => Or.inr ⟨h2, h1⟩) + (fun ⟨h1, h2⟩ => Or.inl ⟨h2, h1⟩) + loopless.irrefl := fun _ h => by rcases h with ⟨h1, h2⟩ | ⟨h1, h2⟩ · exact hne (h1.symm.trans h2) · exact hne (h2.symm.trans h1) } @@ -10843,9 +10841,9 @@ private theorem tupleEquiv_ext_eq_of_surj {T : ℕ} -- Define the single-edge graph inline. let F : SimpleGraph (Fin (0 + (k + 1))) := { Adj := fun x y => (x = u ∧ y = v) ∨ (x = v ∧ y = u) - symm := fun _ _ h => + symm.symm := fun _ _ h => h.elim (fun ⟨h1, h2⟩ => Or.inr ⟨h2, h1⟩) (fun ⟨h1, h2⟩ => Or.inl ⟨h2, h1⟩) - loopless := fun _ h => by + loopless.irrefl := fun _ h => by rcases h with ⟨h1, h2⟩ | ⟨h1, h2⟩ · exact hne (h1.symm.trans h2) · exact hne (h2.symm.trans h1) } From 444a379479b1c0512fd9060dd81f2f225a4d704d Mon Sep 17 00:00:00 2001 From: Cameron Freer Date: Sat, 27 Jun 2026 01:33:18 +0000 Subject: [PATCH 6/7] =?UTF-8?q?build:=20#upgrade=20=E2=80=94=20repair=20In?= =?UTF-8?q?verseCounting=20for=20Lean=20v4.32.0-rc1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Proof bodies only; no statement changes; sorries identical to baseline. - zero_le is now 0-ary: zero_le _ -> zero_le (7 sites). - ENNReal.toReal_eq_toReal -> ENNReal.toReal_eq_toReal_iff'. - ENNReal.toReal_prod now takes explicit (s) (f): toReal_prod -> toReal_prod _ _. (Convergence needed no changes once InverseCounting was green.) --- Graphon/InverseCounting.lean | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Graphon/InverseCounting.lean b/Graphon/InverseCounting.lean index 0f2c7a6..b1ed885 100644 --- a/Graphon/InverseCounting.lean +++ b/Graphon/InverseCounting.lean @@ -259,7 +259,7 @@ private theorem homDensity_mkStepGraphon_eq_weightedHomSum intro σ unfold Measure.real rw [Measure.pi_pi (fun _ => μ) (fun v => ι (σ v))] - exact ENNReal.toReal_prod + exact ENNReal.toReal_prod _ _ -- Rewrite and match weightedHomSum simp_rw [h_real_meas, smul_eq_mul] -- Now goal: ∑ σ, (∏ v, (μ(ι(σ(v)))).toReal) * (∏ e, c(ι(σ(e.1)), ι(σ(e.2)))) @@ -403,7 +403,7 @@ private theorem mkStepGraphon_eq_of_ae_coeff le_antisymm ((measure_biUnion_finset_le _ _).trans_eq (Finset.sum_eq_zero (fun S hS => (Finset.mem_filter.mp hS).2))) - (zero_le _) + (zero_le) have h_not_in_null : ∀ᵐ x ∂μ, x ∉ ⋃ S ∈ P.parts.filter (fun S => μ S = 0), S := compl_mem_ae_iff.mpr h_null_union @@ -618,7 +618,7 @@ private theorem exists_type_class_mp_bijection (fun i (_ : i ∈ Finset.univ.filter (type_c · = t)) => h_ne_top (embed i)) have h_ne_t := ENNReal.sum_ne_top.mpr (fun i (_ : i ∈ Finset.univ.filter (type_c' · = t)) => h_ne_top (embed i)) - rw [← ENNReal.toReal_eq_toReal h_ne_s h_ne_t, + rw [← ENNReal.toReal_eq_toReal_iff' h_ne_s h_ne_t, ENNReal.toReal_sum (fun i _ => h_ne_top (embed i)), ENNReal.toReal_sum (fun i _ => h_ne_top (embed i))] exact h_weight t @@ -901,7 +901,7 @@ private theorem exists_pullback_eq_of_step_homDensity_eq le_antisymm ((measure_biUnion_finset_le _ _).trans_eq (Finset.sum_eq_zero (fun S hS => (Finset.mem_filter.mp hS).2))) - (zero_le _) + (zero_le) have h_not_in_null : ∀ᵐ x ∂μ, x ∉ ⋃ S ∈ P.parts.filter (fun S => μ S = 0), S := compl_mem_ae_iff.mpr h_null_union @@ -1741,7 +1741,7 @@ private theorem exists_partition_with_measures {K : ℕ} exact hι_disj i j (fun h => hne (congrArg ι h)) -- ae_covers: complement ⊆ S₀ \ ⋃ C i, which is null · rw [ae_iff] - refine le_antisymm ?_ (zero_le _) + refine le_antisymm ?_ (zero_le) calc μ {x | ¬∃ S ∈ parts, x ∈ S} ≤ μ (S₀ \ ⋃ i, C i) := measure_mono (fun x hx => by push_neg at hx -- hx : ∀ S ∈ parts, x ∉ S @@ -1818,7 +1818,7 @@ private theorem exists_partition_with_measures {K : ℕ} -- Key: ⋃ i, T i = C₀ ∪ ⋃ j, C' j, so S \ (C₀ ∪ ⋃ C') = (S \ C₀) \ ⋃ C' = S' \ ⋃ C' suffices h : ∀ x, x ∈ S \ ⋃ i, @Fin.cons _ (fun _ => Set α) C₀ C' i → x ∈ S' \ ⋃ j, C' j by - exact le_antisymm (le_trans (measure_mono h) (le_of_eq hC'cov)) (zero_le _) + exact le_antisymm (le_trans (measure_mono h) (le_of_eq hC'cov)) (zero_le) intro x ⟨hxS, hxU⟩ simp only [Set.mem_iUnion, not_exists] at hxU refine ⟨⟨hxS, fun hxC₀ => hxU 0 (by rw [Fin.cons_zero]; exact hxC₀)⟩, ?_⟩ @@ -2232,7 +2232,7 @@ private theorem cutDistance_step_weight_le {K : ℕ} _ = 0 + μ (⋃ i, (ι_Q i \ M_Q i)) := by congr 1 -- univ \ ⋃ i, ι_Q i has measure 0 by Q.ae_covers - apply le_antisymm _ (zero_le _) + apply le_antisymm _ (zero_le) -- ⋃ S ∈ Q.parts, S ⊇ ⋃ i, ι_Q i since hι_Q_surj gives that every part is some ι_Q i have h_eq : ⋃ i, ι_Q i = ⋃ S ∈ Q.parts, S := by ext x; simp only [Set.mem_iUnion, Set.mem_iUnion]; constructor @@ -2406,7 +2406,7 @@ private theorem cutDistance_cross_partition_weight_le {K : ℕ} (fun S hS => P.measurableSet_part hS)) have hE_P_null : μ E_P = 0 := by have h_ae := P.ae_covers; rw [ae_iff] at h_ae - refine le_antisymm ?_ (zero_le _) + refine le_antisymm ?_ (zero_le) calc μ E_P ≤ μ {x | ¬∃ S ∈ P.parts, x ∈ S} := by apply measure_mono; intro x hx rw [hE_P_def, Set.mem_diff] at hx @@ -2665,7 +2665,7 @@ private theorem step_quantitative_icl_bounded (K : ℕ) (ε : ℝ) (hε : ε > 0 have h_ae := (P_seq n).ae_covers rw [ae_iff] at h_ae have h_null : μ ((⋃ S ∈ (P_seq n).parts, S)ᶜ) = 0 := by - refine le_antisymm ?_ (zero_le _) + refine le_antisymm ?_ (zero_le) calc μ ((⋃ S ∈ (P_seq n).parts, S)ᶜ) ≤ μ {x | ¬∃ S ∈ (P_seq n).parts, x ∈ S} := by apply measure_mono; intro x hx From 22c97baed11f0e42f0839d0fe23e0f303e5421d7 Mon Sep 17 00:00:00 2001 From: Cameron Freer Date: Sat, 27 Jun 2026 02:21:13 +0000 Subject: [PATCH 7/7] =?UTF-8?q?build:=20#upgrade=20=E2=80=94=20deprecation?= =?UTF-8?q?=20sweep=20(warning-clean=20on=20Lean=20v4.32.0-rc1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pure mathlib deprecated-alias renames (proof bodies only; no statement changes; sorry inventory identical to baseline at 136; #70 framework axioms unchanged): - Sym2.map_pair_eq → Sym2.map_mk (101 sites) - push_neg tactic → push Not (~75 sites) - Set diff→sdiff family: diff_subset/mem_diff(_of_mem)/union_diff_cancel/diff_eq_empty/ diff_empty/compl_diff/inter_union_diff/diff_diff_cancel_left/diff_union_self → sdiff_* (both Set.-qualified and unqualified open forms) - MeasureTheory.measure_diff → measure_sdiff, measure_inter_add_diff → measure_inter_add_sdiff, integral_finset_sum → integral_finsetSum - tendsto_finset_prod/sum → tendsto_finsetProd/Sum - Sym2.mem_diagSet_iff_isDiag → Sym2.mem_diagSet - Fin.coe_castSucc → Fin.val_castSucc, Fin.coe_cast → Fin.val_cast, Fin.lt_iff_val_lt_val → Fin.lt_def - _root_.not_imp → Classical.not_imp - import Mathlib.Data.Real.Sqrt → Mathlib.Analysis.Real.Sqrt lake build: 0 errors, 0 deprecation warnings. --- Graphon/Approximation.lean | 16 +-- Graphon/Compactness.lean | 4 +- Graphon/CutDistance.lean | 16 +-- Graphon/CycleKrylov.lean | 6 +- Graphon/InverseCounting.lean | 74 ++++++------- Graphon/Lovasz.lean | 128 +++++++++++----------- Graphon/MatrixDetermination.lean | 182 +++++++++++++++---------------- Graphon/Regularity.lean | 94 ++++++++-------- Graphon/SimpleRank.lean | 6 +- Graphon/Spectral.lean | 8 +- 10 files changed, 267 insertions(+), 267 deletions(-) diff --git a/Graphon/Approximation.lean b/Graphon/Approximation.lean index 142f6d3..9fe401e 100644 --- a/Graphon/Approximation.lean +++ b/Graphon/Approximation.lean @@ -208,17 +208,17 @@ noncomputable def MeasurablePartition.splitPart (P : MeasurablePartition α μ) · exact (P.measurableSet_part hS).diff hS₁_meas pairwiseDisjoint := fun T₁ hT₁ T₂ hT₂ hne => by simp only [Finset.coe_union, Finset.coe_erase, Finset.coe_insert, - Finset.coe_singleton, Set.mem_union, Set.mem_diff, Set.mem_singleton_iff, + Finset.coe_singleton, Set.mem_union, Set.mem_sdiff, Set.mem_singleton_iff, Set.mem_insert_iff] at hT₁ hT₂ rcases hT₁ with ⟨hT₁_in, hT₁_ne⟩ | (hT₁_eq | hT₁_eq) <;> rcases hT₂ with ⟨hT₂_in, hT₂_ne⟩ | (hT₂_eq | hT₂_eq) · exact P.pairwiseDisjoint hT₁_in hT₂_in hne · subst hT₂_eq; exact (P.pairwiseDisjoint hT₁_in hS hT₁_ne).mono_right hS₁_sub - · subst hT₂_eq; exact (P.pairwiseDisjoint hT₁_in hS hT₁_ne).mono_right diff_subset + · subst hT₂_eq; exact (P.pairwiseDisjoint hT₁_in hS hT₁_ne).mono_right sdiff_subset · subst hT₁_eq; exact ((P.pairwiseDisjoint hT₂_in hS hT₂_ne).mono_right hS₁_sub).symm · subst hT₁_eq; subst hT₂_eq; exact absurd rfl hne · subst hT₁_eq; subst hT₂_eq; exact Set.disjoint_sdiff_right - · subst hT₁_eq; exact ((P.pairwiseDisjoint hT₂_in hS hT₂_ne).mono_right diff_subset).symm + · subst hT₁_eq; exact ((P.pairwiseDisjoint hT₂_in hS hT₂_ne).mono_right sdiff_subset).symm · subst hT₁_eq; subst hT₂_eq; exact Set.disjoint_sdiff_right.symm · subst hT₁_eq; subst hT₂_eq; exact absurd rfl hne ae_covers := by @@ -243,7 +243,7 @@ theorem MeasurablePartition.splitPart_refines (P : MeasurablePartition α μ) rcases hT with ⟨_, hT_in⟩ | (rfl | rfl) · exact ⟨T, hT_in, Subset.refl T⟩ · exact ⟨S, hS, hS₁_sub⟩ - · exact ⟨S, hS, diff_subset⟩ + · exact ⟨S, hS, sdiff_subset⟩ /-- Splitting adds at most one part. -/ theorem MeasurablePartition.splitPart_card (P : MeasurablePartition α μ) @@ -297,17 +297,17 @@ noncomputable def MeasurablePartition.splitAllParts (P : MeasurablePartition α · by_cases h : S₁ = S₂ · subst h; exact disjoint_inf_sdiff · exact (P.pairwiseDisjoint hS₁_mem hS₂_mem h).mono - Set.inter_subset_left Set.diff_subset + Set.inter_subset_left Set.sdiff_subset -- (S₁ \ A, S₂ ∩ A) · by_cases h : S₁ = S₂ · subst h; exact disjoint_inf_sdiff.symm · exact (P.pairwiseDisjoint hS₁_mem hS₂_mem h).mono - Set.diff_subset Set.inter_subset_left + Set.sdiff_subset Set.inter_subset_left -- (S₁ \ A, S₂ \ A) · by_cases h : S₁ = S₂ · subst h; exact absurd rfl hne · exact (P.pairwiseDisjoint hS₁_mem hS₂_mem h).mono - Set.diff_subset Set.diff_subset + Set.sdiff_subset Set.sdiff_subset ae_covers := by filter_upwards [P.ae_covers] with x ⟨S, hS_mem, hx⟩ by_cases hxA : x ∈ A @@ -328,7 +328,7 @@ theorem MeasurablePartition.splitAllParts_refines (P : MeasurablePartition α μ Finset.mem_singleton] at hT obtain ⟨S, hS_mem, rfl | rfl⟩ := hT · exact ⟨S, hS_mem, Set.inter_subset_left⟩ - · exact ⟨S, hS_mem, Set.diff_subset⟩ + · exact ⟨S, hS_mem, Set.sdiff_subset⟩ omit [IsProbabilityMeasure μ] in /-- splitAllParts has at most 2 * P.parts.card parts. -/ diff --git a/Graphon/Compactness.lean b/Graphon/Compactness.lean index aa0cdba..3d822f9 100644 --- a/Graphon/Compactness.lean +++ b/Graphon/Compactness.lean @@ -561,7 +561,7 @@ theorem totallyBounded (ε : ℝ) (hε : ε > 0) : apply Filter.mem_of_superset (compl_mem_ae_iff.mpr h_null) intro x hx hxS by_contra h_ne - exact hx (Set.mem_diff_of_mem hxS h_ne) + exact hx (Set.mem_sdiff_of_mem hxS h_ne) have h_e_fst : ∀ᵐ p ∂(μ.prod μ), ∀ (S : Set α) (hS : S ∈ P₀.parts), p.1 ∈ S → e p.1 ∈ σ S hS := Measure.QuasiMeasurePreserving.ae Measure.quasiMeasurePreserving_fst h_align_ae @@ -948,7 +948,7 @@ private lemma rectIntegralDiff_le_tail_tsum ≤ |rectIntegralDiff (A n) (A m) S T| + |rectIntegralDiff (A m) (A (m + 1)) S T| := h_tri _ ≤ ∑ j ∈ Finset.range (m - n), δ (n + j) + δ m := add_le_add (ih h) h_step - · push_neg at h + · push Not at h have heq : n = m + 1 := by omega subst heq simp only [Nat.sub_self, Finset.range_zero, Finset.sum_empty, rectIntegralDiff, sub_self, diff --git a/Graphon/CutDistance.lean b/Graphon/CutDistance.lean index bb8fe45..efef984 100644 --- a/Graphon/CutDistance.lean +++ b/Graphon/CutDistance.lean @@ -323,7 +323,7 @@ private lemma layer_cake_Icc (a : ℝ) (ha : a ∈ Set.Icc 0 1) : rw [h_inter, min_eq_left ha.2] by_cases ha0 : a ≤ 0 · rw [le_antisymm ha0 ha.1, Set.Ioc_self]; simp - · push_neg at ha0 + · push Not at ha0 rw [setIntegral_const, smul_eq_mul, mul_one] unfold Measure.real rw [Real.volume_Ioc, sub_zero, ENNReal.toReal_ofReal ha0.le] @@ -426,7 +426,7 @@ private lemma layer_cake_simple_eq (U W : Graphon α μ) (S : Set α) (hS : Meas rw [h_lhs_eq] have h_lhs : ∫ p, ∑ i : Fin n, c i * (S ×ˢ T i).indicator K p ∂(μ.prod μ) = ∑ i : Fin n, c i * rectIntegralDiff U W S (T i) := by - rw [integral_finset_sum] + rw [integral_finsetSum] · congr 1; ext i rw [integral_const_mul, integral_indicator (hS.prod (hT_meas i))] rfl @@ -445,7 +445,7 @@ private lemma layer_cake_simple_eq (U W : Graphon α μ) (S : Set α) (hS : Meas · intro hty -- g y ≥ t > 0, so g y > 0, so y must be in some T j, and c j ≥ t by_contra h_none - push_neg at h_none + push Not at h_none -- h_none : ∀ i, t ≤ c i → y ∉ T i -- We'll show g y = 0, contradicting t ≤ g y with t > 0 have hgy0 : g y = 0 := by @@ -491,7 +491,7 @@ private lemma layer_cake_simple_eq (U W : Graphon α μ) (S : Set α) (hS : Meas rw [h_level t ht.1, h_rect_union t ht.1] rw [h_rhs_eq] -- Step 4: Swap integral and finite sum - rw [integral_finset_sum] + rw [integral_finsetSum] · -- Step 5: Compute each inner integral congr 1; ext i -- ∫ t in Ioc 0 1, (if t ≤ c i then R_i else 0) dt = c_i * R_i @@ -508,7 +508,7 @@ private lemma layer_cake_simple_eq (U W : Graphon α μ) (S : Set α) (hS : Meas rw [Set.Ioc_inter_Iic, min_eq_right (hc_bound i).2] by_cases hci0 : c i ≤ 0 · rw [le_antisymm hci0 (hc_bound i).1, Set.Ioc_self, setIntegral_empty, zero_mul] - · push_neg at hci0 + · push Not at hci0 rw [setIntegral_const, smul_eq_mul] congr 1 unfold Measure.real @@ -671,7 +671,7 @@ private lemma abs_weighted_integral_diff_indicator_general_le (U W : Graphon α by_cases h : t ≤ g p.2 · simp [Set.indicator_of_mem (show p.2 ∈ {y : α | t ≤ g y} from h), Set.indicator_of_mem (Set.mem_Iic.mpr h)] - · push_neg at h + · push Not at h simp [Set.indicator_of_notMem (show p.2 ∉ {y : α | t ≤ g y} from not_le.mpr h), Set.indicator_of_notMem (show t ∉ Set.Iic (g p.2) from not_le.mpr h)] rw [h_ind_eq] @@ -883,7 +883,7 @@ theorem abs_weighted_integral_diff_le (U W : Graphon α μ) (f g : α → ℝ) by_cases h : s ≤ f p.1 · simp [Set.indicator_of_mem (show p.1 ∈ {x : α | s ≤ f x} from h), Set.indicator_of_mem (Set.mem_Iic.mpr h)] - · push_neg at h + · push Not at h simp [Set.indicator_of_notMem (show p.1 ∉ {x : α | s ≤ f x} from not_le.mpr h), Set.indicator_of_notMem (show s ∉ Set.Iic (f p.1) from not_le.mpr h)] rw [h_ind_eq] @@ -1244,7 +1244,7 @@ theorem cutDistance_triangle [StandardBorelSpace α] (U V W : Graphon α μ) : -- Suffices to show: for all ε > 0, d(U,W) ≤ d(U,V) + d(V,W) + ε rw [← sub_nonneg] by_contra h_neg - push_neg at h_neg + push Not at h_neg -- h_neg : cutDistance U V + cutDistance V W - cutDistance U W < 0 set δ := cutDistance U W - cutDistance U V - cutDistance V W with hδ_def have hδ_pos : δ > 0 := by linarith diff --git a/Graphon/CycleKrylov.lean b/Graphon/CycleKrylov.lean index 30b0e47..0710171 100644 --- a/Graphon/CycleKrylov.lean +++ b/Graphon/CycleKrylov.lean @@ -6,7 +6,7 @@ Authors: Cameron Freer import Mathlib.Analysis.InnerProductSpace.PiL2 import Mathlib.Analysis.InnerProductSpace.ProdL2 import Mathlib.Analysis.InnerProductSpace.Projection.Basic -import Mathlib.Data.Real.Sqrt +import Mathlib.Analysis.Real.Sqrt import Graphon.SimpleRank /-! @@ -3812,8 +3812,8 @@ theorem commonNeighborGraph_edgeFinset : commonNeighborGraph.edgeFinset = {s((0 : Fin (1 + 2)), 2), s((1 : Fin (1 + 2)), 2)} := by ext e simp only [SimpleGraph.mem_edgeFinset, commonNeighborGraph, SimpleGraph.edgeSet_fromEdgeSet, - Finset.mem_insert, Finset.mem_singleton, Set.mem_diff, Set.mem_insert_iff, - Set.mem_singleton_iff, Sym2.mem_diagSet_iff_isDiag] + Finset.mem_insert, Finset.mem_singleton, Set.mem_sdiff, Set.mem_insert_iff, + Set.mem_singleton_iff, Sym2.mem_diagSet] refine ⟨fun ⟨he, _⟩ => he, fun he => ⟨he, ?_⟩⟩ rcases he with he | he <;> rw [he, Sym2.mk_isDiag_iff] <;> decide diff --git a/Graphon/InverseCounting.lean b/Graphon/InverseCounting.lean index b1ed885..d13c1fe 100644 --- a/Graphon/InverseCounting.lean +++ b/Graphon/InverseCounting.lean @@ -174,7 +174,7 @@ private theorem homDensity_mkStepGraphon_eq_weightedHomSum have hcell_disj : Pairwise (fun σ₁ σ₂ => Disjoint (cellProd σ₁) (cellProd σ₂)) := by intro σ₁ σ₂ hne have ⟨v, hv⟩ : ∃ v, σ₁ v ≠ σ₂ v := by - by_contra h; push_neg at h; exact hne (funext h) + by_contra h; push Not at h; exact hne (funext h) rw [Set.disjoint_left] intro x hx₁ hx₂ have h₁ := Set.mem_pi.mp hx₁ v (Set.mem_univ v) @@ -703,7 +703,7 @@ private theorem exists_type_class_mp_bijection have h_zero : μ (ι (embed i)) = 0 := by have h_sum_zero : ∑ j ∈ Finset.univ.filter (type_c · = type_c i), (μ (ι (embed j))).toReal = 0 := by - by_contra h_pos; push_neg at h_pos + by_contra h_pos; push Not at h_pos exact h_good (Finset.mem_filter.mpr ⟨Finset.mem_univ _, lt_of_le_of_ne (Finset.sum_nonneg (fun _ _ => ENNReal.toReal_nonneg)) (Ne.symm h_pos)⟩) @@ -844,7 +844,7 @@ private theorem exists_pullback_eq_of_step_homDensity_eq ∏ e ∈ F.edgeFinset, M (x (Quot.out e).1) (x (Quot.out e).2)) = 0 := by apply Finset.sum_eq_zero; intro σ hσ simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hσ - push_neg at hσ; exact h_vanish M σ hσ + push Not at hσ; exact h_vanish M σ hσ rw [h_bad_zero, add_zero] -- Now biject: ∑ (good filtered Fin k) = ∑ (univ Fin k') symm @@ -1105,7 +1105,7 @@ private theorem simultaneous_regularity [StandardBorelSpace α] _ ≤ 4 ^ N := Nat.pow_le_pow_right (by norm_num) (Nat.sub_le N _), Or.inl ⟨h_doneU, h_doneW⟩⟩ · -- W is bad: refine for W using energy_increment_pair - push_neg at h_doneW + push Not at h_doneW obtain ⟨Q, _, hQ_card_le, hQ_energyW, hQ_mono⟩ := energy_increment_pair W P δ hδ h_doneW have hQ_card : Q.parts.card ≤ 4 ^ (N - n) := by @@ -1127,7 +1127,7 @@ private theorem simultaneous_regularity [StandardBorelSpace α] _ = energy U P + energy W P + (↑n + 1) * δ ^ 2 := by ring _ = energy U P + energy W P + ↑(n + 1) * δ ^ 2 := by rw [this] · -- U is bad: refine for U using energy_increment_pair - push_neg at h_doneU + push Not at h_doneU obtain ⟨Q, _, hQ_card_le, hQ_energyU, hQ_mono⟩ := energy_increment_pair U P δ hδ h_doneU have hQ_card : Q.parts.card ≤ 4 ^ (N - n) := by @@ -1269,7 +1269,7 @@ private theorem step_quantitative_icl classical -- By contradiction + compactness of coefficient space by_contra h_neg - push_neg at h_neg + push Not at h_neg have h_seq : ∀ n : ℕ, ∃ (U_n W_n : Graphon α μ), (∀ (F : SimpleGraph (Fin n)) [DecidableRel F.Adj], |homDensity F (stepify P U_n) - homDensity F (stepify P W_n)| < @@ -1391,18 +1391,18 @@ private theorem step_quantitative_icl (fun i j => coeff_seq (ψ m) i j 0) w) atTop (nhds (weightedHomSum n F (fun i j => c_lim i j 0) w)) := by intro n F _ - apply tendsto_finset_sum _ (fun σ _ => ?_) + apply tendsto_finsetSum _ (fun σ _ => ?_) apply Filter.Tendsto.const_mul - apply tendsto_finset_prod _ (fun e _ => ?_) + apply tendsto_finsetProd _ (fun e _ => ?_) exact h_pw _ _ 0 have h_whs_conv_W : ∀ (n : ℕ) (F : SimpleGraph (Fin n)) [DecidableRel F.Adj], Tendsto (fun m => weightedHomSum n F (fun i j => coeff_seq (ψ m) i j 1) w) atTop (nhds (weightedHomSum n F (fun i j => c_lim i j 1) w)) := by intro n F _ - apply tendsto_finset_sum _ (fun σ _ => ?_) + apply tendsto_finsetSum _ (fun σ _ => ?_) apply Filter.Tendsto.const_mul - apply tendsto_finset_prod _ (fun e _ => ?_) + apply tendsto_finsetProd _ (fun e _ => ?_) exact h_pw _ _ 1 -- The original bridges will be instantiated per-graphon below -- Equal hom densities: pass |t(F,step U_n) - t(F,step W_n)| < 1/(n+1) to the limit @@ -1679,7 +1679,7 @@ private theorem exists_partition_with_measures {K : ℕ} have hS₀_meas : MeasurableSet S₀ := MeasurableSet.univ.diff hR_meas have hS₀_eq : μ S₀ = 1 := by have : μ Set.univ = μ S₀ + μ (Set.range ξ) := by - rw [← measure_union (Set.disjoint_sdiff_left) hR_meas, Set.diff_union_self, + rw [← measure_union (Set.disjoint_sdiff_left) hR_meas, Set.sdiff_union_self, Set.union_eq_self_of_subset_right (Set.subset_univ _)] rw [measure_univ, hR_null, add_zero] at this; exact this.symm -- Recursive carving of S₀: build C_i ⊆ S₀ with μ(C_i) = ofReal(w i) @@ -1744,7 +1744,7 @@ private theorem exists_partition_with_measures {K : ℕ} refine le_antisymm ?_ (zero_le) calc μ {x | ¬∃ S ∈ parts, x ∈ S} ≤ μ (S₀ \ ⋃ i, C i) := measure_mono (fun x hx => by - push_neg at hx -- hx : ∀ S ∈ parts, x ∉ S + push Not at hx -- hx : ∀ S ∈ parts, x ∉ S refine ⟨⟨Set.mem_univ _, fun hxR => ?_⟩, fun hxC => ?_⟩ · obtain ⟨j, rfl⟩ := hxR exact hx (ι j) (Finset.mem_image.mpr ⟨j, Finset.mem_univ _, rfl⟩) @@ -1777,7 +1777,7 @@ private theorem exists_partition_with_measures {K : ℕ} intro S hS hS_ne_top w' _ hw'_sum refine ⟨Fin.elim0, fun i => i.elim0, fun i => i.elim0, fun i => i.elim0, ?_, fun i => i.elim0⟩ - simp only [Set.iUnion_of_empty, Set.diff_empty]; simpa using hw'_sum.symm + simp only [Set.iUnion_of_empty, Set.sdiff_empty]; simpa using hw'_sum.symm | succ n ih => intro S hS hS_ne_top w' hw'_nn hw'_sum -- Carve first cell C₀ ⊆ S with μ(C₀) = ENNReal.ofReal(w' 0) @@ -1788,9 +1788,9 @@ private theorem exists_partition_with_measures {K : ℕ} -- Remaining space S' = S \ C₀ set S' := S \ C₀ with hS'_def have hS'm : MeasurableSet S' := hS.diff hC₀m - have hS'_ne_top : μ S' ≠ ⊤ := ne_top_of_le_ne_top hS_ne_top (measure_mono diff_subset) + have hS'_ne_top : μ S' ≠ ⊤ := ne_top_of_le_ne_top hS_ne_top (measure_mono sdiff_subset) have hw'_rest_sum : ENNReal.ofReal (∑ i : Fin n, w' i.succ) = μ S' := by - rw [measure_diff hC₀s hC₀m.nullMeasurableSet (by rw [hC₀e]; exact ENNReal.ofReal_ne_top), + rw [measure_sdiff hC₀s hC₀m.nullMeasurableSet (by rw [hC₀e]; exact ENNReal.ofReal_ne_top), hC₀e, ← hw'_sum, Fin.sum_univ_succ, ENNReal.ofReal_add (hw'_nn 0) (Finset.sum_nonneg (fun i _ => hw'_nn _))] exact (ENNReal.add_sub_cancel_left ENNReal.ofReal_ne_top).symm @@ -1804,7 +1804,7 @@ private theorem exists_partition_with_measures {K : ℕ} -- Subset · intro i; refine Fin.cases ?_ (fun j => ?_) i · rw [Fin.cons_zero]; exact hC₀s - · rw [Fin.cons_succ]; exact (hC's j).trans diff_subset + · rw [Fin.cons_succ]; exact (hC's j).trans sdiff_subset -- Disjoint: introduce hij AFTER case split so types are correct · intro i j refine Fin.cases ?_ (fun i' => ?_) i <;> refine Fin.cases ?_ (fun j' => ?_) j <;> @@ -1861,10 +1861,10 @@ private theorem cutNormDiff_le_of_ae_agree_off_strip (U W : Graphon α μ) have hTdE := hT.diff hE -- Key decomposition: S ×ˢ T = (S ∩ E) ×ˢ T ∪ (S \ E) ×ˢ T have h_ST_decomp : S ×ˢ T = ((S ∩ E) ×ˢ T) ∪ ((S \ E) ×ˢ T) := by - rw [← Set.union_prod, Set.inter_union_diff] + rw [← Set.union_prod, Set.inter_union_sdiff] -- Further decompose (S \ E) ×ˢ T = (S \ E) ×ˢ (T ∩ E) ∪ (S \ E) ×ˢ (T \ E) have h_SdET_decomp : (S \ E) ×ˢ T = ((S \ E) ×ˢ (T ∩ E)) ∪ ((S \ E) ×ˢ (T \ E)) := by - rw [← Set.prod_union, Set.inter_union_diff] + rw [← Set.prod_union, Set.inter_union_sdiff] -- Disjointness have h_disj1 : Disjoint ((S ∩ E) ×ˢ T) ((S \ E) ×ˢ T) := disjoint_inf_sdiff.set_prod_left T T @@ -2071,7 +2071,7 @@ private theorem cutDistance_step_weight_le {K : ℕ} exact ⟨src j, Finset.mem_insert_of_mem (Finset.mem_image_of_mem _ (Finset.mem_univ j)), hxj⟩ · exact ⟨waste_src, Finset.mem_insert_self _ _, - Set.mem_diff_of_mem (Set.mem_univ _) hx⟩ + Set.mem_sdiff_of_mem (Set.mem_univ _) hx⟩ } -- Build MeasurablePartition for target (M_P good cells + waste) let waste_tgt := Set.univ \ ⋃ j : Fin good.card, tgt j @@ -2107,7 +2107,7 @@ private theorem cutDistance_step_weight_le {K : ℕ} exact ⟨tgt j, Finset.mem_insert_of_mem (Finset.mem_image_of_mem _ (Finset.mem_univ j)), hxj⟩ · exact ⟨waste_tgt, Finset.mem_insert_self _ _, - Set.mem_diff_of_mem (Set.mem_univ _) hx⟩ + Set.mem_sdiff_of_mem (Set.mem_univ _) hx⟩ } -- Prove membership in partition parts have hsrc_mem : ∀ j, src j ∈ P_src.parts := @@ -2180,10 +2180,10 @@ private theorem cutDistance_step_weight_le {K : ℕ} intro h1_not h2_not -- p.1 ∉ E_Q means p.1 ∈ ⋃ i, M_Q i have h1_in : p.1 ∈ ⋃ i, M_Q i := by - simp only [hE_Q_def, Set.mem_diff, Set.mem_univ, true_and, not_not] at h1_not + simp only [hE_Q_def, Set.mem_sdiff, Set.mem_univ, true_and, not_not] at h1_not exact h1_not have h2_in : p.2 ∈ ⋃ i, M_Q i := by - simp only [hE_Q_def, Set.mem_diff, Set.mem_univ, true_and, not_not] at h2_not + simp only [hE_Q_def, Set.mem_sdiff, Set.mem_univ, true_and, not_not] at h2_not exact h2_not rw [Set.mem_iUnion] at h1_in h2_in obtain ⟨i, hi⟩ := h1_in @@ -2220,7 +2220,7 @@ private theorem cutDistance_step_weight_le {K : ℕ} -- E_Q = univ \ ⋃ i, M_Q i ⊆ (univ \ ⋃ i, ι_Q i) ∪ ⋃ i, (ι_Q i \ M_Q i) have h_sub : E_Q ⊆ (Set.univ \ ⋃ i, ι_Q i) ∪ ⋃ i, (ι_Q i \ M_Q i) := by intro x hx - rw [hE_Q_def, Set.mem_diff] at hx + rw [hE_Q_def, Set.mem_sdiff] at hx by_cases hx_union : x ∈ ⋃ i, ι_Q i · right rw [Set.mem_iUnion] at hx_union ⊢ @@ -2245,7 +2245,7 @@ private theorem cutDistance_step_weight_le {K : ℕ} calc μ (Set.univ \ ⋃ S ∈ Q.parts, S) ≤ μ {x | ¬∃ S ∈ Q.parts, x ∈ S} := by apply measure_mono; intro x hx - simp only [Set.mem_diff, Set.mem_iUnion, Set.mem_setOf_eq] at hx ⊢ + simp only [Set.mem_sdiff, Set.mem_iUnion, Set.mem_setOf_eq] at hx ⊢ exact fun ⟨S, hS, hxS⟩ => hx.2 ⟨S, hS, hxS⟩ _ = 0 := h_compl_null _ ≤ ∑ i : Fin K, μ (ι_Q i \ M_Q i) := by @@ -2256,7 +2256,7 @@ private theorem cutDistance_step_weight_le {K : ℕ} tsum_eq_sum (fun i hi => absurd (Finset.mem_univ i) hi) _ = ∑ i : Fin K, (μ (ι_Q i) - μ (M_Q i)) := by congr 1; ext i - rw [measure_diff (hM_Q_sub i) (hM_Q_meas i).nullMeasurableSet (measure_ne_top μ _)] + rw [measure_sdiff (hM_Q_sub i) (hM_Q_meas i).nullMeasurableSet (measure_ne_top μ _)] -- Convert to Real have h_ne_top : ∀ i : Fin K, μ (ι_Q i) ≠ ⊤ := fun i => measure_ne_top μ _ have h_M_ne_top : ∀ i : Fin K, μ (M_Q i) ≠ ⊤ := fun i => measure_ne_top μ _ @@ -2409,7 +2409,7 @@ private theorem cutDistance_cross_partition_weight_le {K : ℕ} refine le_antisymm ?_ (zero_le) calc μ E_P ≤ μ {x | ¬∃ S ∈ P.parts, x ∈ S} := by apply measure_mono; intro x hx - rw [hE_P_def, Set.mem_diff] at hx + rw [hE_P_def, Set.mem_sdiff] at hx simp only [Set.mem_setOf_eq] exact fun ⟨S, hS, hxS⟩ => hx.2 (Set.mem_biUnion hS hxS) @@ -2536,7 +2536,7 @@ private theorem step_quantitative_icl_bounded (K : ℕ) (ε : ℝ) (hε : ε > 0 cutDistance (stepify P U) (stepify P W) < ε := by classical by_contra h_neg - push_neg at h_neg + push Not at h_neg have h_seq : ∀ n : ℕ, ∃ (P_n : MeasurablePartition α μ) (_ : P_n.parts.card ≤ K) (U_n W_n : Graphon α μ), (∀ (F : SimpleGraph (Fin n)) [DecidableRel F.Adj], @@ -2677,7 +2677,7 @@ private theorem step_quantitative_icl_bounded (K : ℕ) (ε : ℝ) (hε : ε > 0 simp [measure_univ] have h_wlim_sum : ∑ i : Fin K, w_lim i = 1 := by exact tendsto_nhds_unique - ((tendsto_finset_sum _ (fun i _ => h_pw_w i)).congr + ((tendsto_finsetSum _ (fun i _ => h_pw_w i)).congr (fun n => (h_w_sum (ψ n)).symm ▸ rfl)) tendsto_const_nhds obtain ⟨P_lim, ι_lim, hι_lim_mem, hι_lim_inj, hι_lim_surj, hP_lim_card, hι_lim_meas⟩ := @@ -2752,18 +2752,18 @@ private theorem step_quantitative_icl_bounded (K : ℕ) (ε : ℝ) (hε : ε > 0 Tendsto (fun m => weightedHomSum n F (fun i j => coeff_seq (ψ m) i j 0) (w_seq (ψ m))) atTop (nhds (weightedHomSum n F (fun i j => c_lim i j 0) w_lim)) := by - intro n F _; apply tendsto_finset_sum _ (fun σ _ => ?_) + intro n F _; apply tendsto_finsetSum _ (fun σ _ => ?_) apply Filter.Tendsto.mul - · apply tendsto_finset_prod _ (fun v _ => ?_); exact h_pw_w (σ v) - · apply tendsto_finset_prod _ (fun e _ => ?_); exact h_pw_c _ _ 0 + · apply tendsto_finsetProd _ (fun v _ => ?_); exact h_pw_w (σ v) + · apply tendsto_finsetProd _ (fun e _ => ?_); exact h_pw_c _ _ 0 have h_whs_conv_W : ∀ (n : ℕ) (F : SimpleGraph (Fin n)) [DecidableRel F.Adj], Tendsto (fun m => weightedHomSum n F (fun i j => coeff_seq (ψ m) i j 1) (w_seq (ψ m))) atTop (nhds (weightedHomSum n F (fun i j => c_lim i j 1) w_lim)) := by - intro n F _; apply tendsto_finset_sum _ (fun σ _ => ?_) + intro n F _; apply tendsto_finsetSum _ (fun σ _ => ?_) apply Filter.Tendsto.mul - · apply tendsto_finset_prod _ (fun v _ => ?_); exact h_pw_w (σ v) - · apply tendsto_finset_prod _ (fun e _ => ?_); exact h_pw_c _ _ 1 + · apply tendsto_finsetProd _ (fun v _ => ?_); exact h_pw_w (σ v) + · apply tendsto_finsetProd _ (fun e _ => ?_); exact h_pw_c _ _ 1 have h_stepify_bridge : ∀ m : ℕ, ∀ (V : Graphon α μ) (b : Fin 2), ∀ (n : ℕ) (F : SimpleGraph (Fin n)) [DecidableRel F.Adj], n ≤ ψ m → @@ -3124,7 +3124,7 @@ theorem cutDistance_le_of_homDensity_close [StandardBorelSpace α] [NoAtoms μ] -- If false, for each n, ∃ U_n W_n with Fin-n hom densities within 1/(n+1) but d ≥ ε. -- Extract convergent subsequences; limits have equal hom densities but d ≥ ε, contradiction. by_contra h_neg - push_neg at h_neg + push Not at h_neg have h_seq : ∀ n : ℕ, ∃ (U W : Graphon α μ), (∀ (F : SimpleGraph (Fin n)) [DecidableRel F.Adj], |homDensity F U - homDensity F W| < 1 / (↑n + 1 : ℝ)) ∧ @@ -3142,7 +3142,7 @@ theorem cutDistance_le_of_homDensity_close [StandardBorelSpace α] [NoAtoms μ] fun ε' hε' => hφ₂_conv ε' hε' have h_lim_far : cutDistance U_lim W_lim ≥ ε := by by_contra h_small - push_neg at h_small + push Not at h_small set δ₀ := (ε - cutDistance U_lim W_lim) / 3 with hδ₀_def have hδ₀_pos : δ₀ > 0 := by linarith [cutDistance_nonneg U_lim W_lim] obtain ⟨N₁, hN₁⟩ := hU_conv δ₀ hδ₀_pos @@ -3302,7 +3302,7 @@ theorem limit_unique_upto_weakIso [StandardBorelSpace α] unfold WeaklyIsomorphic apply le_antisymm · by_contra h_neg - push_neg at h_neg + push Not at h_neg set ε := cutDistance U V / 2 with hε_def have hε_pos : ε > 0 := by positivity obtain ⟨N₁, hN₁⟩ := hU ε hε_pos diff --git a/Graphon/Lovasz.lean b/Graphon/Lovasz.lean index e1dce88..eaa0c19 100644 --- a/Graphon/Lovasz.lean +++ b/Graphon/Lovasz.lean @@ -832,7 +832,7 @@ theorem gluePart₁_eq_zero_of_not_mem_image {K n₁ n₂ : ℕ} exact (congr_arg Fin.val hu).symm show u_b.val = b.val exact huval - exact ⟨s(u_a, u_b), by rw [Sym2.map_pair_eq, ha_eq, hb_eq]⟩ + exact ⟨s(u_a, u_b), by rw [Sym2.map_mk, ha_eq, hb_eq]⟩ /-- `gluePart₂` is zero outside the image of `glueEmb₂.sym2Map`. -/ theorem gluePart₂_eq_zero_of_not_mem_image {K n₁ n₂ : ℕ} @@ -893,7 +893,7 @@ theorem gluePart₂_eq_zero_of_not_mem_image {K n₁ n₂ : ℕ} show (glueEmb₂ K n₁ n₂ u_b).val = b.val simp only [glueEmb₂, Function.Embedding.coeFn_mk, dif_neg hub] omega - exact ⟨s(u_a, u_b), by rw [Sym2.map_pair_eq, ha_eq, hb_eq]⟩ + exact ⟨s(u_a, u_b), by rw [Sym2.map_mk, ha_eq, hb_eq]⟩ /-- **Sym2 product over `glueEmb₁` factors via prod over `Sym2 (Fin (n₁ + K))`.** For any function `g : Sym2 (Fin ((n₁+n₂)+K)) → ℝ` that equals `1` outside the @@ -1045,7 +1045,7 @@ theorem multiLabeledEvalK_glue {T K n₁ n₂ : ℕ} · -- The pulled-back form equals the M₁ Sym2 product refine Finset.prod_congr rfl fun e _ => ?_ refine Sym2.ind (fun a b => ?_) e - rw [Sym2.map_pair_eq, gluePart₁_emb₁] + rw [Sym2.map_mk, gluePart₁_emb₁] -- Need: B^M₁.mult s(a,b) at τ_glue ∘ emb₁ pair equals at τ₁ pair rw [B_pow_quot_out_eq hB τ_glue (glueEmb₁ K n₁ n₂ a) (glueEmb₁ K n₁ n₂ b)] rw [B_pow_quot_out_eq hB τ₁ a b] @@ -1065,7 +1065,7 @@ theorem multiLabeledEvalK_glue {T K n₁ n₂ : ℕ} B (τ_glue (Quot.out e).1) (τ_glue (Quot.out e).2) ^ gluePart₂ M₁ M₂ e)] · refine Finset.prod_congr rfl fun e _ => ?_ refine Sym2.ind (fun a b => ?_) e - rw [Sym2.map_pair_eq, gluePart₂_emb₂] + rw [Sym2.map_mk, gluePart₂_emb₂] rw [B_pow_quot_out_eq hB τ_glue (glueEmb₂ K n₁ n₂ a) (glueEmb₂ K n₁ n₂ b)] rw [B_pow_quot_out_eq hB τ₂ a b] rw [h_τ₂, h_τ₂] @@ -1099,7 +1099,7 @@ def MultiLabeledGraph.trace {K n : ℕ} (M : MultiLabeledGraph (K + 1) n) : MultiLabeledGraph K (n + 1) where mult e := M.mult (Sym2.map (Fin.cast (show (n + 1) + K = n + (K + 1) by omega)) e) multNoLoop x := by - rw [Sym2.map_pair_eq] + rw [Sym2.map_mk] exact M.multNoLoop _ /-- **Promotion** (section of `trace`): from `MultiLabeledGraph K (n+1)` build @@ -1110,7 +1110,7 @@ def MultiLabeledGraph.promote {K n : ℕ} (M : MultiLabeledGraph K (n + 1)) : MultiLabeledGraph (K + 1) n where mult e := M.mult (Sym2.map (Fin.cast (show n + (K + 1) = (n + 1) + K by omega)) e) multNoLoop x := by - rw [Sym2.map_pair_eq] + rw [Sym2.map_mk] exact M.multNoLoop _ /-- **Trace-promote round-trip**: closing the last label of a promoted @@ -1230,7 +1230,7 @@ theorem multiLabeledEvalK_sum_last_label {T K n : ℕ} -- e_sym2 s(a, b) = s(Fin.cast h_eq a, Fin.cast h_eq b). have h_es : e_sym2 s(a, b) = s(Fin.cast h_eq a, Fin.cast h_eq b) := by show Sym2.map e_fin s(a, b) = _ - rw [Sym2.map_pair_eq] + rw [Sym2.map_mk] rfl rw [h_es] -- Quot.out orientations on both sides. @@ -1428,7 +1428,7 @@ def reroot1 {m : ℕ} (Mχ : MultiLabeledGraph 1 m) : MultiLabeledGraph 2 m wher (e' : Sym2 (Fin (m + 1))) : (reroot1 Mχ).mult (Sym2.map (succEmb m) e') = Mχ.mult e' := by refine Sym2.ind (fun a b => ?_) e' - rw [Sym2.map_pair_eq] + rw [Sym2.map_mk] show (match rerootCast (succEmb m a), rerootCast (succEmb m b) with | some u', some v' => Mχ.mult s(u', v') | _, _ => 0) = Mχ.mult s(a, b) rw [succEmb_apply, succEmb_apply, rerootCast_succ, rerootCast_succ] @@ -1464,14 +1464,14 @@ private theorem reroot1_prod_reindex {T m : ℕ} (Mχ : MultiLabeledGraph 1 m) apply he rw [Finset.mem_map] refine ⟨s(u', v'), Finset.mem_univ _, ?_⟩ - rw [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq, succEmb_apply, succEmb_apply, + rw [Function.Embedding.sym2Map_apply, Sym2.map_mk, succEmb_apply, succEmb_apply, ← rerootCast_eq_some hca, ← rerootCast_eq_some hcb] rw [hfac] refine Finset.prod_congr rfl fun e' _ => ?_ rw [reroot1_mult_map_succ] congr 1 refine Sym2.ind (fun a b => ?_) e' - rw [Sym2.map_pair_eq, succEmb_apply, succEmb_apply, + rw [Sym2.map_mk, succEmb_apply, succEmb_apply, B_quot_out_eq hB τ₂ a.succ b.succ, B_quot_out_eq hB τ₁ a b, halign a, halign b] /-- **Reroot evaluation**: `reroot1 Mχ` evaluated at `φ` reads `Mχ` at the @@ -1949,7 +1949,7 @@ private noncomputable def mkTupleSimpleSeparator {T K : ℕ} TupleSimpleSeparator B W ξ ξ' := let h' : ∃ (n : ℕ) (F : SimpleGraph (Fin (n + K))) (_ : DecidableRel F.Adj), @inlineSimpleEval T K n B W F _ ξ ≠ @inlineSimpleEval T K n B W F _ ξ' := by - push_neg at h; exact h + push Not at h; exact h { n := h'.choose F := h'.choose_spec.choose inst := h'.choose_spec.choose_spec.choose @@ -2295,16 +2295,16 @@ private theorem restEmbedAux_injective {n K m : ℕ} {g : Fin m → Fin n} · by_cases hy : y.val < K · rw [restEmbedAux_val_lab g x hx, restEmbedAux_val_lab g y hy] at h_val exact h_val - · push_neg at hy + · push Not at hy rw [restEmbedAux_val_lab g x hx, restEmbedAux_val_rest g y (not_lt.mpr hy)] at h_val omega - · push_neg at hx + · push Not at hx by_cases hy : y.val < K · rw [restEmbedAux_val_rest g x (not_lt.mpr hx), restEmbedAux_val_lab g y hy] at h_val omega - · push_neg at hy + · push Not at hy rw [restEmbedAux_val_rest g x (not_lt.mpr hx), restEmbedAux_val_rest g y (not_lt.mpr hy)] at h_val have h_inner : (g ⟨x.val - K, by have := x.isLt; omega⟩ : Fin n).val = @@ -2413,7 +2413,7 @@ private lemma multigraphEval_LL_excess_descends_aux {T K n : ℕ} have h_exists : ∃ e ∈ (Finset.univ.filter isLLEdge : Finset (Sym2 (Fin (n + K)))), 1 ≤ M.mult e := by by_contra h - push_neg at h + push Not at h have : M.LLSum = 0 := by unfold MultiLabeledGraph.LLSum exact Finset.sum_eq_zero fun e he => by have := h e he; omega @@ -2971,7 +2971,7 @@ private theorem multigraphEval_isolated_unlabeled_unlabeled_doubled_edge_descend -- Step 7 foundations: cardinality of complement subtype, n ≥ 2. have hn_ge_2 : 2 ≤ n := by by_contra h - push_neg at h + push Not at h -- h : n < 2. Since u_p : Fin n, n ≥ 1. So n = 1. Then Fin 1 is subsingleton. have h_ge_1 : 1 ≤ n := Nat.one_le_iff_ne_zero.mpr (fun heq => by rw [heq] at u_p @@ -3058,7 +3058,7 @@ private theorem multigraphEval_isolated_unlabeled_unlabeled_doubled_edge_descend rw [SimpleGraph.mem_edgeFinset, SimpleGraph.mem_edgeSet] show (a ≠ b ∧ M.mult s(restEmbed a, restEmbed b) = 1) ↔ (a ≠ b ∧ M.mult (Sym2.map restEmbed s(a, b)) = 1) - rw [Sym2.map_pair_eq] + rw [Sym2.map_mk] -- Step 7b₂ continued: restEmbed injectivity via the top-level lemma. have restEmbed_injective : Function.Injective restEmbed := restEmbedAux_injective g_rest_injective @@ -3103,7 +3103,7 @@ private theorem multigraphEval_isolated_unlabeled_unlabeled_doubled_edge_descend apply Fin.ext exact restEmbedAux_val_lab g_rest ⟨x.val, by have := hn_ge_2; omega⟩ hx_lab · -- Unlabeled case. - push_neg at hx_lab + push Not at hx_lab let x_un : Fin n := ⟨x.val - K, by have := x.isLt; omega⟩ have hx_un_ne_u_p : x_un ≠ u_p := by intro h_eq @@ -3159,10 +3159,10 @@ private theorem multigraphEval_isolated_unlabeled_unlabeled_doubled_edge_descend intro h_eq exact hab_ne (ha'.symm.trans ((congrArg restEmbed h_eq).trans hb')) · -- M.mult (Sym2.map restEmbed s(a', b')) = 1. - rw [Sym2.map_pair_eq, ha', hb'] + rw [Sym2.map_mk, ha', hb'] exact hmult · -- Sym2.map restEmbed s(a', b') = s(a, b). - rw [Sym2.map_pair_eq, ha', hb'] + rw [Sym2.map_mk, ha', hb'] -- Step 7b₂ remainder: assemble the per-ρ body equality. -- Both sides are W-product * B-product. Split via congr 1. dsimp only @@ -3193,7 +3193,7 @@ private theorem multigraphEval_isolated_unlabeled_unlabeled_doubled_edge_descend congr 1 exact Fin.ext h_re_val · -- Rest case. - push_neg at h_lab + push Not at h_lab have h_v_not_lab : ¬ v.val < K := not_lt.mpr h_lab let r : Fin (n - 2) := ⟨v.val - K, by have := v.isLt; omega⟩ let k : {x : Fin n // ¬ p x} := complEquiv.symm r @@ -3231,7 +3231,7 @@ private theorem multigraphEval_isolated_unlabeled_unlabeled_doubled_edge_descend induction e with | h a b => rw [B_quot_out_eq hB τ_rest a b] - rw [Sym2.map_pair_eq] + rw [Sym2.map_mk] rw [B_quot_out_eq hB τ_orig (restEmbed a) (restEmbed b)] rw [hτ_compat a, hτ_compat b] -- Step 2: h_rhs_filter — split complement product by M.mult = 1. @@ -3273,7 +3273,7 @@ private theorem multigraphEval_isolated_unlabeled_unlabeled_doubled_edge_descend · have hv : (restEmbed v).val = v.val := restEmbedAux_val_lab g_rest v h_lab have : v.val = i.val := by rw [← hv, h_eq] omega - · push_neg at h_lab + · push Not at h_lab have hv : (restEmbed v).val = (g_rest ⟨v.val - K, by have := v.isLt; omega⟩).val + K := restEmbedAux_val_rest g_rest v (not_lt.mpr h_lab) @@ -3293,7 +3293,7 @@ private theorem multigraphEval_isolated_unlabeled_unlabeled_doubled_edge_descend · have hv : (restEmbed v).val = v.val := restEmbedAux_val_lab g_rest v h_lab have : v.val = j.val := by rw [← hv, h_eq] omega - · push_neg at h_lab + · push Not at h_lab have hv : (restEmbed v).val = (g_rest ⟨v.val - K, by have := v.isLt; omega⟩).val + K := restEmbedAux_val_rest g_rest v (not_lt.mpr h_lab) @@ -3323,7 +3323,7 @@ private theorem multigraphEval_isolated_unlabeled_unlabeled_doubled_edge_descend · show i ∉ Sym2.map restEmbed e ∧ j ∉ Sym2.map restEmbed e induction e with | h a b => - rw [Sym2.map_pair_eq] + rw [Sym2.map_mk] refine ⟨?_, ?_⟩ · rw [Sym2.mem_iff] rintro (heq | heq) @@ -3629,7 +3629,7 @@ private theorem multigraphEval_label_unlabeled_isolated_descends rw [SimpleGraph.mem_edgeFinset, SimpleGraph.mem_edgeSet] show (a ≠ b ∧ M.mult s(restEmbed a, restEmbed b) = 1) ↔ (a ≠ b ∧ M.mult (Sym2.map restEmbed s(a, b)) = 1) - rw [Sym2.map_pair_eq] + rw [Sym2.map_mk] -- restEmbed never hits b (image avoids u_p position). have h_restEmbed_ne_b : ∀ v : Fin (n - 1 + K), restEmbed v ≠ b := by intro v h_eq @@ -3637,7 +3637,7 @@ private theorem multigraphEval_label_unlabeled_isolated_descends · have hv : (restEmbed v).val = v.val := restEmbedAux_val_lab g_rest v h_lab have : v.val = b.val := by rw [← hv, h_eq] omega - · push_neg at h_lab + · push Not at h_lab have hv : (restEmbed v).val = (g_rest ⟨v.val - K, by have := v.isLt; omega⟩).val + K := restEmbedAux_val_rest g_rest v (not_lt.mpr h_lab) @@ -3673,7 +3673,7 @@ private theorem multigraphEval_label_unlabeled_isolated_descends · refine ⟨⟨z.val, by have := hn_ge_1; omega⟩, ?_⟩ apply Fin.ext exact restEmbedAux_val_lab g_rest ⟨z.val, by have := hn_ge_1; omega⟩ hz_lab - · push_neg at hz_lab + · push Not at hz_lab let z_un : Fin n := ⟨z.val - K, by have := z.isLt; omega⟩ have hz_un_ne_u_p : z_un ≠ u_p := by intro h_eq @@ -3708,8 +3708,8 @@ private theorem multigraphEval_label_unlabeled_isolated_descends · show x' ≠ y' intro h_eq exact hxy_ne (hx'.symm.trans ((congrArg restEmbed h_eq).trans hy')) - · rw [Sym2.map_pair_eq, hx', hy']; exact hmult - · rw [Sym2.map_pair_eq, hx', hy'] + · rw [Sym2.map_mk, hx', hy']; exact hmult + · rw [Sym2.map_mk, hx', hy'] -- Assemble: W * B-rest equality. dsimp only rw [hW_rest] @@ -3733,7 +3733,7 @@ private theorem multigraphEval_label_unlabeled_isolated_descends rw [dif_pos h_re_lab, dif_pos h_lab] congr 1 exact Fin.ext h_re_val - · push_neg at h_lab + · push Not at h_lab have h_v_not_lab : ¬ v.val < K := not_lt.mpr h_lab let r : Fin (n - 1) := ⟨v.val - K, by have := v.isLt; omega⟩ let k : {x : Fin n // ¬ p x} := complEquiv.symm r @@ -3769,7 +3769,7 @@ private theorem multigraphEval_label_unlabeled_isolated_descends induction e with | h x y => rw [B_quot_out_eq hB τ_rest x y] - rw [Sym2.map_pair_eq] + rw [Sym2.map_mk] rw [B_quot_out_eq hB τ_orig (restEmbed x) (restEmbed y)] rw [hτ_compat x, hτ_compat y] have h_rhs_filter : @@ -3816,7 +3816,7 @@ private theorem multigraphEval_label_unlabeled_isolated_descends · show b ∉ Sym2.map restEmbed e induction e with | h x y => - rw [Sym2.map_pair_eq] + rw [Sym2.map_mk] rw [Sym2.mem_iff] rintro (heq | heq) · exact h_restEmbed_ne_b x heq.symm @@ -4149,7 +4149,7 @@ private theorem multigraphEval_one_doubled_unlabeled_edge_descends {T K n : ℕ} · -- Both labels: contradicts `he₀_unlabeled`. exact absurd (show a.val < K ∧ b.val < K from ⟨ha_lab, hb_lab⟩) he₀_unlabeled · -- `a` label, `b` unlabeled. Label-unlabeled case. - push_neg at hb_lab + push Not at hb_lab by_cases h_b_iso : ∀ e, e ≠ s(a, b) → b ∈ e → M.mult e = 0 · exact multigraphEval_label_unlabeled_isolated_descends B hB W hW htwin M a b ha_lab hb_lab hab_ne he₀_doubled h_others_le_one @@ -4157,7 +4157,7 @@ private theorem multigraphEval_one_doubled_unlabeled_edge_descends {T K n : ℕ} · exact multigraphEval_label_unlabeled_nonisolated_descends B hB W hW htwin M a b ha_lab hb_lab hab_ne he₀_doubled h_others_le_one h_b_iso h_simple h_sq_moment - · push_neg at ha_lab + · push Not at ha_lab by_cases hb_lab : b.val < K · -- `a` unlabeled, `b` label. by_cases h_a_iso : ∀ e, e ≠ s(a, b) → a ∈ e → M.mult e = 0 @@ -4168,7 +4168,7 @@ private theorem multigraphEval_one_doubled_unlabeled_edge_descends {T K n : ℕ} B hB W hW htwin M a b ha_lab hb_lab hab_ne he₀_doubled h_others_le_one h_a_iso h_simple h_sq_moment · -- Both unlabeled. - push_neg at hb_lab + push Not at hb_lab by_cases h_iso : ∀ e, e ≠ s(a, b) → (a ∈ e ∨ b ∈ e) → M.mult e = 0 · -- **Isolated unlabeled-unlabeled doubled edge** — CLOSED via -- `multigraphEval_isolated_unlabeled_unlabeled_doubled_edge_descends` (proved). @@ -4300,7 +4300,7 @@ theorem multigraphEval_in_simpleProfileClosure {T K n : ℕ} have h_nonLL_le_one : ∀ e, ¬ isLLEdge e → M.mult e ≤ 1 := by intro e he by_contra h_ge - push_neg at h_ge + push Not at h_ge have hLL := h_LL_excess e (by omega) exact he hLL exact multigraphEval_LL_excess_descends_aux B hB W @@ -4311,7 +4311,7 @@ theorem multigraphEval_in_simpleProfileClosure {T K n : ℕ} -- is non-LL (touches an unlabeled vertex). have h_unlabeled_excess : ∃ e : Sym2 (Fin ((n + 1) + K)), ¬ isLLEdge e ∧ 2 ≤ M.mult e := by - push_neg at h_LL_excess + push Not at h_LL_excess obtain ⟨e, he_mult, he_notLL⟩ := h_LL_excess refine ⟨e, ?_, he_mult⟩ -- The local `isLL` and the global `isLLEdge` are definitionally equal. @@ -4764,7 +4764,7 @@ lemma exists_not_mem_rangeFinset {T k : ℕ} (φ : Fin k → Fin T) classical rw [surjective_iff_rangeFinset_eq_univ] at h by_contra hcontra - push_neg at hcontra + push Not at hcontra apply h exact Finset.eq_univ_iff_forall.mpr hcontra @@ -4863,7 +4863,7 @@ theorem tupleEquivSimple_restrict {T k : ℕ} rw [SimpleGraph.mem_edgeFinset] at he ⊢ induction e using Sym2.ind with | _ a b => - simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq] at * + simp only [Function.Embedding.sym2Map_apply, Sym2.map_mk] at * rw [SimpleGraph.mem_edgeSet] at he ⊢ rw [SimpleGraph.map_adj] exact ⟨a, b, he, rfl, rfl⟩ @@ -4881,7 +4881,7 @@ theorem tupleEquivSimple_restrict {T k : ℕ} obtain ⟨a, b, hab, hax, hby⟩ := he refine ⟨s(a, b), ?_, ?_⟩ · rw [SimpleGraph.mem_edgeFinset, SimpleGraph.mem_edgeSet]; exact hab - · simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq] + · simp only [Function.Embedding.sym2Map_apply, Sym2.map_mk] rw [hax, hby] · -- 4. Term-by-term equality. intro e _ @@ -4894,7 +4894,7 @@ theorem tupleEquivSimple_restrict {T k : ℕ} by have := v.isLt; omega⟩ with hν_def induction e using Sym2.ind with | _ a b => - simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq] + simp only [Function.Embedding.sym2Map_apply, Sym2.map_mk] change B (ν' (Quot.out s(a, b)).1) (ν' (Quot.out s(a, b)).2) = B (ν (Quot.out s(shift a, shift b)).1) (ν (Quot.out s(shift a, shift b)).2) @@ -5032,7 +5032,7 @@ theorem exists_extension_of_coeffRestrictSimple_pos {T k : ℕ} ∃ a : Fin T, tupleEquivSimple B W μ (Fin.snoc ψ a) := by classical by_contra h_no - push_neg at h_no + push Not at h_no -- Every term vanishes, so the sum is 0, contradicting positivity. have h_all_zero : ∀ t : Fin T, (if tupleEquivSimple B W μ (Fin.snoc ψ t) then W t else 0) = 0 := by @@ -5089,7 +5089,7 @@ private theorem functional_span_zero {Q : Type*} [Fintype Q] [DecidableEq Q] intro d hm hd_ortho by_cases h_all_zero : ∀ q, d q = 0 · exact h_all_zero - push_neg at h_all_zero + push Not at h_all_zero obtain ⟨q₀, hq₀⟩ := h_all_zero by_cases h_unique : ∀ q, q ≠ q₀ → d q = 0 · obtain ⟨i₀, hi₀⟩ := hconst @@ -5101,7 +5101,7 @@ private theorem functional_span_zero {Q : Type*} [Fintype Q] [DecidableEq Q] Finset.sum_eq_zero fun q hq => h_unique q (Finset.ne_of_mem_erase hq) rw [hzero, add_zero] at h exact absurd h hq₀ - · push_neg at h_unique + · push Not at h_unique obtain ⟨q₁, hq₁_ne, hq₁⟩ := h_unique obtain ⟨i_sep, hi_sep⟩ := hsep q₀ q₁ hq₁_ne.symm let d' : Q → ℝ := fun q => d q * (f i_sep q - f i_sep q₀) @@ -5683,7 +5683,7 @@ theorem tupleEquivSimple_restrict_along {T k T' : ℕ} rw [SimpleGraph.mem_edgeFinset] at he ⊢ induction e using Sym2.ind with | _ a b => - simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq] at * + simp only [Function.Embedding.sym2Map_apply, Sym2.map_mk] at * rw [SimpleGraph.mem_edgeSet] at he ⊢ rw [SimpleGraph.map_adj] exact ⟨a, b, he, rfl, rfl⟩ @@ -5699,7 +5699,7 @@ theorem tupleEquivSimple_restrict_along {T k T' : ℕ} obtain ⟨a, b, hab, hax, hby⟩ := he refine ⟨s(a, b), ?_, ?_⟩ · rw [SimpleGraph.mem_edgeFinset, SimpleGraph.mem_edgeSet]; exact hab - · simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq] + · simp only [Function.Embedding.sym2Map_apply, Sym2.map_mk] rw [hax, hby] · intro e _ set ν' : Fin (n + T') → Fin T := fun v => @@ -5710,7 +5710,7 @@ theorem tupleEquivSimple_restrict_along {T k T' : ℕ} else σ ⟨(v : Fin (n + k)).val - k, by have := v.isLt; omega⟩ with hν_def induction e using Sym2.ind with | _ a b => - simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq] + simp only [Function.Embedding.sym2Map_apply, Sym2.map_mk] change B (ν' (Quot.out s(a, b)).1) (ν' (Quot.out s(a, b)).2) = B (ν (Quot.out s(shift a, shift b)).1) (ν (Quot.out s(shift a, shift b)).2) rw [h_edge_rep ν' a b, h_edge_rep ν (shift a) (shift b)] @@ -6050,7 +6050,7 @@ theorem tupleEquivSimple_surjective_case {T k : ℕ} by_cases hj : ∃ i, r i = j · obtain ⟨i, rfl⟩ := hj rw [hψr_eq i, hr_spec i] - · push_neg at hj + · push Not at hj set i₀ : Fin T := φ j with hi₀ let r' : Fin T → Fin k := fun i => if i = i₀ then j else r i have hr'_spec : ∀ i, φ (r' i) = i := by @@ -8027,7 +8027,7 @@ theorem exists_sep_of_not_tupleEquivMulti {T K : ℕ} {B : Fin T → Fin T → ∃ (n : ℕ) (M : MultiLabeledGraph K n), multiLabeledEvalK K n M B W η ≠ multiLabeledEvalK K n M B W μ := by unfold tupleEquivMulti at h - push_neg at h + push Not at h exact h /-- **`tupleEquivMulti`-class indicator** of `μ`: `1` on `μ`'s equivalence class, `0` elsewhere. -/ @@ -8197,7 +8197,7 @@ theorem tupleEquivMulti_extend_one {T k : ℕ} -- A positive trace sum forces some `Fin.snoc ξ' t` into `μ`'s class. have hex : ∃ t : Fin T, tupleEquivMulti B W (Fin.snoc ξ' t) μ := by by_contra hcon - push_neg at hcon + push Not at hcon have hzero : traceLastTupleFun W (tupleEquivMultiIndicator B W μ) ξ' = 0 := by unfold traceLastTupleFun apply Finset.sum_eq_zero @@ -8313,14 +8313,14 @@ private theorem addIsoLabel_prod_reindex {T K n : ℕ} (M : MultiLabeledGraph K apply he rw [Finset.mem_map] refine ⟨s(u', v'), Finset.mem_univ _, ?_⟩ - rw [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq, + rw [Function.Embedding.sym2Map_apply, Sym2.map_mk, ← insLabelEmb_eq_of_unInsLabel K n hca, ← insLabelEmb_eq_of_unInsLabel K n hcb] rw [hfac] refine Finset.prod_congr rfl fun e' _ => ?_ rw [addIsoLabel_mult_map_emb] congr 1 refine Sym2.ind (fun a b => ?_) e' - rw [Sym2.map_pair_eq, + rw [Sym2.map_mk, B_quot_out_eq hB τ₂ (insLabelEmb K n a) (insLabelEmb K n b), B_quot_out_eq hB τ₁ a b, halign a, halign b] @@ -8569,14 +8569,14 @@ private theorem restrictAlongGraph_prod_reindex {T k l n : ℕ} (e : Fin k ↪ F exfalso; apply hd rw [Finset.mem_map] refine ⟨s(u', v'), Finset.mem_univ _, ?_⟩ - rw [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq, + rw [Function.Embedding.sym2Map_apply, Sym2.map_mk, ← restrictAlongEmb_eq_of_unembAlong e hca, ← restrictAlongEmb_eq_of_unembAlong e hcb] rw [hfac] refine Finset.prod_congr rfl fun d' _ => ?_ rw [restrictAlongGraph_mult_map_emb] congr 1 refine Sym2.ind (fun a b => ?_) d' - rw [Sym2.map_pair_eq, + rw [Sym2.map_mk, B_quot_out_eq hB τ₂ (restrictAlongEmb e n a) (restrictAlongEmb e n b), B_quot_out_eq hB τ₁ a b, halign a, halign b] @@ -8976,7 +8976,7 @@ theorem multiTau_liftLabelPerm {T K n : ℕ} (ρ : Equiv.Perm (Fin K)) (ζ : Fin def MultiLabeledGraph.relabel {K n : ℕ} (ρ : Equiv.Perm (Fin K)) (M : MultiLabeledGraph K n) : MultiLabeledGraph K n where mult e := M.mult (Sym2.map (liftLabelPerm ρ).symm e) - multNoLoop x := by rw [Sym2.map_pair_eq]; exact M.multNoLoop _ + multNoLoop x := by rw [Sym2.map_mk]; exact M.multNoLoop _ theorem multiLabeledEvalK_relabel {T K n : ℕ} (ρ : Equiv.Perm (Fin K)) (M : MultiLabeledGraph K n) (B : Fin T → Fin T → ℝ) (hB : ∀ i j, B i j = B j i) (W : Fin T → ℝ) @@ -9001,7 +9001,7 @@ theorem multiLabeledEvalK_relabel {T K n : ℕ} (ρ : Equiv.Perm (Fin K)) have hmult : (M.relabel ρ).mult (Sym2.map (liftLabelPerm ρ) s(a, b)) = M.mult s(a, b) := by show M.mult (Sym2.map (liftLabelPerm ρ).symm (Sym2.map (liftLabelPerm ρ) s(a, b))) = M.mult s(a, b) rw [Sym2.map_map, hsymm, Sym2.map_id, id_eq] - rw [hmult, Sym2.map_pair_eq, + rw [hmult, Sym2.map_mk, B_quot_out_eq hB (multiTau K n (ζ ∘ ρ) σ) a b, B_quot_out_eq hB (multiTau K n ζ σ) (liftLabelPerm ρ a) (liftLabelPerm ρ b), multiTau_liftLabelPerm ρ ζ σ a, multiTau_liftLabelPerm ρ ζ σ b] @@ -9221,7 +9221,7 @@ theorem tupleEquivMulti_implies_orbit {T K : ℕ} · exact tupleEquivMulti_surjective_case B hB W hW htwin hsurj hξξ' · have hv_ex : ∃ v, v ∉ Finset.image ξ Finset.univ := by by_contra hno - push_neg at hno + push Not at hno exact hsurj fun v => by obtain ⟨a, _, ha⟩ := Finset.mem_image.mp (hno v); exact ⟨a, ha⟩ obtain ⟨v, hv⟩ := hv_ex @@ -9273,7 +9273,7 @@ theorem multiEval_separates_orbits {T K : ℕ} ∃ (n : ℕ) (M : MultiLabeledGraph K n), multiLabeledEvalK K n M B W ξ ≠ multiLabeledEvalK K n M B W η := by by_contra hcon - push_neg at hcon + push Not at hcon exact h (tupleEquivMulti_implies_orbit B hB W hW htwin hcon) /-- Separator packaging (avoids nested `Classical.choose` instance issues). @@ -9814,7 +9814,7 @@ private theorem k1_orbit_sep_aux {T : ℕ} ∃ (n : ℕ) (F : SimpleGraph (Fin (n + 1))) (_ : DecidableRel F.Adj), rootedProfile B W i F ≠ rootedProfile B W j F := by by_contra h_no_sep - push_neg at h_no_sep + push Not at h_no_sep apply h have h_eq : tupleEquivSimple B W (fun _ : Fin 1 => i) (fun _ : Fin 1 => j) := by intro n F hF @@ -10245,7 +10245,7 @@ private theorem rootedProfileEquiv_of_tupleEquivSimple {T K : ℕ} rw [SimpleGraph.mem_edgeFinset] at he ⊢ induction e using Sym2.ind with | _ x y => - simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq] at * + simp only [Function.Embedding.sym2Map_apply, Sym2.map_mk] at * rw [SimpleGraph.mem_edgeSet] at he ⊢ rw [SimpleGraph.map_adj] exact ⟨x, y, he, rfl, rfl⟩ @@ -10263,7 +10263,7 @@ private theorem rootedProfileEquiv_of_tupleEquivSimple {T K : ℕ} obtain ⟨x, y, hxy, hxu, hyv⟩ := he refine ⟨s(x, y), ?_, ?_⟩ · rw [SimpleGraph.mem_edgeFinset, SimpleGraph.mem_edgeSet]; exact hxy - · simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq] + · simp only [Function.Embedding.sym2Map_apply, Sym2.map_mk] rw [hxu, hyv] · -- 4. Term-by-term: B (τ_F (out e).1) (τ_F (out e).2) -- = B (τ_G (out (emb.sym2Map e)).1) (τ_G (out (emb.sym2Map e)).2). @@ -10343,7 +10343,7 @@ private theorem rootedProfileEquiv_of_tupleEquivSimple {T K : ℕ} -- Use h_edge_rep to bypass Quot.out orientation. induction e using Sym2.ind with | _ x y => - simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq] + simp only [Function.Embedding.sym2Map_apply, Sym2.map_mk] rw [h_edge_rep τF x y, h_edge_rep τG (emb x) (emb y)] rw [hτ x, hτ y] @@ -11097,7 +11097,7 @@ theorem rooted_profiles_separate_vertex_orbits {T : ℕ} rootedProfile B W i F ≠ rootedProfile B W j F := by -- Contrapositive of rootedProfileEquiv_imp_vertexOrbitRel. by_contra h_no_sep - push_neg at h_no_sep + push Not at h_no_sep apply h apply rootedProfileEquiv_imp_vertexOrbitRel B hB W hW htwin intro n F hF_dec diff --git a/Graphon/MatrixDetermination.lean b/Graphon/MatrixDetermination.lean index 468cce9..b2f1491 100644 --- a/Graphon/MatrixDetermination.lean +++ b/Graphon/MatrixDetermination.lean @@ -2307,7 +2307,7 @@ private theorem weightedHomSum_collapse {k : ℕ} · subst h; simp · rw [if_neg h] obtain ⟨v, hv⟩ : ∃ v, ¬(rowClassMap c (σ v) = τ v) := by - by_contra hall; push_neg at hall; exact h (funext hall).symm + by_contra hall; push Not at hall; exact h (funext hall).symm exact Finset.prod_eq_zero (Finset.mem_univ v) (if_neg hv) simp_rw [h_ind, ite_mul, zero_mul] simp only [Finset.sum_ite_eq', Finset.mem_univ, ite_true] @@ -2394,7 +2394,7 @@ private theorem rootAttach_edgeFinset (n : ℕ) (G : SimpleGraph (Fin (n + 1))) · left; exact Sym2.eq_iff.mpr (Or.inr ⟨Fin.ext ha, Fin.ext hb⟩) · right refine ⟨s(⟨a.val - 1, by omega⟩, ⟨b.val - 1, by omega⟩), hadj, ?_⟩ - simp only [Sym2.map_pair_eq, Fin.coe_succEmb] + simp only [Sym2.map_mk, Fin.coe_succEmb] exact Sym2.eq_iff.mpr (Or.inl ⟨Fin.ext (by simp [Fin.val_succ]; omega), Fin.ext (by simp [Fin.val_succ]; omega)⟩) @@ -2407,7 +2407,7 @@ private theorem rootAttach_edgeFinset (n : ℕ) (G : SimpleGraph (Fin (n + 1))) induction e' using Sym2.ind with | _ a b => rw [SimpleGraph.mem_edgeSet] at he' - simp only [Sym2.map_pair_eq, Fin.coe_succEmb, SimpleGraph.mem_edgeSet] + simp only [Sym2.map_mk, Fin.coe_succEmb, SimpleGraph.mem_edgeSet] exact Or.inr (Or.inr ⟨by simp [Fin.val_succ], by simp [Fin.val_succ], by convert he' using 2 <;> simp [Fin.val_succ]⟩) @@ -2421,7 +2421,7 @@ private theorem rootAttach_bridge_not_mem_shifted (n : ℕ) obtain ⟨e, _, he⟩ := hmem induction e using Sym2.ind with | _ a b => - simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq, Fin.coe_succEmb] at he + simp only [Function.Embedding.sym2Map_apply, Sym2.map_mk, Fin.coe_succEmb] at he rw [Sym2.eq_iff] at he rcases he with ⟨h1, _⟩ | ⟨_, h1⟩ <;> exact absurd (congr_arg Fin.val h1) (by simp [Fin.val_succ]) @@ -2454,7 +2454,7 @@ private theorem rootAttach_prod_eq {k : ℕ} (n : ℕ) (G : SimpleGraph (Fin (n -- Shifted edge: resolve Quot.out of mapped edge (use symmetry of c) induction e using Sym2.ind with | _ a b => - simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq, Fin.coe_succEmb] + simp only [Function.Embedding.sym2Map_apply, Sym2.map_mk, Fin.coe_succEmb] have hout : s((Quot.out s(Fin.succ a, Fin.succ b)).1, (Quot.out s(Fin.succ a, Fin.succ b)).2) = s(Fin.succ a, Fin.succ b) := Quot.out_eq _ @@ -2553,13 +2553,13 @@ private theorem rootGlue_edgeFinset (n₁ n₂ : ℕ) (F₁ : SimpleGraph (Fin ( rcases he with ⟨ha, hb, hadj⟩ | ⟨ha, hb, hadj⟩ · left refine ⟨s(⟨a.val, by omega⟩, ⟨b.val, by omega⟩), hadj, ?_⟩ - simp only [Sym2.map_pair_eq, rootGlueEmb₁] + simp only [Sym2.map_mk, rootGlueEmb₁] exact Sym2.eq_iff.mpr (Or.inl ⟨Fin.ext rfl, Fin.ext rfl⟩) · right refine ⟨s(⟨if a.val = 0 then 0 else a.val - n₁, by have := a.isLt; split_ifs <;> omega⟩, ⟨if b.val = 0 then 0 else b.val - n₁, by have := b.isLt; split_ifs <;> omega⟩), hadj, ?_⟩ - simp only [Sym2.map_pair_eq, rootGlueEmb₂, Function.Embedding.coeFn_mk] + simp only [Sym2.map_mk, rootGlueEmb₂, Function.Embedding.coeFn_mk] apply Sym2.eq_iff.mpr; left; constructor · apply Fin.ext rcases ha with ha₀ | ha₁ @@ -2578,14 +2578,14 @@ private theorem rootGlue_edgeFinset (n₁ n₂ : ℕ) (F₁ : SimpleGraph (Fin ( · induction e' using Sym2.ind with | _ a b => simp only [SimpleGraph.mem_edgeFinset, SimpleGraph.mem_edgeSet] at he' - simp only [Sym2.map_pair_eq, rootGlueEmb₁, SimpleGraph.mem_edgeSet, + simp only [Sym2.map_mk, rootGlueEmb₁, SimpleGraph.mem_edgeSet, rootGlue, Function.Embedding.coeFn_mk] exact Or.inl ⟨by have := a.isLt; omega, by have := b.isLt; omega, by convert he' using 2 <;> exact Fin.ext (by simp)⟩ · induction e' using Sym2.ind with | _ a b => simp only [SimpleGraph.mem_edgeFinset, SimpleGraph.mem_edgeSet] at he' - simp only [Sym2.map_pair_eq, SimpleGraph.mem_edgeFinset, SimpleGraph.mem_edgeSet] + simp only [Sym2.map_mk, SimpleGraph.mem_edgeFinset, SimpleGraph.mem_edgeSet] show (rootGlue n₁ n₂ F₁ F₂).Adj (rootGlueEmb₂ n₁ n₂ a) (rootGlueEmb₂ n₁ n₂ b) apply Or.inr refine ⟨?_, ?_, ?_⟩ @@ -2621,7 +2621,7 @@ private theorem rootGlue_edgeFinset_disjoint (n₁ n₂ : ℕ) simp only [SimpleGraph.mem_edgeFinset, SimpleGraph.mem_edgeSet] at he₁' induction e₂ using Sym2.ind with | _ a₂ b₂ => - simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq, + simp only [Function.Embedding.sym2Map_apply, Sym2.map_mk, rootGlueEmb₁, rootGlueEmb₂, Function.Embedding.coeFn_mk] at he₂eq have hne := F₁.ne_of_adj he₁' have ha₁ := a₁.isLt; have hb₁ := b₁.isLt @@ -2663,11 +2663,11 @@ private theorem rootGlue_prod_eq {k : ℕ} (n₁ n₂ : ℕ) congr 1; ext e induction e using Sym2.ind with | _ a b => - simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq, Function.comp_apply] + simp only [Function.Embedding.sym2Map_apply, Sym2.map_mk, Function.comp_apply] have hout_new : s((Quot.out (Sym2.map emb s(a, b))).1, (Quot.out (Sym2.map emb s(a, b))).2) = Sym2.map emb s(a, b) := Quot.out_eq _ - rw [Sym2.map_pair_eq] at hout_new + rw [Sym2.map_mk] at hout_new rw [Sym2.eq_iff] at hout_new have hout_old : s((Quot.out s(a, b)).1, (Quot.out s(a, b)).2) = s(a, b) := Quot.out_eq _ rw [Sym2.eq_iff] at hout_old @@ -2882,7 +2882,7 @@ private theorem leftAttach2_edgeFinset (n : ℕ) (F : SimpleGraph (Fin (n + 2))) · left; exact Sym2.eq_iff.mpr (Or.inl ⟨Fin.ext ha, Fin.ext hb⟩) · left; exact Sym2.eq_iff.mpr (Or.inr ⟨Fin.ext ha, Fin.ext hb⟩) · right - exact ⟨s(x, y), hadj, by rw [Sym2.map_pair_eq]; exact Sym2.eq_iff.mpr (Or.inl ⟨hx, hy⟩)⟩ + exact ⟨s(x, y), hadj, by rw [Sym2.map_mk]; exact Sym2.eq_iff.mpr (Or.inl ⟨hx, hy⟩)⟩ · intro he rcases he with rfl | ⟨e', he', rfl⟩ · -- Bridge edge @@ -2892,7 +2892,7 @@ private theorem leftAttach2_edgeFinset (n : ℕ) (F : SimpleGraph (Fin (n + 2))) induction e' using Sym2.ind with | _ a b => rw [SimpleGraph.mem_edgeSet] at he' - simp only [Sym2.map_pair_eq, SimpleGraph.mem_edgeSet] + simp only [Sym2.map_mk, SimpleGraph.mem_edgeSet] exact Or.inr (Or.inr ⟨a, b, he', rfl, rfl⟩) /-- The bridge edge `s(0, 2)` is not a shifted `F`-edge (since 0 is not in the range of @@ -2906,7 +2906,7 @@ private theorem leftAttach2_bridge_not_mem_shifted (n : ℕ) obtain ⟨e, _, he⟩ := hmem induction e using Sym2.ind with | _ a b => - simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq] at he + simp only [Function.Embedding.sym2Map_apply, Sym2.map_mk] at he rw [Sym2.eq_iff] at he -- leftAttach2Shift never maps to 0, so no shifted edge contains vertex 0. -- But the bridge edge s(0, 2) has vertex 0. Contradiction. @@ -2950,7 +2950,7 @@ private theorem leftAttach2_prod_eq {k : ℕ} (n : ℕ) (F : SimpleGraph (Fin (n -- Shifted edge: resolve Quot.out of mapped edge (use symmetry of c) induction e using Sym2.ind with | _ a b => - simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq] + simp only [Function.Embedding.sym2Map_apply, Sym2.map_mk] have hout : s((Quot.out s(leftAttach2Shift n a, leftAttach2Shift n b)).1, (Quot.out s(leftAttach2Shift n a, leftAttach2Shift n b)).2) = s(leftAttach2Shift n a, leftAttach2Shift n b) := Quot.out_eq _ @@ -3078,7 +3078,7 @@ private theorem rightAttach2_edgeFinset (n : ℕ) (F : SimpleGraph (Fin (n + 2)) · left; exact Sym2.eq_iff.mpr (Or.inl ⟨Fin.ext ha, Fin.ext hb⟩) · left; exact Sym2.eq_iff.mpr (Or.inr ⟨Fin.ext ha, Fin.ext hb⟩) · right - exact ⟨s(x, y), hadj, by rw [Sym2.map_pair_eq]; exact Sym2.eq_iff.mpr (Or.inl ⟨hx, hy⟩)⟩ + exact ⟨s(x, y), hadj, by rw [Sym2.map_mk]; exact Sym2.eq_iff.mpr (Or.inl ⟨hx, hy⟩)⟩ · intro he rcases he with rfl | ⟨e', he', rfl⟩ · rw [SimpleGraph.mem_edgeSet] @@ -3086,7 +3086,7 @@ private theorem rightAttach2_edgeFinset (n : ℕ) (F : SimpleGraph (Fin (n + 2)) · induction e' using Sym2.ind with | _ a b => rw [SimpleGraph.mem_edgeSet] at he' - simp only [Sym2.map_pair_eq, SimpleGraph.mem_edgeSet] + simp only [Sym2.map_mk, SimpleGraph.mem_edgeSet] exact Or.inr (Or.inr ⟨a, b, he', rfl, rfl⟩) private theorem rightAttach2_bridge_not_mem_shifted (n : ℕ) @@ -3098,7 +3098,7 @@ private theorem rightAttach2_bridge_not_mem_shifted (n : ℕ) obtain ⟨e, _, he⟩ := hmem induction e using Sym2.ind with | _ a b => - simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq] at he + simp only [Function.Embedding.sym2Map_apply, Sym2.map_mk] at he rw [Sym2.eq_iff] at he all_goals { rcases he with ⟨h1, h2⟩ | ⟨h1, h2⟩ @@ -3135,7 +3135,7 @@ private theorem rightAttach2_prod_eq {k : ℕ} (n : ℕ) (F : SimpleGraph (Fin ( · congr 1; ext e induction e using Sym2.ind with | _ a b => - simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq] + simp only [Function.Embedding.sym2Map_apply, Sym2.map_mk] have hout : s((Quot.out s(rightAttach2Shift n a, rightAttach2Shift n b)).1, (Quot.out s(rightAttach2Shift n a, rightAttach2Shift n b)).2) = s(rightAttach2Shift n a, rightAttach2Shift n b) := Quot.out_eq _ @@ -3626,20 +3626,20 @@ private theorem edgeFreeGlue2_edgeFinset (n₁ n₂ : ℕ) glueShift2 n₁ n₂ x = a ∧ glueShift2 n₁ n₂ y = b)) at he rcases he with ⟨x, y, hadj, hx, hy⟩ | ⟨x, y, hadj, hx, hy⟩ · left; exact ⟨s(x, y), hadj, - by simp only [Sym2.map_pair_eq]; exact Sym2.eq_iff.mpr (Or.inl ⟨hx, hy⟩)⟩ + by simp only [Sym2.map_mk]; exact Sym2.eq_iff.mpr (Or.inl ⟨hx, hy⟩)⟩ · right; exact ⟨s(x, y), hadj, - by simp only [Sym2.map_pair_eq]; exact Sym2.eq_iff.mpr (Or.inl ⟨hx, hy⟩)⟩ + by simp only [Sym2.map_mk]; exact Sym2.eq_iff.mpr (Or.inl ⟨hx, hy⟩)⟩ · intro he rcases he with ⟨e', he', rfl⟩ | ⟨e', he', rfl⟩ · induction e' using Sym2.ind with | _ a b => simp only [SimpleGraph.mem_edgeFinset, SimpleGraph.mem_edgeSet] at he' - simp only [Sym2.map_pair_eq, SimpleGraph.mem_edgeSet] + simp only [Sym2.map_mk, SimpleGraph.mem_edgeSet] exact Or.inl ⟨a, b, he', rfl, rfl⟩ · induction e' using Sym2.ind with | _ a b => simp only [SimpleGraph.mem_edgeFinset, SimpleGraph.mem_edgeSet] at he' - simp only [Sym2.map_pair_eq, SimpleGraph.mem_edgeSet] + simp only [Sym2.map_mk, SimpleGraph.mem_edgeSet] exact Or.inr ⟨a, b, he', rfl, rfl⟩ /-- The two shifted edge finsets in `edgeFreeGlue2` are disjoint (using h₁, h₂). -/ @@ -3664,7 +3664,7 @@ private theorem edgeFreeGlue2_edgeFinset_disjoint (n₁ n₂ : ℕ) have ha₁ := a₁.isLt; have hb₁ := b₁.isLt have ha₂ := a₂.isLt; have hb₂ := b₂.isLt -- Unfold both shifts and work at val level - simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq, + simp only [Function.Embedding.sym2Map_apply, Sym2.map_mk, glueShift1, glueShift2, Function.Embedding.coeFn_mk] at he₂eq -- Extract the Fin equalities from the Sym2 equality -- Helper: ⟨x.val,_⟩ equals glueShift2 image implies x.val ∈ {0,1} @@ -3727,11 +3727,11 @@ private theorem edgeFreeGlue2_prod_eq {k : ℕ} (n₁ n₂ : ℕ) congr 1; ext e induction e using Sym2.ind with | _ a b => - simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq, Function.comp_apply] + simp only [Function.Embedding.sym2Map_apply, Sym2.map_mk, Function.comp_apply] have hout_new : s((Quot.out (Sym2.map emb s(a, b))).1, (Quot.out (Sym2.map emb s(a, b))).2) = Sym2.map emb s(a, b) := Quot.out_eq _ - rw [Sym2.map_pair_eq] at hout_new + rw [Sym2.map_mk] at hout_new rw [Sym2.eq_iff] at hout_new have hout_old : s((Quot.out s(a, b)).1, (Quot.out s(a, b)).2) = s(a, b) := Quot.out_eq _ rw [Sym2.eq_iff] at hout_old @@ -4503,7 +4503,7 @@ private theorem tupleEquiv_restrict {T : ℕ} -- in (SimpleGraph.map shift F').edgeSet. induction e using Sym2.ind with | _ a b => - simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq] at * + simp only [Function.Embedding.sym2Map_apply, Sym2.map_mk] at * rw [SimpleGraph.mem_edgeSet] at he ⊢ rw [SimpleGraph.map_adj] exact ⟨a, b, he, rfl, rfl⟩ @@ -4521,7 +4521,7 @@ private theorem tupleEquiv_restrict {T : ℕ} obtain ⟨a, b, hab, hax, hby⟩ := he refine ⟨s(a, b), ?_, ?_⟩ · rw [SimpleGraph.mem_edgeFinset, SimpleGraph.mem_edgeSet]; exact hab - · simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq] + · simp only [Function.Embedding.sym2Map_apply, Sym2.map_mk] rw [hax, hby] · -- 4. Term-by-term equality. intro e _ @@ -4536,7 +4536,7 @@ private theorem tupleEquiv_restrict {T : ℕ} -- Induct on e : Sym2 (Fin (n+k)). induction e using Sym2.ind with | _ a b => - simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq] + simp only [Function.Embedding.sym2Map_apply, Sym2.map_mk] -- Goal: B (ν' (out s(a,b)).1) (ν' (out s(a,b)).2) = -- B (ν (out s(shift a, shift b)).1) (ν (out s(shift a, shift b)).2). change B (ν' (Quot.out s(a, b)).1) (ν' (Quot.out s(a, b)).2) = @@ -4555,14 +4555,14 @@ private theorem tupleEquiv_restrict {T : ℕ} rw [Fin.succAbove_of_castSucc_lt] · rfl · show v.castSucc < p - simp only [Fin.lt_iff_val_lt_val, Fin.coe_castSucc] + simp only [Fin.lt_def, Fin.val_castSucc] exact hv have h_lt : ((shift v : Fin (n + (k + 1))) : ℕ) < k + 1 := by rw [h_shift_val]; omega simp only [hν_def, hν'_def, dif_pos h_lt, dif_pos hv, restrictTuple] congr 1 apply Fin.ext - simp only [Fin.coe_castSucc] + simp only [Fin.val_castSucc] exact h_shift_val · -- Above the pivot: shift v = v.succ, (shift v).val = v.val + 1. have h_shift_val : (shift v : Fin (n + (k + 1))).val = v.val + 1 := by @@ -4571,7 +4571,7 @@ private theorem tupleEquiv_restrict {T : ℕ} rw [Fin.succAbove_of_le_castSucc] · rfl · show p ≤ v.castSucc - simp only [Fin.le_iff_val_le_val, Fin.coe_castSucc] + simp only [Fin.le_iff_val_le_val, Fin.val_castSucc] show k ≤ v.val omega have h_not_lt : ¬ ((shift v : Fin (n + (k + 1))) : ℕ) < k + 1 := by @@ -4675,7 +4675,7 @@ private theorem tupleEquiv_dom_perm {T : ℕ} rw [SimpleGraph.mem_edgeFinset] at he ⊢ induction e using Sym2.ind with | _ a b => - simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq] at * + simp only [Function.Embedding.sym2Map_apply, Sym2.map_mk] at * rw [SimpleGraph.mem_edgeSet] at he ⊢ rw [SimpleGraph.map_adj] exact ⟨a, b, he, rfl, rfl⟩ @@ -4690,7 +4690,7 @@ private theorem tupleEquiv_dom_perm {T : ℕ} obtain ⟨a, b, hab, hax, hby⟩ := he refine ⟨s(a, b), ?_, ?_⟩ · rw [SimpleGraph.mem_edgeFinset, SimpleGraph.mem_edgeSet]; exact hab - · simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq] + · simp only [Function.Embedding.sym2Map_apply, Sym2.map_mk] rw [hax, hby] · intro e _ set ν' : Fin (n + k) → Fin T := fun v => @@ -4701,7 +4701,7 @@ private theorem tupleEquiv_dom_perm {T : ℕ} else σ ⟨(v : Fin (n + k)).val - k, by have := v.isLt; omega⟩ with hν_def induction e using Sym2.ind with | _ a b => - simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq] + simp only [Function.Embedding.sym2Map_apply, Sym2.map_mk] change B (ν' (Quot.out s(a, b)).1) (ν' (Quot.out s(a, b)).2) = B (ν (Quot.out s(σ_perm a, σ_perm b)).1) (ν (Quot.out s(σ_perm a, σ_perm b)).2) rw [h_edge ν' a b, h_edge ν (σ_perm a) (σ_perm b)] @@ -4830,7 +4830,7 @@ private theorem tupleEquiv_restrict_along {T k T' : ℕ} rw [SimpleGraph.mem_edgeFinset] at he ⊢ induction e using Sym2.ind with | _ a b => - simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq] at * + simp only [Function.Embedding.sym2Map_apply, Sym2.map_mk] at * rw [SimpleGraph.mem_edgeSet] at he ⊢ rw [SimpleGraph.map_adj] exact ⟨a, b, he, rfl, rfl⟩ @@ -4845,7 +4845,7 @@ private theorem tupleEquiv_restrict_along {T k T' : ℕ} obtain ⟨a, b, hab, hax, hby⟩ := he refine ⟨s(a, b), ?_, ?_⟩ · rw [SimpleGraph.mem_edgeFinset, SimpleGraph.mem_edgeSet]; exact hab - · simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq] + · simp only [Function.Embedding.sym2Map_apply, Sym2.map_mk] rw [hax, hby] · intro e _ set ν' : Fin (n + T') → Fin T := fun v => @@ -4856,7 +4856,7 @@ private theorem tupleEquiv_restrict_along {T k T' : ℕ} else σ ⟨(v : Fin (n + k)).val - k, by have := v.isLt; omega⟩ with hν_def induction e using Sym2.ind with | _ a b => - simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq] + simp only [Function.Embedding.sym2Map_apply, Sym2.map_mk] change B (ν' (Quot.out s(a, b)).1) (ν' (Quot.out s(a, b)).2) = B (ν (Quot.out s(shift a, shift b)).1) (ν (Quot.out s(shift a, shift b)).2) rw [h_edge' ν' a b, h_edge ν (shift a) (shift b)] @@ -5027,7 +5027,7 @@ private theorem functional_span_zero {Q : Type*} [Fintype Q] [DecidableEq Q] -- If d = 0, done. by_cases h_all_zero : ∀ q, d q = 0 · exact h_all_zero - push_neg at h_all_zero + push Not at h_all_zero obtain ⟨q₀, hq₀⟩ := h_all_zero -- If q₀ is the only nonzero, use hconst to derive contradiction. by_cases h_unique : ∀ q, q ≠ q₀ → d q = 0 @@ -5041,7 +5041,7 @@ private theorem functional_span_zero {Q : Type*} [Fintype Q] [DecidableEq Q] rw [hzero, add_zero] at this exact absurd this hq₀ · -- ∃ q₁ ≠ q₀ with d(q₁) ≠ 0. - push_neg at h_unique + push Not at h_unique obtain ⟨q₁, hq₁_ne, hq₁⟩ := h_unique -- Find f_i separating q₀ and q₁. obtain ⟨i_sep, hi_sep⟩ := hsep q₀ q₁ hq₁_ne.symm @@ -5661,7 +5661,7 @@ private theorem tupleEquiv_surjective_case_both {T : ℕ} obtain ⟨i, rfl⟩ := hj rw [hψr_eq i, hr_spec i] · -- j ∉ im(r). Build alternative section r' with r'(φ j) = j. - push_neg at hj + push Not at hj set i₀ : Fin T := φ j with hi₀ let r' : Fin T → Fin k := fun i => if i = i₀ then j else r i have hr'_spec : ∀ i, φ (r' i) = i := by @@ -5833,7 +5833,7 @@ private theorem labeledEvalK_glue (K : ℕ) (n₁ n₂ : ℕ) -- a₀ b₀ with both val < K contradicts hF₂. have ha₀ : a₀.val < K := by by_contra hge - push_neg at hge + push Not at hge -- a₀.val ≥ K means emb₂ a₀ = ⟨n₁ + a₀.val, _⟩, so a.val = n₁ + a₀.val ≥ K. have hval_a : a.val = (emb₂ a₀).val := by rw [← hea] have hval_e : (emb₂ a₀).val = n₁ + a₀.val := by @@ -5841,7 +5841,7 @@ private theorem labeledEvalK_glue (K : ℕ) (n₁ n₂ : ℕ) omega have hb₀ : b₀.val < K := by by_contra hge - push_neg at hge + push Not at hge have hval_b : b.val = (emb₂ b₀).val := by rw [← heb] have hval_e : (emb₂ b₀).val = n₁ + b₀.val := by simp only [emb₂, dif_neg (not_lt.mpr hge)] @@ -5927,19 +5927,19 @@ private theorem labeledEvalK_glue (K : ℕ) (n₁ n₂ : ℕ) · -- F₁-type edge: both endpoints have val < n₁+K. refine Or.inl ⟨s((⟨u.val, hu⟩ : Fin (n₁+K)), (⟨v.val, hv⟩ : Fin (n₁+K))), hadj, ?_⟩ - simp only [Sym2.map_pair_eq, e₁, Function.Embedding.coeFn_mk] + simp only [Sym2.map_mk, e₁, Function.Embedding.coeFn_mk] · -- F₂-type edge: u = emb₂ a, v = emb₂ b. refine Or.inr ⟨s(a, b), hadj, ?_⟩ - simp only [Sym2.map_pair_eq, e₂, Function.Embedding.coeFn_mk] + simp only [Sym2.map_mk, e₂, Function.Embedding.coeFn_mk] exact Sym2.eq_iff.mpr (Or.inl ⟨ha, hb⟩) · -- Backward: F₁-image or F₂-image → F₃.edgeSet rintro (⟨e₁', he₁', rfl⟩ | ⟨e₂', he₂', rfl⟩) · revert he₁'; refine Sym2.ind (fun a b => ?_) e₁'; intro he₁' - simp only [Sym2.map_pair_eq, e₁, Function.Embedding.coeFn_mk] + simp only [Sym2.map_mk, e₁, Function.Embedding.coeFn_mk] show F₃.Adj ⟨a.val, by have := a.isLt; omega⟩ ⟨b.val, by have := b.isLt; omega⟩ exact Or.inl ⟨a.isLt, b.isLt, he₁'⟩ · revert he₂'; refine Sym2.ind (fun a b => ?_) e₂'; intro he₂' - simp only [Sym2.map_pair_eq, e₂, Function.Embedding.coeFn_mk] + simp only [Sym2.map_mk, e₂, Function.Embedding.coeFn_mk] show F₃.Adj (emb₂ a) (emb₂ b) exact Or.inr ⟨a, b, rfl, rfl, he₂'⟩ have hdisj : Disjoint @@ -5953,12 +5953,12 @@ private theorem labeledEvalK_glue (K : ℕ) (n₁ n₂ : ℕ) refine Sym2.ind (fun a₂ b₂ => ?_) e₂' intro he₂' he₂eq -- he₂' : s(a₂, b₂) ∈ F₂.edgeFinset. By hF₂, at least one has val ≥ K. - simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq, e₁, e₂, + simp only [Function.Embedding.sym2Map_apply, Sym2.map_mk, e₁, e₂, Function.Embedding.coeFn_mk, Sym2.eq_iff] at he₂eq rw [SimpleGraph.mem_edgeFinset] at he₂' have hadj₂ : F₂.Adj a₂ b₂ := he₂' have hge : ¬a₂.val < K ∨ ¬b₂.val < K := by - by_contra h; push_neg at h; exact hF₂ a₂ b₂ h.1 h.2 hadj₂ + by_contra h; push Not at h; exact hF₂ a₂ b₂ h.1 h.2 hadj₂ -- emb₂ sends val ≥ K to Fin.val ≥ n₁+K. All e₁ vals are < n₁+K. have hemb_ge : ∀ v : Fin (n₂ + K), ¬v.val < K → (emb₂ v).val ≥ n₁ + K := by intro v hv; simp only [emb₂, dif_neg hv, Fin.val_mk]; omega @@ -5991,7 +5991,7 @@ private theorem labeledEvalK_glue (K : ℕ) (n₁ n₂ : ℕ) · -- F₁ terms: B(τ₃(Quot.out(e₁.sym2Map e)...) = B(τ₁(Quot.out e)...) apply Finset.prod_congr rfl; intro e _ refine Sym2.ind (fun a b => ?_) e - simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq, e₁, + simp only [Function.Embedding.sym2Map_apply, Sym2.map_mk, e₁, Function.Embedding.coeFn_mk] -- Convert to named coloring functions (definitional equality). show B (τ₃ (Quot.out s(⟨a.val, (by omega)⟩, ⟨b.val, (by omega)⟩)).1) @@ -6003,7 +6003,7 @@ private theorem labeledEvalK_glue (K : ℕ) (n₁ n₂ : ℕ) · -- F₂ terms: B(τ₃(Quot.out(e₂.sym2Map e)...) = B(τ₂(Quot.out e)...) apply Finset.prod_congr rfl; intro e _ refine Sym2.ind (fun a b => ?_) e - simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq, e₂, + simp only [Function.Embedding.sym2Map_apply, Sym2.map_mk, e₂, Function.Embedding.coeFn_mk] show B (τ₃ (Quot.out s(emb₂ a, emb₂ b)).1) (τ₃ (Quot.out s(emb₂ a, emb₂ b)).2) = B (τ₂ (Quot.out s(a, b)).1) (τ₂ (Quot.out s(a, b)).2) @@ -6399,7 +6399,7 @@ private theorem snoc_LL_decomp {T K : ℕ} (B : Fin T → Fin T → ℝ) refine ⟨Finset.mem_univ _, ?_⟩ induction s using Sym2.ind with | _ a b => - simp only [Sym2.map_pair_eq, isInner] + simp only [Sym2.map_mk, isInner] set p := Quot.out (s(a.castSucc, b.castSucc) : Sym2 (Fin (K + 1))) have hp : p.1 = a.castSucc ∧ p.2 = b.castSucc ∨ p.1 = b.castSucc ∧ p.2 = a.castSucc := by @@ -6417,7 +6417,7 @@ private theorem snoc_LL_decomp {T K : ℕ} (B : Fin T → Fin T → ℝ) have hx_inner : isInner x := hx.2 refine ⟨s(⟨(Quot.out x).1.val, hx_inner.1⟩, ⟨(Quot.out x).2.val, hx_inner.2⟩), Finset.mem_coe.mpr (Finset.mem_univ _), ?_⟩ - simp only [Sym2.map_pair_eq] + simp only [Sym2.map_mk] have e1 : ((⟨(Quot.out x).1.val, hx_inner.1⟩ : Fin K).castSucc) = (Quot.out x).1 := Fin.ext rfl have e2 : ((⟨(Quot.out x).2.val, hx_inner.2⟩ : Fin K).castSucc) = (Quot.out x).2 := @@ -6429,7 +6429,7 @@ private theorem snoc_LL_decomp {T K : ℕ} (B : Fin T → Fin T → ℝ) intro s _ induction s using Sym2.ind with | _ a b => - simp only [Sym2.map_pair_eq] + simp only [Sym2.map_mk] rw [B_quot_out_eq hB ξ, B_quot_out_eq hB (Fin.snoc ξ t : Fin (K + 1) → Fin T)] have h1 : (Fin.snoc ξ t : Fin (K + 1) → Fin T) a.castSucc = ξ a := Fin.snoc_castSucc .. @@ -6750,14 +6750,14 @@ private theorem DecLabeledGraph.trace_eval {T K n : ℕ} · -- hi: D.graph edges map to comap edges intro a ha refine Sym2.ind (fun u v h => ?_) a ha - rw [SimpleGraph.mem_edgeFinset, Sym2.map_pair_eq, SimpleGraph.mem_edgeSet] + rw [SimpleGraph.mem_edgeFinset, Sym2.map_mk, SimpleGraph.mem_edgeSet] rw [SimpleGraph.mem_edgeFinset, SimpleGraph.mem_edgeSet] at h simp only [SimpleGraph.comap_adj] convert h using 2 <;> {apply Fin.ext; simp [e, finCongr]} · -- hj: comap edges map to D.graph edges intro a ha refine Sym2.ind (fun u v h => ?_) a ha - rw [SimpleGraph.mem_edgeFinset, Sym2.map_pair_eq, SimpleGraph.mem_edgeSet] + rw [SimpleGraph.mem_edgeFinset, Sym2.map_mk, SimpleGraph.mem_edgeSet] simp only [SimpleGraph.mem_edgeFinset, SimpleGraph.mem_edgeSet, SimpleGraph.comap_adj] at h convert h using 2 <;> {apply Fin.ext; simp [e, finCongr]} · -- left_inv @@ -6769,7 +6769,7 @@ private theorem DecLabeledGraph.trace_eval {T K n : ℕ} · -- hfg: value equality for corresponding edges (uses B_quot_out_eq + hτ). intro a ha refine Sym2.ind (fun u v _ => ?_) a ha - simp only [Sym2.map_pair_eq] + simp only [Sym2.map_mk] let τ_LHS : Fin (n + (K + 1)) → Fin T := fun x => if h : (x : ℕ) < K + 1 then (Fin.snoc ξ t : Fin (K + 1) → Fin T) ⟨x, h⟩ else σ ⟨x.val - (K + 1), by have := x.isLt; omega⟩ @@ -6783,11 +6783,11 @@ private theorem DecLabeledGraph.trace_eval {T K n : ℕ} have h1 : τ_LHS u = τ_RHS (e u) := by have := hτ u simp only [τ_LHS, τ_RHS, e, finCongr_apply] - simp only [Fin.coe_cast]; exact this + simp only [Fin.val_cast]; exact this have h2 : τ_LHS v = τ_RHS (e v) := by have := hτ v simp only [τ_LHS, τ_RHS, e, finCongr_apply] - simp only [Fin.coe_cast]; exact this + simp only [Fin.val_cast]; exact this rw [h1, h2] /-! **`tupleEquiv`-invariance of the traced evaluation** — historical context. @@ -7510,7 +7510,7 @@ private theorem DecLabeledGraph.trace_parallel_lu0_descends {T K n : ℕ} B (τ (Quot.out e).1) (τ (Quot.out e).2) ^ M_trace.mult e) = 1 := by refine Finset.prod_eq_one fun e he => ?_ rw [Finset.mem_sdiff, Finset.mem_union] at he - push_neg at he + push Not at he have hM_zero : M_trace.mult e = 0 := by show (if hcr : e ∈ crossEdges then _ else if e ∈ D.trace.graph.edgeFinset then 1 else (0 : ℕ)) = 0 @@ -7613,7 +7613,7 @@ private theorem DecLabeledGraph.trace_eval_tupleEquiv_invariant {T K n : ℕ} -- `D.trace.llMult s = D.llMult (Sym2.map castSucc s)`. have h_trace_noDiag : ∀ x : Fin K, D.trace.llMult s(x, x) = 0 := fun x => by show D.llMult (Sym2.map Fin.castSucc s(x, x)) = 0 - rw [Sym2.map_pair_eq] + rw [Sym2.map_mk] exact h_diag (Fin.castSucc x) unfold DecLabeledGraphTr.eval congr 1 @@ -7882,7 +7882,7 @@ private theorem DecLabeledGraph.trace_eval_tupleEquiv_invariant {T K n : ℕ} rw [hbridge ξ, hbridge ξ'] exact h (n + 1) G' · -- **Sub-case `∃ a, lu0Mult a ≥ 2`.** Delegate to the named root. - push_neg at hle + push Not at hle obtain ⟨a, ha⟩ := hle exact DecLabeledGraph.trace_parallel_lu0_descends D B hB W hW htwin h_diag ⟨a, ha⟩ h @@ -7974,13 +7974,13 @@ private lemma DecLabeledGraph.ll_filter_eq_map {n K : ℕ} have heq : Sym2.map (DecLabeledGraph.labelEmbed (n := n)) (s((⟨(Quot.out e).1.val, hP.1⟩ : Fin K), ⟨(Quot.out e).2.val, hP.2⟩) : Sym2 _) = e := by - simp only [Sym2.map_pair_eq, DecLabeledGraph.labelEmbed, + simp only [Sym2.map_mk, DecLabeledGraph.labelEmbed, show (⟨(Quot.out e).1.val, _⟩ : Fin (n + K)) = (Quot.out e).1 from Fin.ext rfl, show (⟨(Quot.out e).2.val, _⟩ : Fin (n + K)) = (Quot.out e).2 from Fin.ext rfl] exact Quot.out_eq e rw [heq]; exact heF · -- labelEmbedding.sym2Map of preimage equals e. - simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq, + simp only [Function.Embedding.sym2Map_apply, Sym2.map_mk, DecLabeledGraph.labelEmbedding, show (⟨(Quot.out e).1.val, _⟩ : Fin (n + K)) = (Quot.out e).1 from Fin.ext rfl, show (⟨(Quot.out e).2.val, _⟩ : Fin (n + K)) = (Quot.out e).2 from Fin.ext rfl] @@ -7995,7 +7995,7 @@ private lemma DecLabeledGraph.ll_filter_eq_map {n K : ℕ} refine ⟨ha, ?_⟩ induction a using Sym2.ind with | h x y => - rw [Sym2.map_pair_eq] + rw [Sym2.map_mk] -- Derive .val equalities from h1, h2 via congr_arg Fin.val. have hout := Sym2.eq_iff.mp (Quot.out_eq (s((DecLabeledGraph.labelEmbed (n := n) x : Fin (n + K)), @@ -8095,20 +8095,20 @@ private theorem DecLabeledGraph.eval_ofSimple {T K n : ℕ} · have h1v : (Quot.out (Sym2.map (DecLabeledGraph.labelEmbed (n := n)) s(x, y))).1.val = x.val := by have := congr_arg Fin.val h1 - simp only [Sym2.map_pair_eq, DecLabeledGraph.labelEmbed] at this; exact this + simp only [Sym2.map_mk, DecLabeledGraph.labelEmbed] at this; exact this have h2v : (Quot.out (Sym2.map (DecLabeledGraph.labelEmbed (n := n)) s(x, y))).2.val = y.val := by have := congr_arg Fin.val h2 - simp only [Sym2.map_pair_eq, DecLabeledGraph.labelEmbed] at this; exact this + simp only [Sym2.map_mk, DecLabeledGraph.labelEmbed] at this; exact this exact ⟨h1v ▸ x.isLt, h2v ▸ y.isLt⟩ · have h1v : (Quot.out (Sym2.map (DecLabeledGraph.labelEmbed (n := n)) s(x, y))).1.val = y.val := by have := congr_arg Fin.val h1 - simp only [Sym2.map_pair_eq, DecLabeledGraph.labelEmbed] at this; exact this + simp only [Sym2.map_mk, DecLabeledGraph.labelEmbed] at this; exact this have h2v : (Quot.out (Sym2.map (DecLabeledGraph.labelEmbed (n := n)) s(x, y))).2.val = x.val := by have := congr_arg Fin.val h2 - simp only [Sym2.map_pair_eq, DecLabeledGraph.labelEmbed] at this; exact this + simp only [Sym2.map_mk, DecLabeledGraph.labelEmbed] at this; exact this exact ⟨h1v ▸ y.isLt, h2v ▸ x.isLt⟩ rw [dif_pos hcond] -- Apply Helper 1. @@ -8317,7 +8317,7 @@ private theorem product_trace_identity_of_eval_tupleEquiv_invariant rw [if_neg] intro hmem rw [SimpleGraph.mem_edgeFinset] at hmem - simp only [Sym2.map_pair_eq] at hmem + simp only [Sym2.map_mk] at hmem exact p.2.irrefl hmem · intro φ rw [DecLabeledGraph.eval_mul _ _ B hB W φ, hDeval] @@ -8994,11 +8994,11 @@ private theorem tr_k_singleton_descends {T K : ℕ} apply Finset.prod_nbij' (Sym2.map e) (Sym2.map e.symm) · intro a ha refine Sym2.ind (fun u v h => ?_) a ha - rw [SimpleGraph.mem_edgeFinset, Sym2.map_pair_eq, SimpleGraph.mem_edgeSet] + rw [SimpleGraph.mem_edgeFinset, Sym2.map_mk, SimpleGraph.mem_edgeSet] rw [SimpleGraph.mem_edgeFinset, SimpleGraph.mem_edgeSet] at h; exact h · intro a ha refine Sym2.ind (fun u v h => ?_) a ha - rw [SimpleGraph.mem_edgeFinset, Sym2.map_pair_eq, SimpleGraph.mem_edgeSet] + rw [SimpleGraph.mem_edgeFinset, Sym2.map_mk, SimpleGraph.mem_edgeSet] simp only [SimpleGraph.mem_edgeFinset, SimpleGraph.mem_edgeSet, G] at h; exact h · intro a _ simp only [Sym2.map_map, Equiv.symm_comp_self]; exact congr_fun Sym2.map_id a @@ -9006,7 +9006,7 @@ private theorem tr_k_singleton_descends {T K : ℕ} simp only [Sym2.map_map, Equiv.self_comp_symm]; exact congr_fun Sym2.map_id a · intro a ha refine Sym2.ind (fun u v _ => ?_) a ha - simp only [Sym2.map_pair_eq] + simp only [Sym2.map_mk] have hout_F : Quot.out s(u, v) = (u, v) ∨ Quot.out s(u, v) = (v, u) := Sym2.rel_iff'.mp (Sym2.Rel.is_equivalence.eqvGen_iff.mp (Quot.eqvGen_exact (Quot.out_eq s(u, v)))) @@ -9229,7 +9229,7 @@ private theorem exists_decGraph_for_connCol {T K : ℕ} s(x, x) ∈ p.2.edgeFinset then (1 : ℕ) else 0) = 0 rw [if_neg] intro h - rw [Sym2.map_pair_eq, SimpleGraph.mem_edgeFinset, SimpleGraph.mem_edgeSet] at h + rw [Sym2.map_mk, SimpleGraph.mem_edgeFinset, SimpleGraph.mem_edgeSet] at h exact p.2.irrefl h /-- **Weighted inner product of two connection-matrix columns descends @@ -10498,12 +10498,12 @@ private theorem coeffRestrict_equiv {T : ℕ} -- hi: F-edges map to G-edges · intro a ha refine Sym2.ind (fun u v h => ?_) a ha - rw [SimpleGraph.mem_edgeFinset, Sym2.map_pair_eq, SimpleGraph.mem_edgeSet] + rw [SimpleGraph.mem_edgeFinset, Sym2.map_mk, SimpleGraph.mem_edgeSet] rw [SimpleGraph.mem_edgeFinset, SimpleGraph.mem_edgeSet] at h; exact h -- hj: G-edges map to F-edges · intro a ha refine Sym2.ind (fun u v h => ?_) a ha - rw [SimpleGraph.mem_edgeFinset, Sym2.map_pair_eq, SimpleGraph.mem_edgeSet] + rw [SimpleGraph.mem_edgeFinset, Sym2.map_mk, SimpleGraph.mem_edgeSet] simp only [SimpleGraph.mem_edgeFinset, SimpleGraph.mem_edgeSet, G] at h; exact h -- left_inv: Sym2.map e.symm ∘ Sym2.map e = id · intro a _ @@ -10516,7 +10516,7 @@ private theorem coeffRestrict_equiv {T : ℕ} -- orderings. Use B-symmetry (hB) to handle both cases. · intro a ha refine Sym2.ind (fun u v _ => ?_) a ha - simp only [Sym2.map_pair_eq] + simp only [Sym2.map_mk] -- Need: B(τ_F(Quot.out s(u,v)).1)(τ_F(Quot.out s(u,v)).2) = -- B(τ_G(Quot.out s(eu,ev)).1)(τ_G(Quot.out s(eu,ev)).2) -- where τ_F, τ_G evaluate the same function on .val. @@ -10810,7 +10810,7 @@ private theorem labeledEvalK_separates {T : ℕ} -- -- This is the remaining algebra-intensive step (~150-200 lines). The infrastructure -- (labeledEvalK_glue, functional_span_zero, B_quot_out_eq) is all in place. - push_neg at hcase + push Not at hcase sorry /-! ### Surjective-base extension uniqueness -/ @@ -11380,8 +11380,8 @@ private lemma tri1Graph_edgeFree : ¬ tri1Graph.Adj 0 1 := by private lemma star0Graph_edgeFinset : star0Graph.edgeFinset = {s((0 : Fin 3), 2)} := by ext e simp only [SimpleGraph.mem_edgeFinset, star0Graph, SimpleGraph.edgeSet_fromEdgeSet, - Finset.mem_singleton, Set.mem_diff, Set.mem_singleton_iff, - Sym2.mem_diagSet_iff_isDiag] + Finset.mem_singleton, Set.mem_sdiff, Set.mem_singleton_iff, + Sym2.mem_diagSet] refine ⟨fun ⟨he, _⟩ => he, fun he => ⟨he, ?_⟩⟩ rw [he, Sym2.mk_isDiag_iff] decide @@ -11454,8 +11454,8 @@ private theorem labeledEval2_star0Graph {T : ℕ} private lemma star1Graph_edgeFinset : star1Graph.edgeFinset = {s((1 : Fin 3), 2)} := by ext e simp only [SimpleGraph.mem_edgeFinset, star1Graph, SimpleGraph.edgeSet_fromEdgeSet, - Finset.mem_singleton, Set.mem_diff, Set.mem_singleton_iff, - Sym2.mem_diagSet_iff_isDiag] + Finset.mem_singleton, Set.mem_sdiff, Set.mem_singleton_iff, + Sym2.mem_diagSet] refine ⟨fun ⟨he, _⟩ => he, fun he => ⟨he, ?_⟩⟩ rw [he, Sym2.mk_isDiag_iff] decide @@ -11487,8 +11487,8 @@ private lemma pathGraph01_edgeFinset : pathGraph01.edgeFinset = {s((0 : Fin 3), 2), s((1 : Fin 3), 2)} := by ext e simp only [SimpleGraph.mem_edgeFinset, pathGraph01, SimpleGraph.edgeSet_fromEdgeSet, - Finset.mem_insert, Finset.mem_singleton, Set.mem_diff, Set.mem_insert_iff, - Set.mem_singleton_iff, Sym2.mem_diagSet_iff_isDiag] + Finset.mem_insert, Finset.mem_singleton, Set.mem_sdiff, Set.mem_insert_iff, + Set.mem_singleton_iff, Sym2.mem_diagSet] refine ⟨fun ⟨he, _⟩ => he, fun he => ⟨he, ?_⟩⟩ rcases he with he | he <;> rw [he, Sym2.mk_isDiag_iff] <;> decide @@ -11542,8 +11542,8 @@ private lemma tri0Graph_edgeFinset : {s((0 : Fin 4), 2), s((0 : Fin 4), 3), s((2 : Fin 4), 3)} := by ext e simp only [SimpleGraph.mem_edgeFinset, tri0Graph, SimpleGraph.edgeSet_fromEdgeSet, - Finset.mem_insert, Finset.mem_singleton, Set.mem_diff, Set.mem_insert_iff, - Set.mem_singleton_iff, Sym2.mem_diagSet_iff_isDiag] + Finset.mem_insert, Finset.mem_singleton, Set.mem_sdiff, Set.mem_insert_iff, + Set.mem_singleton_iff, Sym2.mem_diagSet] refine ⟨fun ⟨he, _⟩ => he, fun he => ⟨he, ?_⟩⟩ rcases he with he | he | he <;> rw [he, Sym2.mk_isDiag_iff] <;> decide @@ -11623,8 +11623,8 @@ private lemma tri1Graph_edgeFinset : {s((1 : Fin 4), 2), s((1 : Fin 4), 3), s((2 : Fin 4), 3)} := by ext e simp only [SimpleGraph.mem_edgeFinset, tri1Graph, SimpleGraph.edgeSet_fromEdgeSet, - Finset.mem_insert, Finset.mem_singleton, Set.mem_diff, Set.mem_insert_iff, - Set.mem_singleton_iff, Sym2.mem_diagSet_iff_isDiag] + Finset.mem_insert, Finset.mem_singleton, Set.mem_sdiff, Set.mem_insert_iff, + Set.mem_singleton_iff, Sym2.mem_diagSet] refine ⟨fun ⟨he, _⟩ => he, fun he => ⟨he, ?_⟩⟩ rcases he with he | he | he <;> rw [he, Sym2.mk_isDiag_iff] <;> decide @@ -11722,7 +11722,7 @@ private theorem pairOrbit_separated_by_edgeFreeEval {T : ℕ} have hne : pairProfile B W p ≠ pairProfile B W q := fun heq => h (pairOrbitRel_of_pairProfile_eq hB hW htwin heq) have ⟨k, hk⟩ : ∃ k : Fin 5, pairProfile B W p k ≠ pairProfile B W q k := by - by_contra hall; push_neg at hall; exact hne (funext hall) + by_contra hall; push Not at hall; exact hne (funext hall) -- Return the corresponding motif graph from edgeFreeEvalSet refine ⟨fun i j => pairProfile B W (i, j) k, pairProfile_component_mem_edgeFreeEvalSet B W hB k, ?_⟩ @@ -11834,7 +11834,7 @@ private theorem edgeFreeIndist_class_indicator_mem {T : ℕ} rw [← Quotient.out_eq q, heq, hp₀_def] exact Quotient.out_eq o simp only [edgeFreeIndist] at hne - push_neg at hne + push Not at hne exact hne let gSep : ∀ q : Quotient (edgeFreeIndistSetoid B W), q ≠ o → Fin T → Fin T → ℝ := fun q hqo => Classical.choose (sep q hqo) diff --git a/Graphon/Regularity.lean b/Graphon/Regularity.lean index 7ef5542..72ca90e 100644 --- a/Graphon/Regularity.lean +++ b/Graphon/Regularity.lean @@ -799,7 +799,7 @@ theorem exists_variance_cut (f : α → ℝ) (S : Set α) (hS : MeasurableSet S) -- If both were zero, then |f - m| < η a.e. on S, so variance < η² μ(S) < ε² μ(S) have h_exists : μ A_high ≠ 0 ∨ μ A_low ≠ 0 := by by_contra h_both_zero - push_neg at h_both_zero + push Not at h_both_zero obtain ⟨h_high_zero, h_low_zero⟩ := h_both_zero -- If μ(A_high) = 0 and μ(A_low) = 0, then |f - m| < η a.e. on S -- So ∫_S (f - m)² ≤ η² μ(S) = (ε/2)² μ(S) < ε² μ(S), contradicting h_var @@ -847,13 +847,13 @@ theorem exists_variance_cut (f : α → ℝ) (S : Set α) (hS : MeasurableSet S) -- Since x ∈ S, we get f x < m + η have h1 : f x < m + η := by by_contra h - push_neg at h + push Not at h exact hx_not_high ⟨hxS, h⟩ -- A_low = S ∩ {f ≤ m - η}, so x ∉ A_low means: x ∉ S or f x > m - η -- Since x ∈ S, we get f x > m - η have h2 : f x > m - η := by by_contra h - push_neg at h + push Not at h exact hx_not_low ⟨hxS, h⟩ -- Now |f x - m| < η have h_abs : |f x - m| < η := abs_sub_lt_iff.mpr ⟨by linarith, by linarith⟩ @@ -909,7 +909,7 @@ theorem exists_variance_cut (f : α → ℝ) (S : Set α) (hS : MeasurableSet S) filter_upwards [h_compl_ae] with x hx hxS -- x ∈ (S \ A_high)ᶜ and x ∈ S ⟹ x ∈ A_high -- (S \ A_high)ᶜ = Sᶜ ∪ A_high - rw [Set.compl_diff] at hx + rw [Set.compl_sdiff] at hx cases hx with | inl hx_in_high => exact h_lb_on_high x hx_in_high | inr hx_not_S => exact absurd hxS hx_not_S @@ -973,7 +973,7 @@ theorem exists_variance_cut (f : α → ℝ) (S : Set α) (hS : MeasurableSet S) rw [compl_mem_ae_iff] exact h_compl_zero filter_upwards [h_compl_ae] with x hx hxS - rw [Set.compl_diff] at hx + rw [Set.compl_sdiff] at hx cases hx with | inl hx_in_low => exact h_ub_on_low x hx_in_low | inr hx_not_S => exact absurd hxS hx_not_S @@ -1375,7 +1375,7 @@ lemma energy_rect_split (W : Graphon α μ) (S T S₁ : Set α) have hμS₂_pos : 0 < (μ S₂).toReal := ENNReal.toReal_pos hμS₂ hμS₂_top -- Step 1: Show μ(S) = μ(S₁) + μ(S₂) have h_disj : Disjoint S₁ S₂ := Set.disjoint_sdiff_right - have h_union : S = S₁ ∪ S₂ := (Set.union_diff_cancel hS₁_sub).symm + have h_union : S = S₁ ∪ S₂ := (Set.union_sdiff_cancel hS₁_sub).symm have hμ_add : (μ S).toReal = (μ S₁).toReal + (μ S₂).toReal := by rw [h_union, measure_union h_disj hS₂_meas] exact ENNReal.toReal_add hμS₁_top hμS₂_top @@ -1398,7 +1398,7 @@ lemma energy_rect_split (W : Graphon α μ) (S T S₁ : Set α) have h_int_S₁ : IntegrableOn (fun p => W.toAEEqFun p) (S₁ ×ˢ T) (μ.prod μ) := h_int.mono (Set.prod_mono hS₁_sub Subset.rfl) le_rfl have h_int_S₂ : IntegrableOn (fun p => W.toAEEqFun p) (S₂ ×ˢ T) (μ.prod μ) := h_int.mono - (Set.prod_mono Set.diff_subset Subset.rfl) le_rfl + (Set.prod_mono Set.sdiff_subset Subset.rfl) le_rfl have h_rect_union : S ×ˢ T = (S₁ ×ˢ T) ∪ (S₂ ×ˢ T) := by rw [← Set.union_prod, h_union] have h_rect_disj : Disjoint (S₁ ×ˢ T) (S₂ ×ˢ T) := by @@ -1545,7 +1545,7 @@ theorem energy_splitPart_ge (W : Graphon α μ) (P : MeasurablePartition α μ) have h2 := (Finset.mem_erase.mp h).2 -- S₂ ∈ P.parts have := P.pairwiseDisjoint h2 hS_mem h1 exact hμS₂ (measure_mono_null (Set.disjoint_iff_inter_eq_empty.mp this ▸ - Set.subset_inter Subset.rfl Set.diff_subset) (measure_empty)) + Set.subset_inter Subset.rfl Set.sdiff_subset) (measure_empty)) -- Disjointness for Finset.sum_union have hE_disj_S : Disjoint E ({S₁, S₂} : Finset (Set α)) := by rw [Finset.disjoint_left] @@ -1704,7 +1704,7 @@ private theorem energy_increment_of_between_variance exact tAverage_integral_eq_rectAverage W A₂ V hA₂_meas hV_meas hμA₂ hμV -- Weighted average identity have h_A_union : A = A₁ ∪ A₂ := by - rw [hA₂_def, Set.union_diff_cancel hA₁_sub] + rw [hA₂_def, Set.union_sdiff_cancel hA₁_sub] have h_disj : Disjoint A₁ A₂ := by rw [hA₂_def]; exact Set.disjoint_sdiff_right have hμ_add : (μ A).toReal = (μ A₁).toReal + (μ A₂).toReal := by @@ -1713,7 +1713,7 @@ private theorem energy_increment_of_between_variance have h_int_add : ∫ x in A, f x ∂μ = ∫ x in A₁, f x ∂μ + ∫ x in A₂, f x ∂μ := by rw [h_A_union] exact setIntegral_union h_disj hA₂_meas (hf_int.mono hA₁_sub le_rfl) - (hf_int.mono (Set.diff_subset) le_rfl) + (hf_int.mono (Set.sdiff_subset) le_rfl) have hc_weighted : c = ((μ A₁).toReal * c₁ + (μ A₂).toReal * c₂) / (μ A).toReal := by rw [hc_mean, h_int_add, hc₁_def, hc₂_def] field_simp [ne_of_gt hμA₁_real_pos, ne_of_gt hμA₂_real_pos, ne_of_gt hμA_real_pos] @@ -1828,7 +1828,7 @@ private theorem energy_increment_of_within_variance exact energy_increment_of_between_variance W P ε' hε'_pos S hS_mem T hT_mem hS_meas hT_meas hμS hμT h_var · -- B_T = 0: the between-T variance vanishes - push_neg at hB_T_pos + push Not at hB_T_pos have hB_T_nonneg : B_T ≥ 0 := setIntegral_nonneg_of_ae_restrict (ae_of_all _ (fun _ => sq_nonneg _)) have hB_T_zero : B_T = 0 := le_antisymm hB_T_pos hB_T_nonneg @@ -1852,7 +1852,7 @@ private theorem energy_increment_of_within_variance · -- Case 3: B_T = 0 AND B_S = 0 (hard case) -- W_T = c a.e. on S and W_S = c' a.e. on T, but within-T variance is large. -- Need to find a global cut that simultaneously splits S and T. - push_neg at hB_S_pos + push Not at hB_S_pos have hB_S_nonneg : B_S ≥ 0 := setIntegral_nonneg_of_ae_restrict (ae_of_all _ (fun _ => sq_nonneg _)) have hB_S_zero : B_S = 0 := le_antisymm hB_S_pos hB_S_nonneg @@ -1931,7 +1931,7 @@ private theorem energy_increment_of_within_variance have h_good_cut : ∃ B : Set α, MeasurableSet B ∧ B ⊆ S ∧ μ B ≠ 0 ∧ μ (S \ B) ≠ 0 ∧ rectAverage W B B ≠ c := by by_contra h_neg - push_neg at h_neg + push Not at h_neg exfalso -- Shorthand for the product measure restricted to S × S set ν := (μ.restrict S).prod (μ.restrict S) with hν_def @@ -2070,7 +2070,7 @@ private theorem energy_increment_of_within_variance have h2 := h_diag_zero C hC_meas hC_sub hμC hμSC -- ∫_{C×S} = ∫_{C×C} + ∫_{C×(S\C)} have h_union : C ×ˢ S = (C ×ˢ C) ∪ (C ×ˢ (S \ C)) := by - rw [← Set.prod_union, Set.union_diff_cancel hC_sub] + rw [← Set.prod_union, Set.union_sdiff_cancel hC_sub] have h_disj_prod : Disjoint (C ×ˢ C) (C ×ˢ (S \ C)) := by rw [Set.disjoint_iff]; intro ⟨x, y⟩ ⟨⟨_, hy1⟩, ⟨_, hy2⟩⟩ exact hy2.2 hy1 @@ -2086,7 +2086,7 @@ private theorem energy_increment_of_within_variance exact ⟨hD_sub hxD, fun hxC => Set.disjoint_iff.mp hCD_disj ⟨hxC, hxD⟩⟩ -- ∫_{C×(S\C)} = ∫_{C×D} + ∫_{C×((S\C)\D)} have h_union2 : C ×ˢ (S \ C) = (C ×ˢ D) ∪ (C ×ˢ ((S \ C) \ D)) := by - rw [← Set.prod_union, Set.union_diff_cancel hD_sub_SC] + rw [← Set.prod_union, Set.union_sdiff_cancel hD_sub_SC] -- But we can't separate ∫_{C×D} from ∫_{C×((S\C)\D)} without more info. -- Instead, use symmetry of W: -- ∫_{D×C} (W(x,y)-c) = ∫_{C×D} (W(y,x)-c) (by swap) @@ -2116,7 +2116,7 @@ private theorem energy_increment_of_within_variance setIntegral_measure_zero _ (by rw [Measure.prod_prod]; simp [hμSCUD]) have h_eq_SC_D : (S \ C) \ D = S \ (C ∪ D) := by - ext x; simp [Set.mem_diff, Set.mem_union]; tauto + ext x; simp [Set.mem_sdiff, Set.mem_union]; tauto rw [h_eq_SC_D] at h_union2 have h_disj3 : Disjoint (C ×ˢ D) (C ×ˢ (S \ (C ∪ D))) := by rw [Set.disjoint_iff]; intro ⟨_, y⟩ ⟨hy1, hy2⟩ @@ -2206,7 +2206,7 @@ private theorem energy_increment_of_within_variance -- A×B = AB×AB ∪ AB×BdA ∪ AdB×AB ∪ AdB×BdA have h_decomp : A ×ˢ B = (AB ×ˢ AB) ∪ (AB ×ˢ BdA) ∪ (AdB ×ˢ AB) ∪ (AdB ×ˢ BdA) := by ext ⟨x, y⟩ - simp only [Set.mem_prod, Set.mem_union, Set.mem_inter_iff, Set.mem_diff] + simp only [Set.mem_prod, Set.mem_union, Set.mem_inter_iff, Set.mem_sdiff] constructor · intro ⟨hxA, hyB⟩ by_cases hxB : x ∈ B @@ -2237,7 +2237,7 @@ private theorem energy_increment_of_within_variance · by_cases hμSC : μ (S \ C) = 0 · -- C =ᵐ S: ∫_{C×C} = ∫_{S×S} (up to null set) have hC_ae_S : C =ᵐ[μ] S := - ae_eq_set.mpr ⟨by simp [Set.diff_eq_empty.mpr hC_sub], hμSC⟩ + ae_eq_set.mpr ⟨by simp [Set.sdiff_eq_empty.mpr hC_sub], hμSC⟩ have h_ae : C ×ˢ C =ᵐ[μ.prod μ] S ×ˢ S := Measure.set_prod_ae_eq hC_ae_S hC_ae_S rw [setIntegral_congr_set h_ae] @@ -2424,7 +2424,7 @@ private theorem energy_increment_of_within_variance ∫ p in B ×ˢ S₂, W.toAEEqFun p ∂(μ.prod μ) from by unfold rectAverage; simp [hμB, hμSB, dif_neg]] have h_union : B ×ˢ S = (B ×ˢ B) ∪ (B ×ˢ S₂) := by - rw [← Set.prod_union, Set.union_diff_cancel hB_sub] + rw [← Set.prod_union, Set.union_sdiff_cancel hB_sub] have h_disj : Disjoint (B ×ˢ B) (B ×ˢ S₂) := by rw [Set.disjoint_iff]; intro ⟨_, y⟩ ⟨⟨_, hy1⟩, ⟨_, hy2⟩⟩; exact hy2.2 hy1 rw [h_union, setIntegral_union h_disj (hB_meas.prod hS₂_meas) @@ -2434,7 +2434,7 @@ private theorem energy_increment_of_within_variance ne_of_gt hμS_real_pos] rw [h_rectAvg_BS, ← h_eq] at h_split have hμ_add : (μ S).toReal = (μ B).toReal + (μ S₂).toReal := by - rw [show S = B ∪ S₂ from (Set.union_diff_cancel hB_sub).symm] + rw [show S = B ∪ S₂ from (Set.union_sdiff_cancel hB_sub).symm] rw [measure_union Set.disjoint_sdiff_right hS₂_meas] exact ENNReal.toReal_add hμB_top hμS₂_top -- h_split: μS * c = μB * rectAvg(B,B) + μS₂ * rectAvg(B,B) @@ -2494,7 +2494,7 @@ private theorem energy_increment_of_within_variance intro h have h1 := (Finset.mem_erase.mp h).1; have h2 := (Finset.mem_erase.mp h).2 exact hμSB (measure_mono_null (Set.disjoint_iff_inter_eq_empty.mp - (P.pairwiseDisjoint h2 hS_mem h1) ▸ Set.subset_inter Subset.rfl Set.diff_subset) + (P.pairwiseDisjoint h2 hS_mem h1) ▸ Set.subset_inter Subset.rfl Set.sdiff_subset) (measure_empty)) have hE_disj_S : Disjoint E ({B, S₂} : Finset (Set α)) := by rw [Finset.disjoint_left]; intro x hx hx2 @@ -2617,7 +2617,7 @@ private theorem energy_increment_of_within_variance ∫ x in S, (tAverage W B x - c) ^ 2 ∂μ > 0 := by -- By contradiction: assume for all nontrivial B ⊆ T, the between-B variance is ≤ 0. by_contra h_neg - push_neg at h_neg + push Not at h_neg -- For all nontrivial B ⊆ T, tAvg_B = c a.e. on S (variance = 0) have h_tAvg_eq : ∀ B : Set α, MeasurableSet B → B ⊆ T → μ B ≠ 0 → μ (T \ B) ≠ 0 → tAverage W B =ᵐ[μ.restrict S] fun _ => c := by @@ -2679,7 +2679,7 @@ private theorem energy_increment_of_within_variance · by_cases hμTB' : μ (T \ B') = 0 · -- B' =ᵐ T: use setIntegral_congr_set have h_ae_eq : B' =ᵐ[μ] T := - ae_eq_set.mpr ⟨by simp [Set.diff_eq_empty.mpr hB'_sub], hμTB'⟩ + ae_eq_set.mpr ⟨by simp [Set.sdiff_eq_empty.mpr hB'_sub], hμTB'⟩ filter_upwards [h_T_inner_zero] with x hx simp only [Pi.zero_apply] at hx ⊢ rwa [setIntegral_congr_set h_ae_eq] @@ -2848,8 +2848,8 @@ private theorem energy_increment_of_within_variance energy W Q > energy W P by rcases h_one_pos with hIA_pos | hITA_pos · exact h_main A hA_meas hA_sub hμA hμTA hIA_pos - · exact h_main (T \ A) (hT_meas.diff hA_meas) Set.diff_subset hμTA - (by rwa [Set.diff_diff_cancel_left hA_sub]) hITA_pos + · exact h_main (T \ A) (hT_meas.diff hA_meas) Set.sdiff_subset hμTA + (by rwa [Set.sdiff_sdiff_cancel_left hA_sub]) hITA_pos -- Prove the main construction intro B hB_meas hB_sub hμB hμTB hI_B_pos -- Step A: Build Q₁ = splitPart P T B @@ -2950,7 +2950,7 @@ private theorem energy_increment_of_within_variance tAverage_integral_eq_rectAverage W S₂ B hS₂_meas_local hB_meas hμS₂ hμB -- Weighted average have h_S_union : S = S₁ ∪ S₂ := by - rw [hS₂_def_local, Set.union_diff_cancel hS₁_sub] + rw [hS₂_def_local, Set.union_sdiff_cancel hS₁_sub] have h_disj : Disjoint S₁ S₂ := by rw [hS₂_def_local]; exact Set.disjoint_sdiff_right have hμ_add : (μ S).toReal = (μ S₁).toReal + (μ S₂).toReal := by @@ -2960,7 +2960,7 @@ private theorem energy_increment_of_within_variance ∫ x in S₁, f_B x ∂μ + ∫ x in S₂, f_B x ∂μ := by rw [h_S_union] exact setIntegral_union h_disj hS₂_meas_local - (hf_B_int.mono hS₁_sub le_rfl) (hf_B_int.mono Set.diff_subset le_rfl) + (hf_B_int.mono hS₁_sub le_rfl) (hf_B_int.mono Set.sdiff_subset le_rfl) have hc_B_weighted : rectAverage W S B = ((μ S₁).toReal * c₁ + (μ S₂).toReal * c₂) / (μ S).toReal := by rw [hc_B_mean, h_int_add, hc₁_def, hc₂_def] @@ -3110,7 +3110,7 @@ theorem energy_increment (W : Graphon α μ) (P : MeasurablePartition α μ) have hB_T_nonneg : B_T ≥ 0 := setIntegral_nonneg_of_ae_restrict (ae_of_all _ (fun _ => sq_nonneg _)) have hμTB_T_nonneg : (μ T).toReal * B_T ≥ 0 := mul_nonneg (le_of_lt hμT_real_pos) hB_T_nonneg by_contra h_neg - push_neg at h_neg + push Not at h_neg obtain ⟨h1, h2⟩ := h_neg have h_upper : A_T + (μ T).toReal * B_T < ε ^ 2 / 2 * (μ S).toReal * (μ T).toReal + ε ^ 2 / 2 * (μ S).toReal * (μ T).toReal := by @@ -3212,7 +3212,7 @@ theorem energy_increment (W : Graphon α μ) (P : MeasurablePartition α μ) -- Sub-case 2b-ii: B_T < ε²/2 * μ(S) AND B_S < ε²/2 * μ(T) -- Both within-variances A_T, A_S are large, both between-variances B_T, B_S are small. -- Apply the FK global cut lemma (uses splitAllParts). - · push_neg at h_split_T_sym h_check_B_T + · push Not at h_split_T_sym h_check_B_T have h_A_T_large : A_T ≥ ε ^ 2 / 2 * (μ S).toReal * (μ T).toReal := h_split_T have h_within_unfolded : ∫ x in S, (∫ y in T, (W.toAEEqFun (x, y) - tAverage W T x) ^ 2 ∂μ) ∂μ ≥ @@ -3243,7 +3243,7 @@ lemma exists_bad_rect_of_defect_gt (W : Graphon α μ) (P : MeasurablePartition -- Contrapositive: if every non-null rectangle has defect < ε² μ(S) μ(T), -- then total defect = Σ defect(S,T) < ε² Σ μ(S)μ(T) = ε² · (Σ μ(S))² ≤ ε² by_contra h_neg - push_neg at h_neg + push Not at h_neg -- h_neg: ∀ S ∈ P.parts, ∀ T ∈ P.parts, μ S ≠ 0 → μ T ≠ 0 → -- ∫_{S×T} (W - c)² < ε² μ(S) μ(T) have h_bound : defect W P ≤ ε ^ 2 := by @@ -3687,7 +3687,7 @@ private lemma setIntegral_stepify_eq_on_refines_cell -- S × T =ᵐ cellUnion have h_ae_eq : S ×ˢ T =ᵐ[μ.prod μ] cellUnion := by rw [ae_eq_set] - refine ⟨?_, by rw [Set.diff_eq_empty.mpr h_sub]; exact measure_empty⟩ + refine ⟨?_, by rw [Set.sdiff_eq_empty.mpr h_sub]; exact measure_empty⟩ have h0 : (μ.prod μ).restrict (S ×ˢ T) cellUnionᶜ = 0 := ae_iff.mp h_cover rwa [Measure.restrict_apply h_cellUnion_meas.compl, Set.inter_comm] at h0 -- Integrability of both integrands on each cell @@ -3823,7 +3823,7 @@ private lemma energy_doubleSplit_ge_sq MeasurableSet.biUnion (P.parts ×ˢ P.parts).countable_toSet h_cells_meas have h_ae_eq : S₀ ×ˢ T₀ =ᵐ[μ.prod μ] cellUnion := by rw [ae_eq_set] - refine ⟨?_, by rw [Set.diff_eq_empty.mpr h_sub]; exact measure_empty⟩ + refine ⟨?_, by rw [Set.sdiff_eq_empty.mpr h_sub]; exact measure_empty⟩ -- μ((S₀×T₀) \ cellUnion) = 0 -- h_cover gives (μ.prod μ).restrict (S₀×T₀) {p | p ∉ cellUnion} = 0 have h0 : (μ.prod μ).restrict (S₀ ×ˢ T₀) cellUnionᶜ = 0 := @@ -4116,7 +4116,7 @@ private lemma energy_doubleSplit_ge_sq ⟨⟨hpS, (Set.mem_prod.mp hp).1⟩, ⟨hpT, (Set.mem_prod.mp hp).2⟩⟩⟩ have h_ae_eq' : S₀ ×ˢ T₀ =ᵐ[μ.prod μ] cellU := by rw [ae_eq_set] - refine ⟨?_, by rw [Set.diff_eq_empty.mpr h_sub']; exact measure_empty⟩ + refine ⟨?_, by rw [Set.sdiff_eq_empty.mpr h_sub']; exact measure_empty⟩ have h0 : (μ.prod μ).restrict (S₀ ×ˢ T₀) cellUᶜ = 0 := ae_iff.mp h_cover' rwa [Measure.restrict_apply h_cellU_meas.compl, Set.inter_comm] at h0 -- integrability on each cell @@ -4218,7 +4218,7 @@ private lemma energy_doubleSplit_ge_sq Finset.mem_filter.mpr ⟨hV_mem, hV_sub⟩⟩, Set.mem_prod.mpr ⟨hpU, hpV⟩⟩ have h_qae : (S ∩ S₀) ×ˢ (T ∩ T₀) =ᵐ[μ.prod μ] qUnion := by rw [ae_eq_set] - refine ⟨?_, by rw [Set.diff_eq_empty.mpr h_qsub]; exact measure_empty⟩ + refine ⟨?_, by rw [Set.sdiff_eq_empty.mpr h_qsub]; exact measure_empty⟩ have h0 : (μ.prod μ).restrict ((S ∩ S₀) ×ˢ (T ∩ T₀)) qUnionᶜ = 0 := ae_iff.mp h_qcover rwa [Measure.restrict_apply h_qmeas.compl, Set.inter_comm] at h0 -- Integrability on each Q-cell @@ -4427,7 +4427,7 @@ private lemma exists_rectIntegralDiff_gt_of_cutNormDiff_gt ∃ (S : Set α), MeasurableSet S ∧ ∃ (T : Set α), MeasurableSet T ∧ c < |rectIntegralDiff U W S T| := by by_contra h_neg - push_neg at h_neg + push Not at h_neg have hc : 0 ≤ c := le_trans (abs_nonneg _) (h_neg ∅ MeasurableSet.empty ∅ MeasurableSet.empty) have h_le : cutNormDiff U W ≤ c := by unfold cutNormDiff @@ -4611,7 +4611,7 @@ theorem regularity (W : Graphon α μ) (ε : ℝ) (hε : ε > 0) : _ ≤ 4 ^ N := Nat.pow_le_pow_right (by norm_num) (Nat.sub_le N _) , Or.inl h_done⟩ · -- Cut norm > ε: apply energy_increment_quantitative - push_neg at h_done + push Not at h_done obtain ⟨Q, _hQ_ref, hQ_card_le, hQ_energy⟩ := energy_increment_quantitative W P ε hε h_done -- Q.parts.card ≤ 4 * P.parts.card ≤ 4 * 4^(N-(n+1)) = 4^(N-n) @@ -4708,8 +4708,8 @@ theorem exists_measurable_subset_of_measure [StandardBorelSpace α] [NoAtoms μ] rw [step_succ]; simp [hcond] rw [show R (n + 1) = R n \ C n from hR_eq, show acc (n + 1) = acc n + μ (R n ∩ C n) from hacc_eq] - refine ⟨hR_meas.diff (hC_meas n), diff_subset.trans hR_sub, hcond, ?_⟩ - have h_split := measure_inter_add_diff (μ := μ) (R n) (hC_meas n) + refine ⟨hR_meas.diff (hC_meas n), sdiff_subset.trans hR_sub, hcond, ?_⟩ + have h_split := measure_inter_add_sdiff (μ := μ) (R n) (hC_meas n) rw [tsub_le_iff_right, add_comm (μ _)] calc r ≤ μ (R n) + acc n := tsub_le_iff_right.mp hgap _ = (μ (R n ∩ C n) + μ (R n \ C n)) + acc n := by rw [h_split] @@ -4723,7 +4723,7 @@ theorem exists_measurable_subset_of_measure [StandardBorelSpace α] [NoAtoms μ] rw [step_succ]; simp [hcond] rw [show R (n + 1) = R n ∩ C n from hR_eq, show acc (n + 1) = acc n from hacc_eq] - push_neg at hcond + push Not at hcond refine ⟨hR_meas.inter (hC_meas n), inter_subset_left.trans hR_sub, hacc_le, ?_⟩ exact tsub_le_iff_right.mpr (le_of_lt (by rwa [add_comm] at hcond)) -- R is antitone: at each step, we take either a diff or intersection (both subsets) @@ -4732,7 +4732,7 @@ theorem exists_measurable_subset_of_measure [StandardBorelSpace α] [NoAtoms μ] show (step (n + 1)).2 ⊆ (step n).2 rw [step_succ] split - · exact diff_subset + · exact sdiff_subset · exact inter_subset_left have hR_anti : Antitone R := antitone_nat_of_succ_le hR_step_le -- Points in ⋂ R agree on all C n, hence are equal by separation @@ -4886,7 +4886,7 @@ private theorem exists_equal_measure_partition [StandardBorelSpace α] [NoAtoms simp only [Nat.cast_zero, zero_mul] at hR_mu rw [ae_iff] apply measure_mono_null (fun x (hx : ¬ _) => ?_) (by rw [hR_mu]) - exact (_root_.not_imp.mp hx).1 + exact (Classical.not_imp.mp hx).1 | succ m ih => intro R hR_meas hR_sub hR_mu -- Show q ≤ μ R (since μ R = (m+1) * q ≥ q) @@ -4899,11 +4899,11 @@ private theorem exists_equal_measure_partition [StandardBorelSpace α] [NoAtoms -- Set R' = R \ T set R' := R \ T with hR'_def have hR'_meas : MeasurableSet R' := hR_meas.diff hT_meas - have hR'_sub : R' ⊆ S := diff_subset.trans hR_sub + have hR'_sub : R' ⊆ S := sdiff_subset.trans hR_sub -- Compute μ R' = m * q have hT_mu_ne_top : μ T ≠ ⊤ := by rw [hT_mu]; exact hq_ne_top have hR'_mu : μ R' = ↑m * q := by - have h_diff := measure_diff hT_sub hT_meas.nullMeasurableSet hT_mu_ne_top + have h_diff := measure_sdiff hT_sub hT_meas.nullMeasurableSet hT_mu_ne_top rw [h_diff, hR_mu, hT_mu] rw [show (↑(m + 1) : ℝ≥0∞) = ↑m + 1 from by push_cast; ring] rw [add_mul, one_mul] @@ -4934,7 +4934,7 @@ private theorem exists_equal_measure_partition [StandardBorelSpace α] [NoAtoms rw [Finset.mem_cons] at hU rcases hU with rfl | hU · exact hT_sub - · exact (hsub_old U hU).trans diff_subset + · exact (hsub_old U hU).trans sdiff_subset · -- pairwise disjoint intro U₁ hU₁ U₂ hU₂ hne₁₂ rw [Finset.mem_coe, Finset.mem_cons] at hU₁ hU₂ @@ -4958,8 +4958,8 @@ private theorem exists_equal_measure_partition [StandardBorelSpace α] [NoAtoms apply measure_mono_null (fun x (hx : ¬ _) => ?_) hcov_old' -- hx : ¬(x ∈ R → ∃ T ∈ cons ..., x ∈ T) -- goal : ¬(x ∈ R' → ∃ T ∈ pieces_old, x ∈ T) - have ⟨hxR, hx_none⟩ := _root_.not_imp.mp hx - apply _root_.not_imp.mpr + have ⟨hxR, hx_none⟩ := Classical.not_imp.mp hx + apply Classical.not_imp.mpr exact ⟨⟨hxR, fun hxT => hx_none ⟨T, Finset.mem_cons_self T pieces_old, hxT⟩⟩, fun ⟨U, hU, hxU⟩ => hx_none ⟨U, Finset.mem_cons_of_mem hU, hxU⟩⟩ @@ -5111,7 +5111,7 @@ private theorem exists_equitable_refinement_construction [StandardBorelSpace α] have hT_meas_nonneg : 0 ≤ (μ T).toReal := ENNReal.toReal_nonneg have hcard_ge_m : m ≤ (P.parts.biUnion f).card := by obtain ⟨S₀, hS₀, hμS₀⟩ : ∃ S₀ ∈ P.parts, μ S₀ ≠ 0 := by - by_contra h_all; push_neg at h_all + by_contra h_all; push Not at h_all have h_not_in : ∀ S ∈ P.parts, ∀ᵐ x ∂μ, x ∉ S := by intro S' hS' rw [ae_iff, show ({x : α | ¬x ∉ S'} : Set α) = S' from Set.ext (fun _ => not_not)] diff --git a/Graphon/SimpleRank.lean b/Graphon/SimpleRank.lean index a6d3cfc..db610f2 100644 --- a/Graphon/SimpleRank.lean +++ b/Graphon/SimpleRank.lean @@ -155,7 +155,7 @@ theorem exists_rpe_separator {T : ℕ} {B : Fin T → Fin T → ℝ} {W : Fin T ∃ (n : ℕ) (F : SimpleGraph (Fin (n + 1))) (inst : DecidableRel F.Adj), @rootedProfile T n B W i F inst ≠ @rootedProfile T n B W j F inst := by unfold rootedProfileEquiv at h - push_neg at h + push Not at h exact h /-- Build an `RpeSeparator` from non-equivalence via `Classical.choose`. -/ @@ -485,7 +485,7 @@ private theorem rootAttach_edgeFinset (n : ℕ) (G : SimpleGraph (Fin (n + 1))) · left; exact Sym2.eq_iff.mpr (Or.inr ⟨Fin.ext ha, Fin.ext hb⟩) · right refine ⟨s(⟨a.val - 1, by omega⟩, ⟨b.val - 1, by omega⟩), hadj, ?_⟩ - simp only [Sym2.map_pair_eq, Fin.coe_succEmb] + simp only [Sym2.map_mk, Fin.coe_succEmb] exact Sym2.eq_iff.mpr (Or.inl ⟨Fin.ext (by simp; omega), Fin.ext (by simp; omega)⟩) · intro he @@ -510,7 +510,7 @@ private theorem rootAttach_bridge_not_mem_shifted (n : ℕ) obtain ⟨e, _, he⟩ := hmem induction e using Sym2.ind with | _ a b => - simp only [Function.Embedding.sym2Map_apply, Sym2.map_pair_eq, Fin.coe_succEmb] at he + simp only [Function.Embedding.sym2Map_apply, Sym2.map_mk, Fin.coe_succEmb] at he rw [Sym2.eq_iff] at he rcases he with ⟨h1, _⟩ | ⟨_, h1⟩ <;> exact absurd (congr_arg Fin.val h1) (by simp [Fin.val_succ]) diff --git a/Graphon/Spectral.lean b/Graphon/Spectral.lean index 67c0b44..43071b8 100644 --- a/Graphon/Spectral.lean +++ b/Graphon/Spectral.lean @@ -573,7 +573,7 @@ theorem moment_nondegenerate_iff_multiOrbitSpan_eq_top {T : ℕ} (K : ℕ) (B : exact horth n M · intro htop μ hμ by_contra hcon - push_neg at hcon + push Not at hcon apply hμ have horth := (allMomentsZero_iff_orthogonal K B W μ).mp hcon funext q₀ @@ -592,7 +592,7 @@ theorem sep_of_multiOrbitSpan_eq_top {T : ℕ} (K : ℕ) (B : Fin T → Fin T multiEvalOnOrbit K n M B W q₁ ≠ multiEvalOnOrbit K n M B W q₂ := by classical by_contra hcon - push_neg at hcon + push Not at hcon have hle : multiOrbitSpan K B W ≤ LinearMap.ker ((LinearMap.proj q₁ : (OrbitClass T K B W → ℝ) →ₗ[ℝ] ℝ) - LinearMap.proj q₂) := by rw [multiOrbitSpan, Submodule.span_le] @@ -817,7 +817,7 @@ theorem exists_positive_gram_test {T : ℕ} (K : ℕ) (B : Fin T → Fin T → ∃ (n : ℕ) (M : MultiLabeledGraph K n), orbitInner K B W h (multiEvalOnOrbit K n M B W) ≠ 0 := by by_contra hcon - push_neg at hcon + push Not at hcon exact hne (fls_orthogonal_zero K B W hB hW htwin h hcon) /-- **Full span from a separation hypothesis** (hard direction of the equivalence): @@ -1150,7 +1150,7 @@ theorem exists_refineSetoidIter_fixed (s : Setoid (Fin T)) : have hstab : ∃ n ≤ T, classCount (refineSetoidIter B W s (n + 1)) = classCount (refineSetoidIter B W s n) := by by_contra hc - push_neg at hc + push Not at hc have hstrict : ∀ n ≤ T, classCount (refineSetoidIter B W s n) < classCount (refineSetoidIter B W s (n + 1)) := fun n hn => lt_of_le_of_ne (hmono n) fun he => hc n hn he.symm