wiedijk_100_theorems.konigsberg
⟷
Archive.Wiedijk100Theorems.Konigsberg
The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(last sync)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -106,8 +106,8 @@ theorem not_isEulerian {u v : Verts} (p : graph.Walk u v) (h : p.IsEulerian) : F
Set.mem_singleton_iff]
cases w <;> simp
have h := h.card_odd_degree
- simp_rw [this] at h
- norm_num at h
+ simp_rw [this] at h
+ norm_num at h
#align konigsberg.not_is_eulerian Konigsberg.not_isEulerian
end Konigsberg
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,8 +3,8 @@ Copyright (c) 2022 Kyle Miller. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kyle Miller
-/
-import Mathbin.Combinatorics.SimpleGraph.Trails
-import Mathbin.Tactic.DeriveFintype
+import Combinatorics.SimpleGraph.Trails
+import Tactic.DeriveFintype
#align_import wiedijk_100_theorems.konigsberg from "leanprover-community/mathlib"@"08b081ea92d80e3a41f899eea36ef6d56e0f1db0"
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,15 +2,12 @@
Copyright (c) 2022 Kyle Miller. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kyle Miller
-
-! This file was ported from Lean 3 source module wiedijk_100_theorems.konigsberg
-! leanprover-community/mathlib commit 08b081ea92d80e3a41f899eea36ef6d56e0f1db0
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Combinatorics.SimpleGraph.Trails
import Mathbin.Tactic.DeriveFintype
+#align_import wiedijk_100_theorems.konigsberg from "leanprover-community/mathlib"@"08b081ea92d80e3a41f899eea36ef6d56e0f1db0"
+
/-!
# The Königsberg bridges problem
mathlib commit https://github.com/leanprover-community/mathlib/commit/bf2428c9486c407ca38b5b3fb10b87dad0bc99fa
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kyle Miller
! This file was ported from Lean 3 source module wiedijk_100_theorems.konigsberg
-! leanprover-community/mathlib commit 5563b1b49e86e135e8c7b556da5ad2f5ff881cad
+! leanprover-community/mathlib commit 08b081ea92d80e3a41f899eea36ef6d56e0f1db0
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -14,6 +14,9 @@ import Mathbin.Tactic.DeriveFintype
/-!
# The Königsberg bridges problem
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
We show that a graph that represents the islands and mainlands of Königsberg and seven bridges
between them has no Eulerian trail.
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/893964fc28cefbcffc7cb784ed00a2895b4e65cf
@@ -3,8 +3,8 @@ Copyright (c) 2022 Kyle Miller. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kyle Miller
-! This file was ported from Lean 3 source module «100-theorems-list».«54_konigsberg»
-! leanprover-community/mathlib commit af8760ccc4c03bbdff0b140e6f7bd047b0eecbeb
+! This file was ported from Lean 3 source module wiedijk_100_theorems.konigsberg
+! leanprover-community/mathlib commit 5563b1b49e86e135e8c7b556da5ad2f5ff881cad
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
This is the supremum of
along with some minor fixes from failures on nightly-testing as Mathlib master
is merged into it.
Note that some PRs for changes that are already compatible with the current toolchain and will be necessary have already been split out: #8380.
I am hopeful that in future we will be able to progressively merge adaptation PRs into a bump/v4.X.0
branch, so we never end up with a "big merge" like this. However one of these adaptation PRs (#8056) predates my new scheme for combined CI, and it wasn't possible to keep that PR viable in the meantime.
In particular this includes adjustments for the Lean PRs
We can get rid of all the
local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue [lean4#2220](https://github.com/leanprover/lean4/pull/2220)
macros across Mathlib (and in any projects that want to write natural number powers of reals).
Changes the default behaviour of simp
to (config := {decide := false})
. This makes simp
(and consequentially norm_num
) less powerful, but also more consistent, and less likely to blow up in long failures. This requires a variety of changes: changing some previously by simp
or norm_num
to decide
or rfl
, or adding (config := {decide := true})
.
This changed the behaviour of simp
so that simp [f]
will only unfold "fully applied" occurrences of f
. The old behaviour can be recovered with simp (config := { unfoldPartialApp := true })
. We may in future add a syntax for this, e.g. simp [!f]
; please provide feedback! In the meantime, we have made the following changes:
(config := { unfoldPartialApp := true })
in some places, to recover the old behaviour@[eqns]
to manually adjust the equation lemmas for a particular definition, recovering the old behaviour just for that definition. See #8371, where we do this for Function.comp
and Function.flip
.This change in Lean may require further changes down the line (e.g. adding the !f
syntax, and/or upstreaming the special treatment for Function.comp
and Function.flip
, and/or removing this special treatment). Please keep an open and skeptical mind about these changes!
Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Mauricio Collares <mauricio@collares.org>
@@ -75,7 +75,7 @@ lemma degree_eq_degree (v : Verts) : graph.degree v = degree v := by cases v <;>
#align konigsberg.degree_eq_degree Konigsberg.degree_eq_degree
lemma not_even_degree_iff (w : Verts) : ¬Even (degree w) ↔ w = V1 ∨ w = V2 ∨ w = V3 ∨ w = V4 := by
- cases w <;> simp
+ cases w <;> decide
lemma setOf_odd_degree_eq :
{v | Odd (graph.degree v)} = {Verts.V1, Verts.V2, Verts.V3, Verts.V4} := by
@@ -2,15 +2,12 @@
Copyright (c) 2022 Kyle Miller. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kyle Miller
-
-! This file was ported from Lean 3 source module wiedijk_100_theorems.konigsberg
-! leanprover-community/mathlib commit 5563b1b49e86e135e8c7b556da5ad2f5ff881cad
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Combinatorics.SimpleGraph.Trails
import Mathlib.Tactic.DeriveFintype
+#align_import wiedijk_100_theorems.konigsberg from "leanprover-community/mathlib"@"5563b1b49e86e135e8c7b556da5ad2f5ff881cad"
+
/-!
# The Königsberg bridges problem
@@ -23,36 +23,27 @@ namespace Konigsberg
/-- The vertices for the Königsberg graph; four vertices for the bodies of land and seven
vertices for the bridges. -/
--- @[nolint has_inhabited_instance] -- Porting note: removed
inductive Verts : Type
- | V1
- | V2
- | V3
- | V4-- The islands and mainlands
-
- | B1
- | B2
- | B3
- | B4
- | B5
- | B6
- | B7
+ -- The islands and mainlands
+ | V1 | V2 | V3 | V4
+ -- The bridges
+ | B1 | B2 | B3 | B4 | B5 | B6 | B7
deriving DecidableEq, Fintype
#align konigsberg.verts Konigsberg.Verts
--- The bridges
open Verts
/-- Each of the connections between the islands/mainlands and the bridges.
These are ordered pairs, but the data becomes symmetric in `Konigsberg.adj`. -/
def edges : List (Verts × Verts) :=
- [(V1, B1), (V1, B2), (V1, B3), (V1, B4), (V1, B5), (B1, V2), (B2, V2), (B3, V4), (B4, V3),
- (B5, V3), (V2, B6), (B6, V4), (V3, B7), (B7, V4)]
+ [(V1, B1), (V1, B2), (V1, B3), (V1, B4), (V1, B5),
+ (B1, V2), (B2, V2), (B3, V4), (B4, V3), (B5, V3),
+ (V2, B6), (B6, V4),
+ (V3, B7), (B7, V4)]
#align konigsberg.edges Konigsberg.edges
/-- The adjacency relation for the Königsberg graph. -/
-def adj (v w : Verts) : Bool :=
- (v, w) ∈ edges || (w, v) ∈ edges
+def adj (v w : Verts) : Bool := (v, w) ∈ edges || (w, v) ∈ edges
#align konigsberg.adj Konigsberg.adj
/-- The Königsberg graph structure. While the Königsberg bridge problem
@@ -73,42 +64,33 @@ def graph : SimpleGraph Verts where
decide
#align konigsberg.graph Konigsberg.graph
-instance : DecidableRel graph.Adj := fun a b => decidable_of_bool (adj a b) Iff.rfl
+instance : DecidableRel graph.Adj := fun a b => inferInstanceAs <| Decidable (adj a b)
/-- To speed up the proof, this is a cache of all the degrees of each vertex,
proved in `Konigsberg.degree_eq_degree`. -/
-@[simp]
def degree : Verts → ℕ
- | V1 => 5
- | V2 => 3
- | V3 => 3
- | V4 => 3
- | B1 => 2
- | B2 => 2
- | B3 => 2
- | B4 => 2
- | B5 => 2
- | B6 => 2
- | B7 => 2
+ | V1 => 5 | V2 => 3 | V3 => 3 | V4 => 3
+ | B1 => 2 | B2 => 2 | B3 => 2 | B4 => 2 | B5 => 2 | B6 => 2 | B7 => 2
#align konigsberg.degree Konigsberg.degree
@[simp]
-theorem degree_eq_degree (v : Verts) : graph.degree v = degree v := by cases v <;> rfl
+lemma degree_eq_degree (v : Verts) : graph.degree v = degree v := by cases v <;> rfl
#align konigsberg.degree_eq_degree Konigsberg.degree_eq_degree
+lemma not_even_degree_iff (w : Verts) : ¬Even (degree w) ↔ w = V1 ∨ w = V2 ∨ w = V3 ∨ w = V4 := by
+ cases w <;> simp
+
+lemma setOf_odd_degree_eq :
+ {v | Odd (graph.degree v)} = {Verts.V1, Verts.V2, Verts.V3, Verts.V4} := by
+ ext w
+ simp [not_even_degree_iff]
+
/-- The Königsberg graph is not Eulerian. -/
theorem not_isEulerian {u v : Verts} (p : graph.Walk u v) (h : p.IsEulerian) : False := by
- have : {v | Odd (graph.degree v)} = {Verts.V1, Verts.V2, Verts.V3, Verts.V4} := by
- ext w
- simp only [degree_eq_degree, Nat.odd_iff_not_even, Set.mem_setOf_eq, Set.mem_insert_iff,
- Set.mem_singleton_iff]
- cases w <;> simp
have h := h.card_odd_degree
- -- Porting note: the next four lines were `simp_rw [this] at h`, which times out
- rw [← Set.toFinset_card] at h
- conv_lhs at h => arg 1; simp only [this]
- conv_rhs at h => arg 1; simp only [this]
- rw [Set.toFinset_card] at h
+ have h' := setOf_odd_degree_eq
+ apply_fun Fintype.card at h'
+ rw [h'] at h
norm_num at h
#align konigsberg.not_is_eulerian Konigsberg.not_isEulerian
The unported dependencies are