Add lean source and binary files (part 43)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- lean/OAI/Combinatorics/Crossing/StraightChainIntersections.lean +49 -0
- lean/OAI/Combinatorics/Crossing/StraightChainTransversality.lean +30 -0
- lean/OAI/Combinatorics/Crossing/SubdivisionPointEndpoints.lean +34 -0
- lean/OAI/Combinatorics/Crossing/SubdivisionSegments.lean +91 -0
- lean/OAI/Combinatorics/Crossing/SublevelExtrema.lean +67 -0
- lean/OAI/Combinatorics/Crossing/SubspaceIntersection.lean +60 -0
- lean/OAI/Combinatorics/Crossing/SubspaceProjection.lean +50 -0
- lean/OAI/Combinatorics/Crossing/SurgeryCrossingContainment.lean +63 -0
- lean/OAI/Combinatorics/Crossing/SurgeryCutWalks.lean +47 -0
- lean/OAI/Combinatorics/Crossing/SurgeryFiniteDrawing.lean +42 -0
- lean/OAI/Combinatorics/Crossing/SurgeryNoTriples.lean +100 -0
- lean/OAI/Combinatorics/Crossing/SurgeryPathWitnesses.lean +41 -0
- lean/OAI/Combinatorics/Crossing/SurgeryRouteIntersections.lean +78 -0
- lean/OAI/Combinatorics/Crossing/SurgeryStrictPointCount.lean +56 -0
- lean/OAI/Combinatorics/Crossing/TangentTrackIdentity.lean +66 -0
- lean/OAI/Combinatorics/Crossing/TrackChordSeparation.lean +52 -0
- lean/OAI/Combinatorics/Crossing/TrackEndpointConnections.lean +43 -0
- lean/OAI/Combinatorics/Crossing/TransversalityStability.lean +50 -0
- lean/OAI/Combinatorics/Crossing/TransversePolygonIntersection.lean +56 -0
- lean/OAI/Combinatorics/Crossing/TriangleEntryExit.lean +71 -0
- lean/OAI/Combinatorics/Crossing/TriangleFactorization.lean +75 -0
- lean/OAI/Combinatorics/Crossing/TriangleOrientations.lean +90 -0
- lean/OAI/Combinatorics/Crossing/TriangleSideEvent.lean +54 -0
- lean/OAI/Combinatorics/Crossing/TriangleTransversality.lean +73 -0
- lean/OAI/Combinatorics/Crossing/TruncatedChainDirections.lean +59 -0
- lean/OAI/Combinatorics/Crossing/TruncatedChainPath.lean +56 -0
- lean/OAI/Combinatorics/Crossing/TruncatedChainVertices.lean +72 -0
- lean/OAI/Combinatorics/Crossing/TruncatedCrossingCorners.lean +41 -0
- lean/OAI/Combinatorics/Crossing/TruncatedCrossingRetention.lean +41 -0
- lean/OAI/Combinatorics/Crossing/TruncatedDrawingDisks.lean +71 -0
- lean/OAI/Combinatorics/Crossing/TruncatedDrawingInteriors.lean +72 -0
- lean/OAI/Combinatorics/Crossing/TruncatedRadialDots.lean +73 -0
- lean/OAI/Combinatorics/Crossing/TruncatedRadialEnds.lean +69 -0
- lean/OAI/Combinatorics/Crossing/TruncatedSegmentTransversality.lean +76 -0
- lean/OAI/Combinatorics/Crossing/TruncatedSignedIntersections.lean +80 -0
- lean/OAI/Combinatorics/Crossing/TruncatedSpokeCoordinates.lean +88 -0
- lean/OAI/Combinatorics/Crossing/TruncatedSpokeDirections.lean +75 -0
- lean/OAI/Combinatorics/Crossing/TruncatedTraceDecomposition.lean +67 -0
- lean/OAI/Combinatorics/Crossing/TruncatedTrackAvoidance.lean +52 -0
- lean/OAI/Combinatorics/Crossing/TruncatedTrackStability.lean +41 -0
- lean/OAI/Combinatorics/Crossing/TwoTriangleBasis.lean +65 -0
- lean/OAI/Combinatorics/Crossing/TwoTriangleIndices.lean +101 -0
- lean/OAI/Combinatorics/Crossing/TwoTriangleUnisolvence.lean +133 -0
- lean/OAI/Combinatorics/Crossing/UniformCrossTypeGeometry.lean +73 -0
- lean/OAI/Combinatorics/Crossing/UniformSpokeRadii.lean +49 -0
- lean/OAI/Combinatorics/Crossing/UniformTrackPerturbation.lean +74 -0
- lean/OAI/Combinatorics/Crossing/UniqueWalkPassage.lean +41 -0
- lean/OAI/Combinatorics/Crossing/VertexChordIntersections.lean +45 -0
- lean/OAI/Combinatorics/Crossing/VertexDiskSpokes.lean +66 -0
- lean/OAI/Combinatorics/Crossing/VertexDisksCrossingFree.lean +40 -0
lean/OAI/Combinatorics/Crossing/StraightChainIntersections.lean
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.DrawnEdgeChains
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
namespace Zarankiewicz.PolygonalChain
|
| 7 |
+
open scoped BigOperators
|
| 8 |
+
variable {O T : Set Plane} {a b c d : Plane}
|
| 9 |
+
|
| 10 |
+
theorem intersection_single_right (P : PolygonalChain O a b) (hc : c ∈ T) (hcd : segment ℝ c d ⊆ T) :
|
| 11 |
+
polygonIntersection P.vertices (single T c d hc hcd).vertices P.pieces 1=
|
| 12 |
+
∑ i ∈ Finset.range P.pieces, segmentCrossingSign (P.vertices i) (P.vertices (i+1)) c d := by
|
| 13 |
+
simp [polygonIntersection,single]
|
| 14 |
+
|
| 15 |
+
theorem intersection_single_left (P : PolygonalChain O a b) (hc : c ∈ T) (hcd : segment ℝ c d ⊆ T) :
|
| 16 |
+
polygonIntersection (single T c d hc hcd).vertices P.vertices 1 P.pieces=
|
| 17 |
+
∑ i ∈ Finset.range P.pieces, segmentCrossingSign c d (P.vertices i) (P.vertices (i+1)) := by
|
| 18 |
+
simp [polygonIntersection,single]
|
| 19 |
+
|
| 20 |
+
theorem transverse_single_right (P : PolygonalChain O a b) (hc : c ∈ T) (hcd : segment ℝ c d ⊆ T)
|
| 21 |
+
(h : ∀ i : Fin P.pieces, SegmentPairTransverse (P.vertices i.val) (P.vertices (i.val+1)) c d) :
|
| 22 |
+
P.Transverse (single T c d hc hcd) := by
|
| 23 |
+
intro i j
|
| 24 |
+
have hj : j.val=0 := by have hj : j.val<1 := j.isLt; omega
|
| 25 |
+
simpa [single,hj] using h i
|
| 26 |
+
|
| 27 |
+
theorem transverse_single_left (P : PolygonalChain O a b) (hc : c ∈ T) (hcd : segment ℝ c d ⊆ T)
|
| 28 |
+
(h : ∀ i : Fin P.pieces, SegmentPairTransverse c d (P.vertices i.val) (P.vertices (i.val+1))) :
|
| 29 |
+
(single T c d hc hcd).Transverse P :=
|
| 30 |
+
P.transverse_swap _ (P.transverse_single_right hc hcd (fun i => segmentPairTransverse_swap _ _ _ _ (h i)))
|
| 31 |
+
|
| 32 |
+
theorem intersection_single_right_zero (P : PolygonalChain O a b) (hc : c ∈ T) (hcd : segment ℝ c d ⊆ T)
|
| 33 |
+
(h : ∀ i : Fin P.pieces, ¬ ClosedSegmentsMeet (P.vertices i.val) (P.vertices (i.val+1)) c d) :
|
| 34 |
+
polygonIntersection P.vertices (single T c d hc hcd).vertices P.pieces 1=0 := by
|
| 35 |
+
rw [P.intersection_single_right]
|
| 36 |
+
apply Finset.sum_eq_zero
|
| 37 |
+
intro i hi
|
| 38 |
+
exact segmentCrossingSign_eq_zero_of_not_meet _ _ _ _ (h ⟨i,Finset.mem_range.mp hi⟩)
|
| 39 |
+
|
| 40 |
+
theorem intersection_single_single (ha : a ∈ O) (hab : segment ℝ a b ⊆ O)
|
| 41 |
+
(hc : c ∈ T) (hcd : segment ℝ c d ⊆ T) :
|
| 42 |
+
polygonIntersection (single O a b ha hab).vertices (single T c d hc hcd).vertices 1 1=
|
| 43 |
+
segmentCrossingSign a b c d := by simp [polygonIntersection,single]
|
| 44 |
+
|
| 45 |
+
end Zarankiewicz.PolygonalChain
|
| 46 |
+
|
| 47 |
+
end
|
| 48 |
+
|
| 49 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/StraightChainTransversality.lean
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.StraightChainIntersections
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
namespace Zarankiewicz.PolygonalChain
|
| 7 |
+
open scoped BigOperators
|
| 8 |
+
variable {O T : Set Plane} {a b c d : Plane}
|
| 9 |
+
|
| 10 |
+
theorem transverse_single_single (ha : a ∈ O) (hab : segment ℝ a b ⊆ O)
|
| 11 |
+
(hc : c ∈ T) (hcd : segment ℝ c d ⊆ T) (h : SegmentPairTransverse a b c d) :
|
| 12 |
+
(single O a b ha hab).Transverse (single T c d hc hcd) := by
|
| 13 |
+
intro i j
|
| 14 |
+
have hi : i.val=0 := by have hh : i.val<1 := i.isLt; omega
|
| 15 |
+
have hj : j.val=0 := by have hh : j.val<1 := j.isLt; omega
|
| 16 |
+
simpa [single,hi,hj] using h
|
| 17 |
+
|
| 18 |
+
theorem intersection_single_left_zero (P : PolygonalChain O a b) (hc : c ∈ T) (hcd : segment ℝ c d ⊆ T)
|
| 19 |
+
(h : ∀ i : Fin P.pieces, ¬ ClosedSegmentsMeet c d (P.vertices i.val) (P.vertices (i.val+1))) :
|
| 20 |
+
polygonIntersection (single T c d hc hcd).vertices P.vertices 1 P.pieces=0 := by
|
| 21 |
+
rw [P.intersection_single_left]
|
| 22 |
+
apply Finset.sum_eq_zero
|
| 23 |
+
intro i hi
|
| 24 |
+
exact segmentCrossingSign_eq_zero_of_not_meet _ _ _ _ (h ⟨i,Finset.mem_range.mp hi⟩)
|
| 25 |
+
|
| 26 |
+
end Zarankiewicz.PolygonalChain
|
| 27 |
+
|
| 28 |
+
end
|
| 29 |
+
|
| 30 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/SubdivisionPointEndpoints.lean
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.DrawingSubdivisionGraph
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
namespace Zarankiewicz
|
| 7 |
+
variable {m n : ℕ} {D : AdmissibleDrawing m n}
|
| 8 |
+
|
| 9 |
+
theorem subdivision_point_endpoint (P : ∀ e, PolygonalParametrization (D.edge e))
|
| 10 |
+
(x : Plane) (hpoint : ∀ e t, D.edge e t=x → t ∈ Set.range (P e).knot)
|
| 11 |
+
(e : BipartiteEdge m n) (i : Fin (P e).pieces) (hx : x ∈ (P e).pieceTrace i) :
|
| 12 |
+
x=D.edge e ((P e).knot i.castSucc) ∨ x=D.edge e ((P e).knot i.succ) := by
|
| 13 |
+
obtain ⟨t,ht⟩ := (P e).pieceTrace_subset_range i hx
|
| 14 |
+
obtain ⟨j,hj⟩ := hpoint e t ht
|
| 15 |
+
have he : D.edge e ((P e).knot j)=x := (congrArg (D.edge e) hj).trans ht
|
| 16 |
+
have hh := (P e).pieceTrace_knot_endpoint (D.edge_injective e) i j (he.symm ▸ hx)
|
| 17 |
+
simpa only [he] using hh
|
| 18 |
+
|
| 19 |
+
theorem drawingSubdivisionGraph_point_endpoint (P : ∀ e, PolygonalParametrization (D.edge e))
|
| 20 |
+
(x : Plane) (hpoint : ∀ e t, D.edge e t=x → t ∈ Set.range (P e).knot)
|
| 21 |
+
(a b : Plane) (hab : (drawingSubdivisionGraph P).Adj a b) (hx : x ∈ segment ℝ a b) :
|
| 22 |
+
x=a ∨ x=b := by
|
| 23 |
+
obtain ⟨hab,p,hp⟩ := hab
|
| 24 |
+
rcases hp with ⟨rfl,rfl⟩ | ⟨rfl,rfl⟩
|
| 25 |
+
· exact subdivision_point_endpoint P x hpoint p.1 p.2 hx
|
| 26 |
+
· have hx' : x ∈ segment ℝ (drawingPieceStart P p) (drawingPieceEnd P p) := by
|
| 27 |
+
simpa only [segment_symm] using hx
|
| 28 |
+
exact (subdivision_point_endpoint P x hpoint p.1 p.2 hx').symm
|
| 29 |
+
|
| 30 |
+
end Zarankiewicz
|
| 31 |
+
|
| 32 |
+
end
|
| 33 |
+
|
| 34 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/SubdivisionSegments.lean
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.AffineSubdivisionRefinement
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
namespace Zarankiewicz.PolygonalParametrization
|
| 7 |
+
variable {a b : Plane} {γ : Path a b}
|
| 8 |
+
|
| 9 |
+
def pieceTrace (P : PolygonalParametrization γ) (i : Fin P.pieces) : Set Plane :=
|
| 10 |
+
segment ℝ (γ (P.knot i.castSucc)) (γ (P.knot i.succ))
|
| 11 |
+
|
| 12 |
+
theorem pieceTrace_parameter (P : PolygonalParametrization γ) (i : Fin P.pieces)
|
| 13 |
+
(x : Plane) (hx : x ∈ P.pieceTrace i) :
|
| 14 |
+
∃ t : unitInterval, γ (intervalSegment (P.knot i.castSucc) (P.knot i.succ) t)=x := by
|
| 15 |
+
rw [pieceTrace,← Path.range_segment] at hx
|
| 16 |
+
obtain ⟨t,ht⟩ := hx
|
| 17 |
+
refine ⟨t,(P.affine i t).trans ?_⟩
|
| 18 |
+
simpa only [Path.segment_apply,AffineMap.lineMap_apply_module,segmentPoint] using ht
|
| 19 |
+
|
| 20 |
+
theorem pieceTrace_subset_range (P : PolygonalParametrization γ) (i : Fin P.pieces) :
|
| 21 |
+
P.pieceTrace i ⊆ Set.range γ := by
|
| 22 |
+
intro x hx
|
| 23 |
+
obtain ⟨t,ht⟩ := P.pieceTrace_parameter i x hx
|
| 24 |
+
exact ⟨intervalSegment (P.knot i.castSucc) (P.knot i.succ) t,ht⟩
|
| 25 |
+
|
| 26 |
+
theorem pieceTrace_knot_endpoint (P : PolygonalParametrization γ) (hγ : Function.Injective γ)
|
| 27 |
+
(i : Fin P.pieces) (j : Fin (P.pieces+1))
|
| 28 |
+
(hx : γ (P.knot j) ∈ P.pieceTrace i) :
|
| 29 |
+
γ (P.knot j)=γ (P.knot i.castSucc) ∨ γ (P.knot j)=γ (P.knot i.succ) := by
|
| 30 |
+
obtain ⟨t,ht⟩ := P.pieceTrace_parameter i _ hx
|
| 31 |
+
by_cases ht0 : t=0
|
| 32 |
+
· subst t
|
| 33 |
+
simpa [intervalSegment] using Or.inl ht.symm
|
| 34 |
+
by_cases ht1 : t=1
|
| 35 |
+
· subst t
|
| 36 |
+
simpa [intervalSegment] using Or.inr ht.symm
|
| 37 |
+
have hmid := intervalSegment_strict_between (P.knot i.castSucc) (P.knot i.succ) t
|
| 38 |
+
(P.increasing (by change i.val < i.val+1; omega))
|
| 39 |
+
⟨lt_of_le_of_ne (show 0 ≤ t from t.property.1) (Ne.symm ht0),
|
| 40 |
+
lt_of_le_of_ne (show t ≤ 1 from t.property.2) ht1⟩
|
| 41 |
+
have he := hγ ht
|
| 42 |
+
rw [he] at hmid
|
| 43 |
+
exact False.elim (strictMono_no_between_successors P.knot P.increasing i j hmid)
|
| 44 |
+
|
| 45 |
+
theorem pieceTrace_other_piece_endpoint (P : PolygonalParametrization γ) (hγ : Function.Injective γ)
|
| 46 |
+
(i j : Fin P.pieces) (hij : i ≠ j) (x : Plane)
|
| 47 |
+
(hx : x ∈ P.pieceTrace i) (hy : x ∈ P.pieceTrace j) :
|
| 48 |
+
x=γ (P.knot i.castSucc) ∨ x=γ (P.knot i.succ) := by
|
| 49 |
+
obtain ⟨s,hs⟩ := P.pieceTrace_parameter i x hx
|
| 50 |
+
obtain ⟨t,ht⟩ := P.pieceTrace_parameter j x hy
|
| 51 |
+
by_cases hs0 : s=0
|
| 52 |
+
· subst s
|
| 53 |
+
exact Or.inl (by simpa [intervalSegment] using hs.symm)
|
| 54 |
+
by_cases hs1 : s=1
|
| 55 |
+
· subst s
|
| 56 |
+
exact Or.inr (by simpa [intervalSegment] using hs.symm)
|
| 57 |
+
have hsbetween := intervalSegment_strict_between (P.knot i.castSucc) (P.knot i.succ) s
|
| 58 |
+
(P.increasing (by change i.val < i.val+1; omega))
|
| 59 |
+
⟨lt_of_le_of_ne (show 0 ≤ s from s.property.1) (Ne.symm hs0),
|
| 60 |
+
lt_of_le_of_ne (show s ≤ 1 from s.property.2) hs1⟩
|
| 61 |
+
have htbetween := intervalSegment_between (P.knot j.castSucc) (P.knot j.succ) t
|
| 62 |
+
(P.increasing.monotone (by change j.val ≤ j.val+1; omega))
|
| 63 |
+
have he := hγ (hs.trans ht.symm)
|
| 64 |
+
rw [he] at hsbetween
|
| 65 |
+
rcases lt_or_gt_of_ne hij with hij | hji
|
| 66 |
+
· have hgap := P.increasing.monotone (show i.succ ≤ j.castSucc by change i.val+1 ≤ j.val; exact hij)
|
| 67 |
+
exact False.elim (hsbetween.2.not_ge (hgap.trans htbetween.1))
|
| 68 |
+
· have hgap := P.increasing.monotone (show j.succ ≤ i.castSucc by change j.val+1 ≤ i.val; exact hji)
|
| 69 |
+
exact False.elim (hsbetween.1.not_ge (htbetween.2.trans hgap))
|
| 70 |
+
|
| 71 |
+
end Zarankiewicz.PolygonalParametrization
|
| 72 |
+
namespace Zarankiewicz
|
| 73 |
+
variable {m n : ℕ}
|
| 74 |
+
|
| 75 |
+
theorem subdivision_mark_endpoint (D : AdmissibleDrawing m n)
|
| 76 |
+
(P : ∀ e, PolygonalParametrization (D.edge e))
|
| 77 |
+
(hmark : ∀ e t, D.edge e t ∈ drawingMarks D.toFiniteIntersectionDrawing → t ∈ Set.range (P e).knot)
|
| 78 |
+
(e : BipartiteEdge m n) (i : Fin (P e).pieces) (x : Plane)
|
| 79 |
+
(hx : x ∈ (P e).pieceTrace i) (hm : x ∈ drawingMarks D.toFiniteIntersectionDrawing) :
|
| 80 |
+
x=D.edge e ((P e).knot i.castSucc) ∨ x=D.edge e ((P e).knot i.succ) := by
|
| 81 |
+
obtain ⟨t,ht⟩ := (P e).pieceTrace_subset_range i hx
|
| 82 |
+
obtain ⟨j,hj⟩ := hmark e t (ht.symm ▸ hm)
|
| 83 |
+
have he : D.edge e ((P e).knot j)=x := (congrArg (D.edge e) hj).trans ht
|
| 84 |
+
have hh := (P e).pieceTrace_knot_endpoint (D.edge_injective e) i j (he.symm ▸ hx)
|
| 85 |
+
simpa only [he] using hh
|
| 86 |
+
|
| 87 |
+
end Zarankiewicz
|
| 88 |
+
|
| 89 |
+
end
|
| 90 |
+
|
| 91 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/SublevelExtrema.lean
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.FirstLastVisits
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
namespace Zarankiewicz
|
| 7 |
+
|
| 8 |
+
theorem sublevel_passage_extrema (f : ℝ → ℝ) (hf : Continuous f) (r τ : ℝ)
|
| 9 |
+
(hτ : τ ∈ Set.Icc (0 : ℝ) 1) (hvisit : f τ < r) :
|
| 10 |
+
∃ a b : ℝ, a ∈ Set.Icc (0 : ℝ) 1 ∧ b ∈ Set.Icc (0 : ℝ) 1 ∧
|
| 11 |
+
a ≤ τ ∧ τ ≤ b ∧ f a ≤ r ∧ f b ≤ r ∧
|
| 12 |
+
(∀ t ∈ Set.Icc (0 : ℝ) 1, f t ≤ r → a ≤ t ∧ t ≤ b) ∧
|
| 13 |
+
(0 < a → f a=r) ∧ (b < 1 → f b=r) ∧
|
| 14 |
+
(0 < τ → a < τ) ∧ (τ < 1 → τ < b) := by
|
| 15 |
+
let S : Set ℝ := Set.Icc 0 1 ∩ {t | f t ≤ r}
|
| 16 |
+
have hS : IsCompact S := isCompact_Icc.inter_right (isClosed_le hf continuous_const)
|
| 17 |
+
have hτS : τ ∈ S := ⟨hτ,hvisit.le⟩
|
| 18 |
+
obtain ⟨a,ha⟩ := hS.exists_isLeast ⟨τ,hτS⟩
|
| 19 |
+
obtain ⟨b,hb⟩ := hS.exists_isGreatest ⟨τ,hτS⟩
|
| 20 |
+
have hfa (ha0 : 0 < a) : f a=r := by
|
| 21 |
+
have hf0 : r < f 0 := by
|
| 22 |
+
apply lt_of_not_ge
|
| 23 |
+
intro h
|
| 24 |
+
have hh := ha.2 (show (0 : ℝ) ∈ S from ⟨⟨le_rfl,zero_le_one⟩,h⟩)
|
| 25 |
+
linarith
|
| 26 |
+
apply le_antisymm ha.1.2
|
| 27 |
+
by_contra hn
|
| 28 |
+
have hlt : f a < r := lt_of_not_ge hn
|
| 29 |
+
obtain ⟨t,ht,he⟩ := intermediate_value_Icc' ha.1.1.1 hf.continuousOn ⟨hlt.le,hf0.le⟩
|
| 30 |
+
have hmem : t ∈ S := ⟨⟨ht.1,ht.2.trans ha.1.1.2⟩,he.le⟩
|
| 31 |
+
have hta : t=a := le_antisymm ht.2 (ha.2 hmem)
|
| 32 |
+
rw [hta] at he
|
| 33 |
+
exact hlt.ne he
|
| 34 |
+
have hfb (hb1 : b < 1) : f b=r := by
|
| 35 |
+
have hf1 : r < f 1 := by
|
| 36 |
+
apply lt_of_not_ge
|
| 37 |
+
intro h
|
| 38 |
+
have hh := hb.2 (show (1 : ℝ) ∈ S from ⟨⟨zero_le_one,le_rfl⟩,h⟩)
|
| 39 |
+
linarith
|
| 40 |
+
apply le_antisymm hb.1.2
|
| 41 |
+
by_contra hn
|
| 42 |
+
have hlt : f b < r := lt_of_not_ge hn
|
| 43 |
+
obtain ⟨t,ht,he⟩ := intermediate_value_Icc hb.1.1.2 hf.continuousOn ⟨hlt.le,hf1.le⟩
|
| 44 |
+
have hmem : t ∈ S := ⟨⟨hb.1.1.1.trans ht.1,ht.2⟩,he.le⟩
|
| 45 |
+
have htb : t=b := le_antisymm (hb.2 hmem) ht.1
|
| 46 |
+
rw [htb] at he
|
| 47 |
+
exact hlt.ne he
|
| 48 |
+
refine ⟨a,b,ha.1.1,hb.1.1,ha.2 hτS,hb.2 hτS,ha.1.2,hb.1.2,
|
| 49 |
+
fun t ht hh => ⟨ha.2 ⟨ht,hh⟩,hb.2 ⟨ht,hh⟩⟩,hfa,hfb,?_,?_⟩
|
| 50 |
+
· intro ht0
|
| 51 |
+
apply lt_of_le_of_ne (ha.2 hτS)
|
| 52 |
+
intro he
|
| 53 |
+
have h := hfa (he.symm ▸ ht0)
|
| 54 |
+
rw [he] at h
|
| 55 |
+
exact hvisit.ne h
|
| 56 |
+
· intro ht1
|
| 57 |
+
apply lt_of_le_of_ne (hb.2 hτS)
|
| 58 |
+
intro he
|
| 59 |
+
have h := hfb (he ▸ ht1)
|
| 60 |
+
rw [← he] at h
|
| 61 |
+
exact hvisit.ne h
|
| 62 |
+
|
| 63 |
+
end Zarankiewicz
|
| 64 |
+
|
| 65 |
+
end
|
| 66 |
+
|
| 67 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/SubspaceIntersection.lean
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.StageDegreeBound
|
| 2 |
+
import OAI.Combinatorics.Crossing.DegreeCounting
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
namespace Zarankiewicz
|
| 8 |
+
open Module Submodule
|
| 9 |
+
open scoped BigOperators
|
| 10 |
+
variable {W : Type*} [AddCommGroup W] [Module ℝ W] [FiniteDimensional ℝ W]
|
| 11 |
+
|
| 12 |
+
theorem subspace_intersection_bound (m : ℕ) (U V : Fin m → Submodule ℝ W)
|
| 13 |
+
(hUV : ∀ i, Disjoint (U i) (V i)) :
|
| 14 |
+
(∑ i, ∑ j, finrank ℝ ↥(U i ⊓ V j)) ≤ (m*m/4) * finrank ℝ W := by
|
| 15 |
+
let node : Fin m → ℝ := fun i => (i.val : ℝ)
|
| 16 |
+
have hn : Function.Injective node := by
|
| 17 |
+
intro i j hij
|
| 18 |
+
apply Fin.ext
|
| 19 |
+
dsimp only [node] at hij
|
| 20 |
+
exact_mod_cast hij
|
| 21 |
+
have ht : ∀ i, node i ≠ (-1 : ℝ) := by
|
| 22 |
+
intro i
|
| 23 |
+
have hnonneg : (0 : ℝ) ≤ node i := Nat.cast_nonneg i.val
|
| 24 |
+
linarith
|
| 25 |
+
let ell := columnIncrement U node ⊤ (-1)
|
| 26 |
+
have hsum : (∑ i, ∑ j, finrank ℝ ↥(U i ⊓ V j)) =
|
| 27 |
+
∑ h ∈ Finset.range m, ∑ j, rankIncrement U node (V j) h := by
|
| 28 |
+
rw [Finset.sum_comm]
|
| 29 |
+
calc
|
| 30 |
+
(∑ j, ∑ i, finrank ℝ ↥(U i ⊓ V j)) =
|
| 31 |
+
∑ j, ∑ h ∈ Finset.range m, rankIncrement U node (V j) h := by
|
| 32 |
+
apply Finset.sum_congr rfl
|
| 33 |
+
intro j hj
|
| 34 |
+
simpa only [Fintype.card_fin] using (interpolation_identity U node (V j) hn).symm
|
| 35 |
+
_ = _ := Finset.sum_comm
|
| 36 |
+
have hell : (∑ e ∈ Finset.range m, ell e) ≤ finrank ℝ W := by
|
| 37 |
+
change (∑ e ∈ Finset.range m, columnIncrement U node ⊤ (-1) e) ≤ _
|
| 38 |
+
rw [sum_columnIncrement]
|
| 39 |
+
have he := Submodule.finrank_le (evaluationFiltration U node ⊤ (-1) m)
|
| 40 |
+
simpa using he
|
| 41 |
+
rw [hsum]
|
| 42 |
+
calc
|
| 43 |
+
(∑ h ∈ Finset.range m, ∑ j, rankIncrement U node (V j) h) ≤
|
| 44 |
+
∑ h ∈ Finset.range m, ∑ e ∈ Finset.range (h+1), e * ell e := by
|
| 45 |
+
apply Finset.sum_le_sum
|
| 46 |
+
intro h hh
|
| 47 |
+
exact stage_degree_bound U V node hn hUV (-1) ht h
|
| 48 |
+
_ ≤ (m*m/4) * finrank ℝ W := total_degree_cost_le ell m (finrank ℝ W) hell
|
| 49 |
+
|
| 50 |
+
theorem lemma2_1 (m N : ℕ) (U V : Fin m → Submodule ℝ W)
|
| 51 |
+
(hN : finrank ℝ W = N) (hUV : ∀ i, U i ⊓ V i = ⊥) :
|
| 52 |
+
(∑ i, ∑ j, finrank ℝ ↥(U i ⊓ V j)) ≤ (m*m/4) * N := by
|
| 53 |
+
rw [← hN]
|
| 54 |
+
exact subspace_intersection_bound m U V (fun i => disjoint_iff.mpr (hUV i))
|
| 55 |
+
|
| 56 |
+
end Zarankiewicz
|
| 57 |
+
|
| 58 |
+
end
|
| 59 |
+
|
| 60 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/SubspaceProjection.lean
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib.LinearAlgebra.FiniteDimensional.Lemmas
|
| 2 |
+
import Mathlib.LinearAlgebra.Quotient.Basic
|
| 3 |
+
import Mathlib.Basic.Real.Basic
|
| 4 |
+
import Lean.Elab.Tactic.Omega
|
| 5 |
+
|
| 6 |
+
namespace OAI
|
| 7 |
+
|
| 8 |
+
noncomputable section
|
| 9 |
+
namespace Zarankiewicz
|
| 10 |
+
open Module Submodule
|
| 11 |
+
variable {W W' : Type*} [AddCommGroup W] [Module ℝ W] [FiniteDimensional ℝ W]
|
| 12 |
+
variable [AddCommGroup W'] [Module ℝ W']
|
| 13 |
+
|
| 14 |
+
theorem finrank_map_add_le (f : W →ₗ[ℝ] W') (E T : Submodule ℝ W)
|
| 15 |
+
(hTE : T ≤ E) (hTk : T ≤ LinearMap.ker f) :
|
| 16 |
+
finrank ℝ (E.map f) + finrank ℝ T ≤ finrank ℝ E := by
|
| 17 |
+
let g := f.comp E.subtype
|
| 18 |
+
have hk : T.comap E.subtype ≤ LinearMap.ker g := fun x hx => hTk hx
|
| 19 |
+
have hd := Submodule.finrank_mono hk
|
| 20 |
+
rw [(Submodule.comapSubtypeEquivOfLe hTE).finrank_eq] at hd
|
| 21 |
+
have hr := g.finrank_range_add_finrank_ker
|
| 22 |
+
have he : LinearMap.range g = E.map f := by
|
| 23 |
+
dsimp only [g]
|
| 24 |
+
rw [LinearMap.range_comp, Submodule.range_subtype]
|
| 25 |
+
rw [he] at hr
|
| 26 |
+
omega
|
| 27 |
+
|
| 28 |
+
theorem finrank_map_of_disjoint
|
| 29 |
+
{W W' : Type*} [AddCommGroup W] [Module ℝ W] [FiniteDimensional ℝ W]
|
| 30 |
+
[AddCommGroup W'] [Module ℝ W']
|
| 31 |
+
(f : W →ₗ[ℝ] W') (E : Submodule ℝ W)
|
| 32 |
+
(hE : Disjoint E (LinearMap.ker f)) : finrank ℝ (E.map f) = finrank ℝ E := by
|
| 33 |
+
let g := f.comp E.subtype
|
| 34 |
+
have hg : Function.Injective g := by
|
| 35 |
+
apply LinearMap.ker_eq_bot.mp
|
| 36 |
+
apply le_antisymm _ bot_le
|
| 37 |
+
intro x hx
|
| 38 |
+
have hm : x.val ∈ E ⊓ LinearMap.ker f := ⟨x.property, hx⟩
|
| 39 |
+
rw [hE.eq_bot] at hm
|
| 40 |
+
exact (Submodule.mem_bot ℝ).mpr (Subtype.ext ((Submodule.mem_bot ℝ).mp hm))
|
| 41 |
+
have hr := LinearMap.finrank_range_of_inj hg
|
| 42 |
+
change finrank ℝ (LinearMap.range (f.comp E.subtype)) = finrank ℝ E at hr
|
| 43 |
+
rw [LinearMap.range_comp, Submodule.range_subtype] at hr
|
| 44 |
+
exact hr
|
| 45 |
+
|
| 46 |
+
end Zarankiewicz
|
| 47 |
+
|
| 48 |
+
end
|
| 49 |
+
|
| 50 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/SurgeryCrossingContainment.lean
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.SurgeryRouteIntersections
|
| 2 |
+
import OAI.Combinatorics.Crossing.ReplaceDrawingRangeCases
|
| 3 |
+
import OAI.Combinatorics.Crossing.DrawingRangeCrossings
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
noncomputable section
|
| 8 |
+
namespace Zarankiewicz.PolygonalExterior
|
| 9 |
+
variable {m n : ℕ} {D : AdmissibleDrawing m n} {C : DrawingPassages D.toFiniteIntersectionDrawing}
|
| 10 |
+
(E : PolygonalExterior C) (v : BipartiteVertex m n → Plane) (hvinj : Function.Injective v)
|
| 11 |
+
(hv : ∀ j, squaredLength (v j-D.vertex j) < C.radius^2)
|
| 12 |
+
(hdet : ∀ j (p q : C.PortsAt (C.vertexMark j)), p ≠ q →
|
| 13 |
+
det2 (C.portPoint p.val-v j) (C.portPoint q.val-v j) ≠ 0)
|
| 14 |
+
(P : ∀ e, PolygonalParametrization ((E.assembledAdmissible v hvinj hv hdet).edge e))
|
| 15 |
+
{p q : C.InnerIndex}
|
| 16 |
+
|
| 17 |
+
theorem adjacentSurgeryDrawing_crossings_subset
|
| 18 |
+
(Kp : ExteriorCrossingCut C P p) (Kq : ExteriorCrossingCut C P q)
|
| 19 |
+
(hpq : p ≠ q) (hm : C.innerMark p=C.innerMark q) (hadj : p.1.1=q.1.1 ∨ p.1.2=q.1.2)
|
| 20 |
+
(hcross : SegmentsCrossProperly (C.portPoint (C.incomingPort p)) (C.portPoint (C.outgoingPort p))
|
| 21 |
+
(C.portPoint (C.incomingPort q)) (C.portPoint (C.outgoingPort q)))
|
| 22 |
+
(hemb : StraightEdgeEmbedding (crossingSurgeryGraph C P p q) id) :
|
| 23 |
+
crossingPoints (adjacentSurgeryDrawing Kp Kq hm hadj hv hemb) ⊆
|
| 24 |
+
crossingPoints (E.assembledAdmissible v hvinj hv hdet).toContinuousDrawing := by
|
| 25 |
+
let B := (E.assembledAdmissible v hvinj hv hdet).toContinuousDrawing
|
| 26 |
+
let A := adjacentSurgeryDrawing Kp Kq hm hadj hv hemb
|
| 27 |
+
intro x hx
|
| 28 |
+
obtain ⟨e,f,hef,hxe,hxf⟩ := hx
|
| 29 |
+
have havoid : ∀ j, x ≠ B.vertex j := edgeInterior_not_vertex A e x hxe
|
| 30 |
+
have hpair (hx : x ∈ Set.range (adjacentSurgeryRouteP Kp Kq hm hadj))
|
| 31 |
+
(hy : x ∈ Set.range (adjacentSurgeryRouteQ Kp Kq hm hadj)) : x ∈ crossingPoints B := by
|
| 32 |
+
have hh := E.adjacentSurgeryRoutes_meeting_each_other v hvinj hv hdet P Kp Kq hpq hm hadj hcross x hx hy
|
| 33 |
+
exact crossing_of_ranges_not_vertices B p.1 q.1
|
| 34 |
+
(fun he => hpq (C.innerIndex_eq_of_edge_mark p q he hm)) x hh.1 hh.2 havoid
|
| 35 |
+
have hmixed (g : BipartiteEdge m n) (hgp : g ≠ p.1) (hgq : g ≠ q.1)
|
| 36 |
+
(hx : x ∈ Set.range (adjacentSurgeryRouteP Kp Kq hm hadj) ∨
|
| 37 |
+
x ∈ Set.range (adjacentSurgeryRouteQ Kp Kq hm hadj))
|
| 38 |
+
(hy : x ∈ Set.range (B.edge g)) : x ∈ crossingPoints B := by
|
| 39 |
+
rcases E.adjacentSurgeryRoutes_meeting_other v hvinj hv hdet P Kp Kq hpq hm hadj g hgp hgq x hx hy with h | h
|
| 40 |
+
· exact crossing_of_ranges_not_vertices B p.1 g (Ne.symm hgp) x h hy havoid
|
| 41 |
+
· exact crossing_of_ranges_not_vertices B q.1 g (Ne.symm hgq) x h hy havoid
|
| 42 |
+
have hcases (g : BipartiteEdge m n) (hg : x ∈ Set.range (A.edge g)) :=
|
| 43 |
+
B.replaceTwoRoutes_range_cases p.1 q.1 (adjacentSurgeryRouteP Kp Kq hm hadj)
|
| 44 |
+
(adjacentSurgeryRouteQ Kp Kq hm hadj) g x hg
|
| 45 |
+
rcases hcases e (edgeInterior_subset_range A e hxe) with ⟨hep,hx⟩ | ⟨heq,hx⟩ | ⟨hep,heq,hx⟩
|
| 46 |
+
· rcases hcases f (edgeInterior_subset_range A f hxf) with ⟨hfp,hy⟩ | ⟨hfq,hy⟩ | ⟨hfp,hfq,hy⟩
|
| 47 |
+
· exact False.elim (hef (hep.trans hfp.symm))
|
| 48 |
+
· exact hpair hx hy
|
| 49 |
+
· exact hmixed f hfp hfq (Or.inl hx) hy
|
| 50 |
+
· rcases hcases f (edgeInterior_subset_range A f hxf) with ⟨hfp,hy⟩ | ⟨hfq,hy⟩ | ⟨hfp,hfq,hy⟩
|
| 51 |
+
· exact hpair hy hx
|
| 52 |
+
· exact False.elim (hef (heq.trans hfq.symm))
|
| 53 |
+
· exact hmixed f hfp hfq (Or.inr hx) hy
|
| 54 |
+
· rcases hcases f (edgeInterior_subset_range A f hxf) with ⟨hfp,hy⟩ | ⟨hfq,hy⟩ | ⟨hfp,hfq,hy⟩
|
| 55 |
+
· exact hmixed e hep heq (Or.inl hy) hx
|
| 56 |
+
· exact hmixed e hep heq (Or.inr hy) hx
|
| 57 |
+
· exact crossing_of_ranges_not_vertices B e f hef x hx hy havoid
|
| 58 |
+
|
| 59 |
+
end Zarankiewicz.PolygonalExterior
|
| 60 |
+
|
| 61 |
+
end
|
| 62 |
+
|
| 63 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/SurgeryCutWalks.lean
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.CrossingSurgeryGraph
|
| 2 |
+
import OAI.Combinatorics.Crossing.CrossingCutWalks
|
| 3 |
+
import OAI.Combinatorics.Crossing.GraphWalkRealizationLaws
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
noncomputable section
|
| 8 |
+
namespace Zarankiewicz
|
| 9 |
+
variable {m n : ℕ} {D D' : AdmissibleDrawing m n}
|
| 10 |
+
|
| 11 |
+
def surgeryPrefixWalk (C : DrawingPassages D.toFiniteIntersectionDrawing)
|
| 12 |
+
(P : ∀ e, PolygonalParametrization (D'.edge e)) (p q r : C.InnerIndex)
|
| 13 |
+
(i : ℕ) (hi : (drawingEdgeWalk P r.1).getVert i=C.portPoint (C.incomingPort r))
|
| 14 |
+
(hout : Disjoint (Set.range (graphWalkPath id ((drawingEdgeWalk P r.1).take i))) (C.crossingDisk p)) :
|
| 15 |
+
(crossingSurgeryGraph C P p q).Walk (D'.vertex (.inl r.1.1)) (C.portPoint (C.incomingPort r)) :=
|
| 16 |
+
((exteriorGraphWalk ((drawingEdgeWalk P r.1).take i) (C.crossingDisk p) hout).mapLe
|
| 17 |
+
(exterior_le_crossingSurgeryGraph C P p q)).copy rfl hi
|
| 18 |
+
|
| 19 |
+
def surgerySuffixWalk (C : DrawingPassages D.toFiniteIntersectionDrawing)
|
| 20 |
+
(P : ∀ e, PolygonalParametrization (D'.edge e)) (p q r : C.InnerIndex)
|
| 21 |
+
(j : ℕ) (hj : (drawingEdgeWalk P r.1).getVert j=C.portPoint (C.outgoingPort r))
|
| 22 |
+
(hout : Disjoint (Set.range (graphWalkPath id ((drawingEdgeWalk P r.1).drop j))) (C.crossingDisk p)) :
|
| 23 |
+
(crossingSurgeryGraph C P p q).Walk (C.portPoint (C.outgoingPort r)) (D'.vertex (.inr r.1.2)) :=
|
| 24 |
+
((exteriorGraphWalk ((drawingEdgeWalk P r.1).drop j) (C.crossingDisk p) hout).mapLe
|
| 25 |
+
(exterior_le_crossingSurgeryGraph C P p q)).copy hj rfl
|
| 26 |
+
|
| 27 |
+
theorem surgeryPrefixWalk_trace (C : DrawingPassages D.toFiniteIntersectionDrawing)
|
| 28 |
+
(P : ∀ e, PolygonalParametrization (D'.edge e)) (p q r : C.InnerIndex)
|
| 29 |
+
(i : ℕ) (hi : (drawingEdgeWalk P r.1).getVert i=C.portPoint (C.incomingPort r))
|
| 30 |
+
(hout : Disjoint (Set.range (graphWalkPath id ((drawingEdgeWalk P r.1).take i))) (C.crossingDisk p)) :
|
| 31 |
+
Set.range (graphWalkPath id (surgeryPrefixWalk C P p q r i hi hout))=
|
| 32 |
+
Set.range (graphWalkPath id ((drawingEdgeWalk P r.1).take i)) := by
|
| 33 |
+
rw [surgeryPrefixWalk,graphWalkPath_copy_range,graphWalkPath_mapLe_range,exteriorGraphWalk_trace]
|
| 34 |
+
|
| 35 |
+
theorem surgerySuffixWalk_trace (C : DrawingPassages D.toFiniteIntersectionDrawing)
|
| 36 |
+
(P : ∀ e, PolygonalParametrization (D'.edge e)) (p q r : C.InnerIndex)
|
| 37 |
+
(j : ℕ) (hj : (drawingEdgeWalk P r.1).getVert j=C.portPoint (C.outgoingPort r))
|
| 38 |
+
(hout : Disjoint (Set.range (graphWalkPath id ((drawingEdgeWalk P r.1).drop j))) (C.crossingDisk p)) :
|
| 39 |
+
Set.range (graphWalkPath id (surgerySuffixWalk C P p q r j hj hout))=
|
| 40 |
+
Set.range (graphWalkPath id ((drawingEdgeWalk P r.1).drop j)) := by
|
| 41 |
+
rw [surgerySuffixWalk,graphWalkPath_copy_range,graphWalkPath_mapLe_range,exteriorGraphWalk_trace]
|
| 42 |
+
|
| 43 |
+
end Zarankiewicz
|
| 44 |
+
|
| 45 |
+
end
|
| 46 |
+
|
| 47 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/SurgeryFiniteDrawing.lean
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.SurgeryNoTriples
|
| 2 |
+
import OAI.Combinatorics.Crossing.SurgeryStrictPointCount
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
namespace Zarankiewicz.PolygonalExterior
|
| 8 |
+
variable {m n : ℕ} {D : AdmissibleDrawing m n} {C : DrawingPassages D.toFiniteIntersectionDrawing}
|
| 9 |
+
(E : PolygonalExterior C) (v : BipartiteVertex m n → Plane) (hvinj : Function.Injective v)
|
| 10 |
+
(hv : ∀ j, squaredLength (v j-D.vertex j) < C.radius^2)
|
| 11 |
+
(hdet : ∀ j (p q : C.PortsAt (C.vertexMark j)), p ≠ q →
|
| 12 |
+
det2 (C.portPoint p.val-v j) (C.portPoint q.val-v j) ≠ 0)
|
| 13 |
+
(P : ∀ e, PolygonalParametrization ((E.assembledAdmissible v hvinj hv hdet).edge e))
|
| 14 |
+
{p q : C.InnerIndex}
|
| 15 |
+
|
| 16 |
+
def adjacentSurgeryFiniteDrawing
|
| 17 |
+
(Kp : ExteriorCrossingCut C P p) (Kq : ExteriorCrossingCut C P q)
|
| 18 |
+
(hpq : p ≠ q) (hm : C.innerMark p=C.innerMark q) (hadj : p.1.1=q.1.1 ∨ p.1.2=q.1.2)
|
| 19 |
+
(hemb : StraightEdgeEmbedding (crossingSurgeryGraph C P p q) id)
|
| 20 |
+
(x : Plane) (hxp : x ∈ Set.range (C.crossingChord p)) (hxq : x ∈ Set.range (C.crossingChord q)) :
|
| 21 |
+
FiniteIntersectionDrawing m n where
|
| 22 |
+
toContinuousDrawing := adjacentSurgeryDrawing Kp Kq hm hadj hv hemb
|
| 23 |
+
crossings_finite := (E.adjacentSurgeryDrawing_strict_crossing_ncard v hvinj hv hdet P Kp Kq hpq hm hadj hemb x hxp hxq).1
|
| 24 |
+
no_triples := E.adjacentSurgeryDrawing_no_triples v hvinj hv hdet P Kp Kq hpq hm hadj
|
| 25 |
+
(C.crossingChord_meeting_segmentsCrossProperly p q hpq x hxp hxq) hemb
|
| 26 |
+
|
| 27 |
+
theorem adjacentSurgeryFiniteDrawing_count_lt
|
| 28 |
+
(Kp : ExteriorCrossingCut C P p) (Kq : ExteriorCrossingCut C P q)
|
| 29 |
+
(hpq : p ≠ q) (hm : C.innerMark p=C.innerMark q) (hadj : p.1.1=q.1.1 ∨ p.1.2=q.1.2)
|
| 30 |
+
(hemb : StraightEdgeEmbedding (crossingSurgeryGraph C P p q) id)
|
| 31 |
+
(x : Plane) (hxp : x ∈ Set.range (C.crossingChord p)) (hxq : x ∈ Set.range (C.crossingChord q)) :
|
| 32 |
+
finiteCrossingCount (E.adjacentSurgeryFiniteDrawing v hvinj hv hdet P Kp Kq hpq hm hadj hemb x hxp hxq) <
|
| 33 |
+
crossingCount (E.assembledAdmissible v hvinj hv hdet) := by
|
| 34 |
+
rw [finiteCrossingCount_eq_ncard]
|
| 35 |
+
have h := (E.adjacentSurgeryDrawing_strict_crossing_ncard v hvinj hv hdet P Kp Kq hpq hm hadj hemb x hxp hxq).2
|
| 36 |
+
exact h.trans_eq (Set.ncard_eq_toFinset_card _ (E.assembledAdmissible v hvinj hv hdet).crossings_finite)
|
| 37 |
+
|
| 38 |
+
end Zarankiewicz.PolygonalExterior
|
| 39 |
+
|
| 40 |
+
end
|
| 41 |
+
|
| 42 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/SurgeryNoTriples.lean
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.SurgeryCrossingContainment
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
namespace Zarankiewicz.PolygonalExterior
|
| 7 |
+
variable {m n : ℕ} {D : AdmissibleDrawing m n} {C : DrawingPassages D.toFiniteIntersectionDrawing}
|
| 8 |
+
(E : PolygonalExterior C) (v : BipartiteVertex m n → Plane) (hvinj : Function.Injective v)
|
| 9 |
+
(hv : ∀ j, squaredLength (v j-D.vertex j) < C.radius^2)
|
| 10 |
+
(hdet : ∀ j (p q : C.PortsAt (C.vertexMark j)), p ≠ q →
|
| 11 |
+
det2 (C.portPoint p.val-v j) (C.portPoint q.val-v j) ≠ 0)
|
| 12 |
+
(P : ∀ e, PolygonalParametrization ((E.assembledAdmissible v hvinj hv hdet).edge e))
|
| 13 |
+
{p q : C.InnerIndex}
|
| 14 |
+
|
| 15 |
+
theorem adjacentSurgeryDrawing_no_triples
|
| 16 |
+
(Kp : ExteriorCrossingCut C P p) (Kq : ExteriorCrossingCut C P q)
|
| 17 |
+
(hpq : p ≠ q) (hm : C.innerMark p=C.innerMark q) (hadj : p.1.1=q.1.1 ∨ p.1.2=q.1.2)
|
| 18 |
+
(hcross : SegmentsCrossProperly (C.portPoint (C.incomingPort p)) (C.portPoint (C.outgoingPort p))
|
| 19 |
+
(C.portPoint (C.incomingPort q)) (C.portPoint (C.outgoingPort q)))
|
| 20 |
+
(hemb : StraightEdgeEmbedding (crossingSurgeryGraph C P p q) id)
|
| 21 |
+
(e f g : BipartiteEdge m n) (hef : e ≠ f) (heg : e ≠ g) (hfg : f ≠ g) :
|
| 22 |
+
edgeInterior (adjacentSurgeryDrawing Kp Kq hm hadj hv hemb) e ∩
|
| 23 |
+
edgeInterior (adjacentSurgeryDrawing Kp Kq hm hadj hv hemb) f ∩
|
| 24 |
+
edgeInterior (adjacentSurgeryDrawing Kp Kq hm hadj hv hemb) g = ∅ := by
|
| 25 |
+
let B := E.assembledAdmissible v hvinj hv hdet
|
| 26 |
+
let A := adjacentSurgeryDrawing Kp Kq hm hadj hv hemb
|
| 27 |
+
apply Set.eq_empty_iff_forall_notMem.mpr
|
| 28 |
+
intro x hx
|
| 29 |
+
obtain ⟨⟨hxe,hxf⟩,hxg⟩ := hx
|
| 30 |
+
have havoid : ∀ j, x ≠ B.vertex j := edgeInterior_not_vertex A e x hxe
|
| 31 |
+
have hthree (a b c : BipartiteEdge m n) (hab : a ≠ b) (hac : a ≠ c) (hbc : b ≠ c)
|
| 32 |
+
(ha : x ∈ Set.range (B.edge a)) (hb : x ∈ Set.range (B.edge b))
|
| 33 |
+
(hc : x ∈ Set.range (B.edge c)) : False := by
|
| 34 |
+
have hmem : x ∈ edgeInterior B.toContinuousDrawing a ∩ edgeInterior B.toContinuousDrawing b ∩
|
| 35 |
+
edgeInterior B.toContinuousDrawing c :=
|
| 36 |
+
⟨⟨edgeInterior_of_range_not_vertices _ a x ha havoid,
|
| 37 |
+
edgeInterior_of_range_not_vertices _ b x hb havoid⟩,edgeInterior_of_range_not_vertices _ c x hc havoid⟩
|
| 38 |
+
rw [B.no_triples a b c hab hac hbc] at hmem
|
| 39 |
+
exact hmem
|
| 40 |
+
have htwo (a : BipartiteEdge m n) (hap : a ≠ p.1) (haq : a ≠ q.1)
|
| 41 |
+
(hp : x ∈ Set.range (adjacentSurgeryRouteP Kp Kq hm hadj))
|
| 42 |
+
(hq : x ∈ Set.range (adjacentSurgeryRouteQ Kp Kq hm hadj))
|
| 43 |
+
(ha : x ∈ Set.range (B.edge a)) : False := by
|
| 44 |
+
have hh := E.adjacentSurgeryRoutes_meeting_each_other v hvinj hv hdet P Kp Kq hpq hm hadj hcross x hp hq
|
| 45 |
+
exact hthree p.1 q.1 a (fun he => hpq (C.innerIndex_eq_of_edge_mark p q he hm))
|
| 46 |
+
(Ne.symm hap) (Ne.symm haq) hh.1 hh.2 ha
|
| 47 |
+
have hone (a b : BipartiteEdge m n) (hab : a ≠ b)
|
| 48 |
+
(hap : a ≠ p.1) (haq : a ≠ q.1) (hbp : b ≠ p.1) (hbq : b ≠ q.1)
|
| 49 |
+
(hh : x ∈ Set.range (adjacentSurgeryRouteP Kp Kq hm hadj) ∨
|
| 50 |
+
x ∈ Set.range (adjacentSurgeryRouteQ Kp Kq hm hadj))
|
| 51 |
+
(ha : x ∈ Set.range (B.edge a)) (hb : x ∈ Set.range (B.edge b)) : False := by
|
| 52 |
+
rcases E.adjacentSurgeryRoutes_meeting_other v hvinj hv hdet P Kp Kq hpq hm hadj a hap haq x hh ha with hp | hq
|
| 53 |
+
· exact hthree p.1 a b (Ne.symm hap) (Ne.symm hbp) hab hp ha hb
|
| 54 |
+
· exact hthree q.1 a b (Ne.symm haq) (Ne.symm hbq) hab hq ha hb
|
| 55 |
+
have hcases (a : BipartiteEdge m n) (ha : x ∈ Set.range (A.edge a)) :=
|
| 56 |
+
B.toContinuousDrawing.replaceTwoRoutes_range_cases p.1 q.1 (adjacentSurgeryRouteP Kp Kq hm hadj)
|
| 57 |
+
(adjacentSurgeryRouteQ Kp Kq hm hadj) a x ha
|
| 58 |
+
have hec := hcases e (edgeInterior_subset_range A e hxe)
|
| 59 |
+
have hfc := hcases f (edgeInterior_subset_range A f hxf)
|
| 60 |
+
have hgc := hcases g (edgeInterior_subset_range A g hxg)
|
| 61 |
+
rcases hec with ⟨hep,hx⟩ | ⟨heq,hx⟩ | ⟨hep,heq,hx⟩
|
| 62 |
+
· rcases hfc with ⟨hfp,hy⟩ | ⟨hfq,hy⟩ | ⟨hfp,hfq,hy⟩
|
| 63 |
+
· exact hef (hep.trans hfp.symm)
|
| 64 |
+
· rcases hgc with ⟨hgp,hz⟩ | ⟨hgq,hz⟩ | ⟨hgp,hgq,hz⟩
|
| 65 |
+
· exact heg (hep.trans hgp.symm)
|
| 66 |
+
· exact hfg (hfq.trans hgq.symm)
|
| 67 |
+
· exact htwo g hgp hgq hx hy hz
|
| 68 |
+
· rcases hgc with ⟨hgp,hz⟩ | ⟨hgq,hz⟩ | ⟨hgp,hgq,hz⟩
|
| 69 |
+
· exact heg (hep.trans hgp.symm)
|
| 70 |
+
· exact htwo f hfp hfq hx hz hy
|
| 71 |
+
· exact hone f g hfg hfp hfq hgp hgq (Or.inl hx) hy hz
|
| 72 |
+
· rcases hfc with ⟨hfp,hy⟩ | ⟨hfq,hy⟩ | ⟨hfp,hfq,hy⟩
|
| 73 |
+
· rcases hgc with ⟨hgp,hz⟩ | ⟨hgq,hz⟩ | ⟨hgp,hgq,hz⟩
|
| 74 |
+
· exact hfg (hfp.trans hgp.symm)
|
| 75 |
+
· exact heg (heq.trans hgq.symm)
|
| 76 |
+
· exact htwo g hgp hgq hy hx hz
|
| 77 |
+
· exact hef (heq.trans hfq.symm)
|
| 78 |
+
· rcases hgc with ⟨hgp,hz⟩ | ⟨hgq,hz⟩ | ⟨hgp,hgq,hz⟩
|
| 79 |
+
· exact htwo f hfp hfq hz hx hy
|
| 80 |
+
· exact heg (heq.trans hgq.symm)
|
| 81 |
+
· exact hone f g hfg hfp hfq hgp hgq (Or.inr hx) hy hz
|
| 82 |
+
· rcases hfc with ⟨hfp,hy⟩ | ⟨hfq,hy⟩ | ⟨hfp,hfq,hy⟩
|
| 83 |
+
· rcases hgc with ⟨hgp,hz⟩ | ⟨hgq,hz⟩ | ⟨hgp,hgq,hz⟩
|
| 84 |
+
· exact hfg (hfp.trans hgp.symm)
|
| 85 |
+
· exact htwo e hep heq hy hz hx
|
| 86 |
+
· exact hone e g heg hep heq hgp hgq (Or.inl hy) hx hz
|
| 87 |
+
· rcases hgc with ⟨hgp,hz⟩ | ⟨hgq,hz⟩ | ⟨hgp,hgq,hz⟩
|
| 88 |
+
· exact htwo e hep heq hz hy hx
|
| 89 |
+
· exact hfg (hfq.trans hgq.symm)
|
| 90 |
+
· exact hone e g heg hep heq hgp hgq (Or.inr hy) hx hz
|
| 91 |
+
· rcases hgc with ⟨hgp,hz⟩ | ⟨hgq,hz⟩ | ⟨hgp,hgq,hz⟩
|
| 92 |
+
· exact hone e f hef hep heq hfp hfq (Or.inl hz) hx hy
|
| 93 |
+
· exact hone e f hef hep heq hfp hfq (Or.inr hz) hx hy
|
| 94 |
+
· exact hthree e f g hef heg hfg hx hy hz
|
| 95 |
+
|
| 96 |
+
end Zarankiewicz.PolygonalExterior
|
| 97 |
+
|
| 98 |
+
end
|
| 99 |
+
|
| 100 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/SurgeryPathWitnesses.lean
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.SurgeryCutWalks
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
namespace Zarankiewicz
|
| 7 |
+
|
| 8 |
+
def walkThroughChord {G : SimpleGraph Plane} {a u v b : Plane}
|
| 9 |
+
(A : G.Walk a u) (h : G.Adj u v) (B : G.Walk v b) : G.Walk a b :=
|
| 10 |
+
(A.append h.toWalk).append B
|
| 11 |
+
|
| 12 |
+
theorem walkThroughChord_range {G : SimpleGraph Plane} {a u v b : Plane}
|
| 13 |
+
(A : G.Walk a u) (h : G.Adj u v) (B : G.Walk v b) :
|
| 14 |
+
Set.range (graphWalkPath id (walkThroughChord A h B))=
|
| 15 |
+
(Set.range (graphWalkPath id A) ∪ segment ℝ u v) ∪ Set.range (graphWalkPath id B) := by
|
| 16 |
+
rw [walkThroughChord,graphWalkPath_append_range,graphWalkPath_append_range,graphWalkPath_toWalk_range]
|
| 17 |
+
|
| 18 |
+
theorem exists_simple_path_through_chord {G : SimpleGraph Plane}
|
| 19 |
+
(hemb : StraightEdgeEmbedding G id) {a u v b : Plane} (hab : a ≠ b)
|
| 20 |
+
(A : G.Walk a u) (h : G.Adj u v) (B : G.Walk v b) :
|
| 21 |
+
∃ γ : Path a b, Function.Injective γ ∧ HasFiniteAffineCover γ ∧
|
| 22 |
+
Set.range γ ⊆ (Set.range (graphWalkPath id A) ∪ segment ℝ u v) ∪ Set.range (graphWalkPath id B) := by
|
| 23 |
+
classical
|
| 24 |
+
let p := walkThroughChord A h B
|
| 25 |
+
refine ⟨graphWalkPath id p.bypass,
|
| 26 |
+
graphWalkPath_injective id hemb hab p.bypass p.bypass_isPath,
|
| 27 |
+
graphWalkPath_hasFiniteAffineCover id p.bypass,?_⟩
|
| 28 |
+
exact (graphWalkPath_bypass_range_subset id p).trans (by rw [walkThroughChord_range])
|
| 29 |
+
|
| 30 |
+
variable {m n : ℕ} {D D' : AdmissibleDrawing m n}
|
| 31 |
+
|
| 32 |
+
theorem surgery_mixed_endpoints_ne (C : DrawingPassages D.toFiniteIntersectionDrawing)
|
| 33 |
+
(p q : C.InnerIndex) : D'.vertex (.inl p.1.1) ≠ D'.vertex (.inr q.1.2) := by
|
| 34 |
+
intro h
|
| 35 |
+
cases D'.vertex_injective h
|
| 36 |
+
|
| 37 |
+
end Zarankiewicz
|
| 38 |
+
|
| 39 |
+
end
|
| 40 |
+
|
| 41 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/SurgeryRouteIntersections.lean
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.ReconnectedIntersectionCases
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
namespace Zarankiewicz.PolygonalExterior
|
| 7 |
+
variable {m n : ℕ} {D : AdmissibleDrawing m n} {C : DrawingPassages D.toFiniteIntersectionDrawing}
|
| 8 |
+
(E : PolygonalExterior C) (v : BipartiteVertex m n → Plane) (hvinj : Function.Injective v)
|
| 9 |
+
(hv : ∀ j, squaredLength (v j-D.vertex j) < C.radius^2)
|
| 10 |
+
(hdet : ∀ j (p q : C.PortsAt (C.vertexMark j)), p ≠ q →
|
| 11 |
+
det2 (C.portPoint p.val-v j) (C.portPoint q.val-v j) ≠ 0)
|
| 12 |
+
(P : ∀ e, PolygonalParametrization ((E.assembledAdmissible v hvinj hv hdet).edge e))
|
| 13 |
+
{p q : C.InnerIndex}
|
| 14 |
+
|
| 15 |
+
theorem reconnectedForwardPath_meeting_other
|
| 16 |
+
(Kp : ExteriorCrossingCut C P p) (Kq : ExteriorCrossingCut C P q)
|
| 17 |
+
(hpq : p ≠ q) (hm : C.innerMark p=C.innerMark q)
|
| 18 |
+
(e : BipartiteEdge m n) (hep : e ≠ p.1) (heq : e ≠ q.1)
|
| 19 |
+
(x : Plane) (hx : x ∈ Set.range (reconnectedForwardPath Kp Kq hm))
|
| 20 |
+
(hy : x ∈ Set.range (E.assembledEdge v e)) :
|
| 21 |
+
x ∈ Set.range (E.assembledEdge v p.1) ∨ x ∈ Set.range (E.assembledEdge v q.1) := by
|
| 22 |
+
rcases reconnectedForwardPath_trace Kp Kq hm hx with (hx | hx) | hx
|
| 23 |
+
· exact Or.inl (Kp.prefix_subset_edge hx)
|
| 24 |
+
· exact False.elim (Set.disjoint_left.mp (E.reconnection_other_edge_disjoint v hv p q hpq hm true e hep heq) hx hy)
|
| 25 |
+
· exact Or.inr (Kq.suffix_subset_edge hx)
|
| 26 |
+
|
| 27 |
+
theorem reconnectedBackwardPath_meeting_other
|
| 28 |
+
(Kp : ExteriorCrossingCut C P p) (Kq : ExteriorCrossingCut C P q)
|
| 29 |
+
(hpq : p ≠ q) (hm : C.innerMark p=C.innerMark q)
|
| 30 |
+
(e : BipartiteEdge m n) (hep : e ≠ p.1) (heq : e ≠ q.1)
|
| 31 |
+
(x : Plane) (hx : x ∈ Set.range (reconnectedBackwardPath Kp Kq hm))
|
| 32 |
+
(hy : x ∈ Set.range (E.assembledEdge v e)) :
|
| 33 |
+
x ∈ Set.range (E.assembledEdge v p.1) ∨ x ∈ Set.range (E.assembledEdge v q.1) := by
|
| 34 |
+
rcases reconnectedBackwardPath_trace Kp Kq hm hx with (hx | hx) | hx
|
| 35 |
+
· exact Or.inr (Kq.prefix_subset_edge hx)
|
| 36 |
+
· exact False.elim (Set.disjoint_left.mp (E.reconnection_other_edge_disjoint v hv p q hpq hm false e hep heq) hx hy)
|
| 37 |
+
· exact Or.inl (Kp.suffix_subset_edge hx)
|
| 38 |
+
|
| 39 |
+
theorem adjacentSurgeryRoutes_meeting_other
|
| 40 |
+
(Kp : ExteriorCrossingCut C P p) (Kq : ExteriorCrossingCut C P q)
|
| 41 |
+
(hpq : p ≠ q) (hm : C.innerMark p=C.innerMark q) (hadj : p.1.1=q.1.1 ∨ p.1.2=q.1.2)
|
| 42 |
+
(e : BipartiteEdge m n) (hep : e ≠ p.1) (heq : e ≠ q.1)
|
| 43 |
+
(x : Plane) (hx : x ∈ Set.range (adjacentSurgeryRouteP Kp Kq hm hadj) ∨
|
| 44 |
+
x ∈ Set.range (adjacentSurgeryRouteQ Kp Kq hm hadj))
|
| 45 |
+
(hy : x ∈ Set.range (E.assembledEdge v e)) :
|
| 46 |
+
x ∈ Set.range (E.assembledEdge v p.1) ∨ x ∈ Set.range (E.assembledEdge v q.1) := by
|
| 47 |
+
have hf := E.reconnectedForwardPath_meeting_other v hvinj hv hdet P Kp Kq hpq hm e hep heq x
|
| 48 |
+
have hb := E.reconnectedBackwardPath_meeting_other v hvinj hv hdet P Kp Kq hpq hm e hep heq x
|
| 49 |
+
rcases hx with hx | hx
|
| 50 |
+
· unfold adjacentSurgeryRouteP at hx
|
| 51 |
+
split at hx
|
| 52 |
+
· exact hb hx hy
|
| 53 |
+
· exact hf hx hy
|
| 54 |
+
· unfold adjacentSurgeryRouteQ at hx
|
| 55 |
+
split at hx
|
| 56 |
+
· exact hf hx hy
|
| 57 |
+
· exact hb hx hy
|
| 58 |
+
|
| 59 |
+
theorem adjacentSurgeryRoutes_meeting_each_other
|
| 60 |
+
(Kp : ExteriorCrossingCut C P p) (Kq : ExteriorCrossingCut C P q)
|
| 61 |
+
(hpq : p ≠ q) (hm : C.innerMark p=C.innerMark q) (hadj : p.1.1=q.1.1 ∨ p.1.2=q.1.2)
|
| 62 |
+
(hcross : SegmentsCrossProperly (C.portPoint (C.incomingPort p)) (C.portPoint (C.outgoingPort p))
|
| 63 |
+
(C.portPoint (C.incomingPort q)) (C.portPoint (C.outgoingPort q)))
|
| 64 |
+
(x : Plane) (hx : x ∈ Set.range (adjacentSurgeryRouteP Kp Kq hm hadj))
|
| 65 |
+
(hy : x ∈ Set.range (adjacentSurgeryRouteQ Kp Kq hm hadj)) :
|
| 66 |
+
x ∈ Set.range (E.assembledEdge v p.1) ∧ x ∈ Set.range (E.assembledEdge v q.1) := by
|
| 67 |
+
have hh := E.reconnected_paths_meeting_old_edges v hvinj hv hdet P Kp Kq hpq hm hcross x
|
| 68 |
+
by_cases h : p.1.1=q.1.1
|
| 69 |
+
· simp only [adjacentSurgeryRouteP,adjacentSurgeryRouteQ,dite_eq_left h] at hx hy
|
| 70 |
+
exact hh hy hx
|
| 71 |
+
· simp only [adjacentSurgeryRouteP,adjacentSurgeryRouteQ,dite_eq_right h] at hx hy
|
| 72 |
+
exact hh hx hy
|
| 73 |
+
|
| 74 |
+
end Zarankiewicz.PolygonalExterior
|
| 75 |
+
|
| 76 |
+
end
|
| 77 |
+
|
| 78 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/SurgeryStrictPointCount.lean
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.SurgeryCrossingContainment
|
| 2 |
+
import Mathlib.Data.Set.Card
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
namespace Zarankiewicz.PolygonalExterior
|
| 8 |
+
variable {m n : ℕ} {D : AdmissibleDrawing m n} {C : DrawingPassages D.toFiniteIntersectionDrawing}
|
| 9 |
+
(E : PolygonalExterior C) (v : BipartiteVertex m n → Plane) (hvinj : Function.Injective v)
|
| 10 |
+
(hv : ∀ j, squaredLength (v j-D.vertex j) < C.radius^2)
|
| 11 |
+
(hdet : ∀ j (p q : C.PortsAt (C.vertexMark j)), p ≠ q →
|
| 12 |
+
det2 (C.portPoint p.val-v j) (C.portPoint q.val-v j) ≠ 0)
|
| 13 |
+
{p q : C.InnerIndex}
|
| 14 |
+
|
| 15 |
+
theorem crossingChord_meeting_is_assembled_crossing (hpq : p ≠ q) (x : Plane)
|
| 16 |
+
(hxp : x ∈ Set.range (C.crossingChord p)) (hxq : x ∈ Set.range (C.crossingChord q)) :
|
| 17 |
+
x ∈ crossingPoints (E.assembledAdmissible v hvinj hv hdet).toContinuousDrawing := by
|
| 18 |
+
have hm := C.chord_meeting_marks_eq p q hxp hxq
|
| 19 |
+
have hxin := (C.reconnection_avoids_chord_meeting p q hpq x hxp hxq).1
|
| 20 |
+
have hxinq : x ∈ C.crossingDisk q := by
|
| 21 |
+
simpa only [DrawingPassages.crossingDisk,hm] using hxin
|
| 22 |
+
apply crossing_of_ranges_not_vertices (E.assembledAdmissible v hvinj hv hdet).toContinuousDrawing
|
| 23 |
+
p.1 q.1 (fun he => hpq (C.innerIndex_eq_of_edge_mark p q he hm)) x
|
| 24 |
+
((E.assembled_range_in_crossingDisk v hv p x hxin).mpr hxp)
|
| 25 |
+
((E.assembled_range_in_crossingDisk v hv q x hxinq).mpr hxq)
|
| 26 |
+
intro j he
|
| 27 |
+
exact Set.disjoint_left.mp (C.crossingDisk_disjoint_vertex_disk p j) hxin (he.symm ▸ (hv j).le)
|
| 28 |
+
|
| 29 |
+
theorem adjacentSurgeryDrawing_strict_crossing_ncard
|
| 30 |
+
(P : ∀ e, PolygonalParametrization ((E.assembledAdmissible v hvinj hv hdet).edge e))
|
| 31 |
+
(Kp : ExteriorCrossingCut C P p) (Kq : ExteriorCrossingCut C P q)
|
| 32 |
+
(hpq : p ≠ q) (hm : C.innerMark p=C.innerMark q) (hadj : p.1.1=q.1.1 ∨ p.1.2=q.1.2)
|
| 33 |
+
(hemb : StraightEdgeEmbedding (crossingSurgeryGraph C P p q) id)
|
| 34 |
+
(x : Plane) (hxp : x ∈ Set.range (C.crossingChord p)) (hxq : x ∈ Set.range (C.crossingChord q)) :
|
| 35 |
+
(crossingPoints (adjacentSurgeryDrawing Kp Kq hm hadj hv hemb)).Finite ∧
|
| 36 |
+
(crossingPoints (adjacentSurgeryDrawing Kp Kq hm hadj hv hemb)).ncard <
|
| 37 |
+
(crossingPoints (E.assembledAdmissible v hvinj hv hdet).toContinuousDrawing).ncard := by
|
| 38 |
+
have hcross := C.crossingChord_meeting_segmentsCrossProperly p q hpq x hxp hxq
|
| 39 |
+
have hsub := E.adjacentSurgeryDrawing_crossings_subset v hvinj hv hdet P Kp Kq hpq hm hadj hcross hemb
|
| 40 |
+
have hfinite := (E.assembledAdmissible v hvinj hv hdet).crossings_finite
|
| 41 |
+
have hremoved := adjacentSurgeryDrawing_avoids_crossing Kp Kq hm hpq hadj hv hemb x hxp hxq (by
|
| 42 |
+
intro e hep heq hx
|
| 43 |
+
exact Set.disjoint_left.mp (E.assembled_other_edge_avoids_crossingDisk v hv p q hpq hm e hep heq)
|
| 44 |
+
hx (C.reconnection_avoids_chord_meeting p q hpq x hxp hxq).1)
|
| 45 |
+
have hnot : x ∉ crossingPoints (adjacentSurgeryDrawing Kp Kq hm hadj hv hemb) := by
|
| 46 |
+
rintro ⟨e,f,hef,hxe,hxf⟩
|
| 47 |
+
exact hremoved e (edgeInterior_subset_range _ e hxe)
|
| 48 |
+
refine ⟨hfinite.subset hsub,Set.ncard_lt_ncard ⟨hsub,?_⟩ hfinite⟩
|
| 49 |
+
intro hrev
|
| 50 |
+
exact hnot (hrev (E.crossingChord_meeting_is_assembled_crossing v hvinj hv hdet hpq x hxp hxq))
|
| 51 |
+
|
| 52 |
+
end Zarankiewicz.PolygonalExterior
|
| 53 |
+
|
| 54 |
+
end
|
| 55 |
+
|
| 56 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/TangentTrackIdentity.lean
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.CircleOffsetLine
|
| 2 |
+
import OAI.Combinatorics.Crossing.CircleConnectors
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
namespace Zarankiewicz
|
| 8 |
+
|
| 9 |
+
theorem det2_rotateQuarter_self (d : Plane) : det2 d (rotateQuarter d)=squaredLength d := by
|
| 10 |
+
dsimp [det2,rotateQuarter,squaredLength]
|
| 11 |
+
ring
|
| 12 |
+
|
| 13 |
+
theorem normalShift_eq_circleTrackScale (d w : Plane) (hd : d ≠ 0) (hw : w ≠ 0)
|
| 14 |
+
(hpar : det2 d w=0) : normalShift d=circleTrackScale d w • rotateQuarter w := by
|
| 15 |
+
let c := dot2 d w/squaredLength d
|
| 16 |
+
have hp : w=c • d := vector_parallel_of_det_zero d w hd hpar
|
| 17 |
+
have hc : c ≠ 0 := by
|
| 18 |
+
intro h
|
| 19 |
+
rw [h,zero_smul] at hp
|
| 20 |
+
exact hw hp
|
| 21 |
+
have hrot : rotateQuarter w=c • rotateQuarter d := by
|
| 22 |
+
rw [hp]
|
| 23 |
+
apply Prod.ext
|
| 24 |
+
· dsimp [rotateQuarter]
|
| 25 |
+
ring
|
| 26 |
+
· rfl
|
| 27 |
+
have hL := ne_of_gt (squaredLength_pos d hd)
|
| 28 |
+
unfold normalShift circleTrackScale
|
| 29 |
+
rw [hrot,det2_smul_right,det2_rotateQuarter_self,smul_smul]
|
| 30 |
+
congr 1
|
| 31 |
+
field_simp
|
| 32 |
+
|
| 33 |
+
theorem similarity_circleTangentOffset (o u v : Plane) (δ : ℝ) :
|
| 34 |
+
similarityPoint o u (circleTangentOffset v δ)=
|
| 35 |
+
similarityPoint o u v+δ • rotateQuarter (similarityPoint o u v-o) := by
|
| 36 |
+
apply Prod.ext <;> dsimp [similarityPoint,circleTangentOffset,rotateQuarter] <;> ring
|
| 37 |
+
|
| 38 |
+
theorem tangentOffset_eq_normalShift (o u v d : Plane) (hd : d ≠ 0)
|
| 39 |
+
(hw : similarityPoint o u v-o ≠ 0) (hpar : det2 d (similarityPoint o u v-o)=0)
|
| 40 |
+
(ε : ℝ) :
|
| 41 |
+
similarityPoint o u (circleTangentOffset v (circleTrackScale d (similarityPoint o u v-o)*ε))=
|
| 42 |
+
similarityPoint o u v+ε • normalShift d := by
|
| 43 |
+
rw [similarity_circleTangentOffset,normalShift_eq_circleTrackScale d _ hd hw hpar,smul_smul]
|
| 44 |
+
congr 2
|
| 45 |
+
ring
|
| 46 |
+
|
| 47 |
+
theorem similarityPoint_squaredLength (o u x : Plane) :
|
| 48 |
+
squaredLength (similarityPoint o u x-o)=squaredLength u*squaredLength x := by
|
| 49 |
+
dsimp [similarityPoint,squaredLength]
|
| 50 |
+
ring
|
| 51 |
+
|
| 52 |
+
theorem physical_circleConnector_strictly_outside (o u v : Plane) (hu : u ≠ 0)
|
| 53 |
+
(hv : squaredLength v=1) (δ : ℝ) (hδ : |δ|<1) (hne : δ ≠ 0)
|
| 54 |
+
(t : ℝ) (ht : 0<t) :
|
| 55 |
+
squaredLength u < squaredLength
|
| 56 |
+
(segmentPoint (similarityPoint o u (circleOffset v δ))
|
| 57 |
+
(similarityPoint o u (circleTangentOffset v δ)) t-o) := by
|
| 58 |
+
rw [← similarityPoint_segment,similarityPoint_squaredLength]
|
| 59 |
+
have hh := circleConnector_strictly_outside v hv δ hδ hne t ht
|
| 60 |
+
nlinarith [squaredLength_pos u hu]
|
| 61 |
+
|
| 62 |
+
end Zarankiewicz
|
| 63 |
+
|
| 64 |
+
end
|
| 65 |
+
|
| 66 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/TrackChordSeparation.lean
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.RoundDiskChords
|
| 2 |
+
import OAI.Combinatorics.Crossing.PhysicalVertexChords
|
| 3 |
+
import OAI.Combinatorics.Crossing.SpokePieceIsolation
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
noncomputable section
|
| 8 |
+
namespace Zarankiewicz
|
| 9 |
+
namespace VertexTruncation
|
| 10 |
+
variable {m n : ℕ} {D : ContinuousDrawing m n} (V : VertexTruncation D)
|
| 11 |
+
|
| 12 |
+
theorem track_in_disk_is_port (j : BipartiteVertex m n) (e : BipartiteEdge m n) (x : Plane)
|
| 13 |
+
(hx : x ∈ Set.range (V.path e)) (hmem : x ∈ closedRoundDisk (D.vertex j) V.radius) :
|
| 14 |
+
∃ f : IncidentEdges j, x=V.spokePort j f := by
|
| 15 |
+
rcases V.vertex_disk_cases j e x hx with ⟨hj,he⟩ | ⟨hj,he⟩ | hout
|
| 16 |
+
· refine ⟨⟨e,Or.inl hj⟩,?_⟩
|
| 17 |
+
simpa only [spokePort,drawingSpokePort,ite_eq_left hj,startPort] using he
|
| 18 |
+
· have hnot : j ≠ Sum.inl e.1 := by
|
| 19 |
+
intro hh
|
| 20 |
+
cases hh.symm.trans hj
|
| 21 |
+
refine ⟨⟨e,Or.inr hj⟩,?_⟩
|
| 22 |
+
simpa only [spokePort,drawingSpokePort,ite_eq_right hnot,endPort] using he
|
| 23 |
+
· exact False.elim (not_lt_of_ge hmem hout)
|
| 24 |
+
|
| 25 |
+
end VertexTruncation
|
| 26 |
+
namespace TruncatedSpokeCoordinates
|
| 27 |
+
variable {m n : ℕ} {D : ContinuousDrawing m n} {V : VertexTruncation D}
|
| 28 |
+
(C : TruncatedSpokeCoordinates V)
|
| 29 |
+
|
| 30 |
+
theorem track_shifted_chord_disjoint (j : BipartiteVertex m n) (c d : IncidentEdges j)
|
| 31 |
+
(ε : ℝ) (hc : |V.spokeScale j c*ε|≤1) (hd : |V.spokeScale j d*ε|≤1)
|
| 32 |
+
(hsep : ∀ f g : IncidentEdges j, V.spokePort j f ≠ C.shiftedPort j g ε)
|
| 33 |
+
(e : BipartiteEdge m n) (i : Fin (V.pieces e)) :
|
| 34 |
+
¬ ClosedSegmentsMeet (V.vertices e i.val) (V.vertices e (i.val+1))
|
| 35 |
+
(C.shiftedPort j c ε) (C.shiftedPort j d ε) := by
|
| 36 |
+
intro hmeet
|
| 37 |
+
obtain ⟨x,hx,hy⟩ := (closedSegmentsMeet_iff_nonempty_inter _ _ _ _).mp hmeet
|
| 38 |
+
have hcirclec := C.shiftedPort_circle j c ε hc
|
| 39 |
+
have hcircled := C.shiftedPort_circle j d ε hd
|
| 40 |
+
have hmem := round_chord_subset_closed_disk (D.vertex j) _ _ V.radius hcirclec hcircled hy
|
| 41 |
+
obtain ⟨f,hf⟩ := V.track_in_disk_is_port j e x (V.piece_subset_range e i.val i.isLt hx) hmem
|
| 42 |
+
have hboundary : squaredLength (x-D.vertex j)=V.radius^2 := by rw [hf,V.spokePort_circle]
|
| 43 |
+
rcases round_chord_boundary_endpoints (D.vertex j) _ _ x V.radius hcirclec hcircled hy hboundary with h | h
|
| 44 |
+
· exact hsep f c (hf.symm.trans h)
|
| 45 |
+
· exact hsep f d (hf.symm.trans h)
|
| 46 |
+
|
| 47 |
+
end TruncatedSpokeCoordinates
|
| 48 |
+
end Zarankiewicz
|
| 49 |
+
|
| 50 |
+
end
|
| 51 |
+
|
| 52 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/TrackEndpointConnections.lean
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.TruncatedSpokeCoordinates
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
namespace Zarankiewicz.VertexTruncation
|
| 7 |
+
variable {m n : ℕ} {D : ContinuousDrawing m n} (V : VertexTruncation D)
|
| 8 |
+
|
| 9 |
+
def leftIncident (_V : VertexTruncation D) (e : BipartiteEdge m n) : IncidentEdges (m:=m) (n:=n) (Sum.inl e.1) := ⟨e,Or.inl rfl⟩
|
| 10 |
+
def rightIncident (_V : VertexTruncation D) (e : BipartiteEdge m n) : IncidentEdges (m:=m) (n:=n) (Sum.inr e.2) := ⟨e,Or.inr rfl⟩
|
| 11 |
+
|
| 12 |
+
theorem vertices_first (e : BipartiteEdge m n) : V.vertices e 0=V.startPort e :=
|
| 13 |
+
(V.chain e).truncatedVertices_first V.radius
|
| 14 |
+
|
| 15 |
+
theorem vertices_last (e : BipartiteEdge m n) : V.vertices e (V.pieces e)=V.endPort e :=
|
| 16 |
+
(V.chain e).truncatedVertices_last (V.pieces_pos e) V.radius
|
| 17 |
+
|
| 18 |
+
theorem spokePort_left (e : BipartiteEdge m n) :
|
| 19 |
+
V.spokePort (Sum.inl e.1) (V.leftIncident e)=V.startPort e := by
|
| 20 |
+
simp [spokePort,drawingSpokePort,leftIncident,startPort]
|
| 21 |
+
|
| 22 |
+
theorem spokePort_right (e : BipartiteEdge m n) :
|
| 23 |
+
V.spokePort (Sum.inr e.2) (V.rightIncident e)=V.endPort e := by
|
| 24 |
+
simp [spokePort,drawingSpokePort,rightIncident,endPort]
|
| 25 |
+
|
| 26 |
+
theorem shiftedTrack_first (C : TruncatedSpokeCoordinates V) (e : BipartiteEdge m n) (ε : ℝ) :
|
| 27 |
+
shiftedTrack (V.vertices e) (V.pieces e) ε 0=
|
| 28 |
+
C.tangentPort (Sum.inl e.1) (V.leftIncident e) ε := by
|
| 29 |
+
simp [shiftedTrack,trackOffset,TruncatedSpokeCoordinates.tangentPort,spokeDirection,
|
| 30 |
+
spokeIndex,leftIncident,V.vertices_first,spokePort,drawingSpokePort,startPort]
|
| 31 |
+
|
| 32 |
+
theorem shiftedTrack_last (C : TruncatedSpokeCoordinates V) (e : BipartiteEdge m n) (ε : ℝ) :
|
| 33 |
+
shiftedTrack (V.vertices e) (V.pieces e) ε (V.pieces e)=
|
| 34 |
+
C.tangentPort (Sum.inr e.2) (V.rightIncident e) ε := by
|
| 35 |
+
have hn : V.pieces e ≠ 0 := ne_of_gt (V.pieces_pos e)
|
| 36 |
+
simp [shiftedTrack,trackOffset,hn,TruncatedSpokeCoordinates.tangentPort,spokeDirection,
|
| 37 |
+
spokeIndex,rightIncident,V.vertices_last,spokePort,drawingSpokePort,endPort]
|
| 38 |
+
|
| 39 |
+
end Zarankiewicz.VertexTruncation
|
| 40 |
+
|
| 41 |
+
end
|
| 42 |
+
|
| 43 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/TransversalityStability.lean
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.SegmentContinuity
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
namespace Zarankiewicz
|
| 7 |
+
open scoped Topology Classical
|
| 8 |
+
|
| 9 |
+
theorem segmentPairTransverse_of_proper (a b c d : Plane) (h : SegmentsCrossProperly a b c d) :
|
| 10 |
+
SegmentPairTransverse a b c d := by
|
| 11 |
+
obtain ⟨hn,t₀,ht₀,u₀,hu₀,he₀⟩ := h
|
| 12 |
+
intro t ht u hu he
|
| 13 |
+
obtain ⟨rfl,rfl⟩ := segment_intersection_parameters_unique a b c d hn t u t₀ u₀ he he₀
|
| 14 |
+
exact ⟨hn,ht₀,hu₀⟩
|
| 15 |
+
|
| 16 |
+
theorem segmentPairTransverse_swap (a b c d : Plane) (h : SegmentPairTransverse a b c d) :
|
| 17 |
+
SegmentPairTransverse c d a b := by
|
| 18 |
+
intro t ht u hu he
|
| 19 |
+
obtain ⟨hn,hu',ht'⟩ := h u hu t ht he.symm
|
| 20 |
+
refine ⟨?_,ht',hu'⟩
|
| 21 |
+
rw [det2_swap]
|
| 22 |
+
exact neg_ne_zero.mpr hn
|
| 23 |
+
|
| 24 |
+
theorem eventually_segmentPairTransverse (a b c d : Plane) (h : SegmentPairTransverse a b c d) :
|
| 25 |
+
∀ᶠ ab : Plane × Plane in 𝓝 (a,b), SegmentPairTransverse ab.1 ab.2 c d := by
|
| 26 |
+
by_cases hc : SegmentsCrossProperly a b c d
|
| 27 |
+
· have hsign : segmentCrossingSign a b c d ≠ 0 := by
|
| 28 |
+
unfold segmentCrossingSign
|
| 29 |
+
rw [ite_eq_left hc]
|
| 30 |
+
split_ifs <;> norm_num
|
| 31 |
+
filter_upwards [eventually_segmentCrossingSign_of_proper a b c d hc] with ab hab
|
| 32 |
+
apply segmentPairTransverse_of_proper
|
| 33 |
+
by_contra hn
|
| 34 |
+
have hz : segmentCrossingSign ab.1 ab.2 c d = 0 := by simp [segmentCrossingSign,hn]
|
| 35 |
+
exact hsign (hab.symm.trans hz)
|
| 36 |
+
· have hn : ¬ ClosedSegmentsMeet a b c d := by
|
| 37 |
+
rintro ⟨t,ht,u,hu,he⟩
|
| 38 |
+
obtain ⟨hd,ht',hu'⟩ := h t ht u hu he
|
| 39 |
+
exact hc ⟨hd,t,ht',u,hu',he⟩
|
| 40 |
+
have hevent := (isClosed_closedSegmentsMeet c d).isOpen_compl.mem_nhds
|
| 41 |
+
(show (a,b) ∈ {ab : Plane × Plane | ClosedSegmentsMeet ab.1 ab.2 c d}ᶜ from hn)
|
| 42 |
+
filter_upwards [hevent] with ab hab
|
| 43 |
+
intro t ht u hu he
|
| 44 |
+
exact False.elim (hab ⟨t,ht,u,hu,he⟩)
|
| 45 |
+
|
| 46 |
+
end Zarankiewicz
|
| 47 |
+
|
| 48 |
+
end
|
| 49 |
+
|
| 50 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/TransversePolygonIntersection.lean
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.GenericPolygonIntersection
|
| 2 |
+
import OAI.Combinatorics.Crossing.GenericPointFamily
|
| 3 |
+
import OAI.Combinatorics.Crossing.PolygonStability
|
| 4 |
+
import OAI.Combinatorics.Crossing.PeriodicPolygon
|
| 5 |
+
|
| 6 |
+
namespace OAI
|
| 7 |
+
|
| 8 |
+
noncomputable section
|
| 9 |
+
namespace Zarankiewicz
|
| 10 |
+
|
| 11 |
+
theorem segmentCrossingSign_self_left (a c d : Plane) : segmentCrossingSign a a c d = 0 := by
|
| 12 |
+
simp [segmentCrossingSign,SegmentsCrossProperly,det2]
|
| 13 |
+
|
| 14 |
+
theorem polygon_intersection_zero_transverse (v w : ℕ → Plane) (n m : ℕ)
|
| 15 |
+
(hc : v n=v 0) (hd : w m=w 0)
|
| 16 |
+
(hw : ∀ j : Fin m, w (j.val+1) ≠ w j.val)
|
| 17 |
+
(ht : ∀ i : Fin n, ∀ j : Fin m,
|
| 18 |
+
SegmentPairTransverse (v i.val) (v (i.val+1)) (w j.val) (w (j.val+1))) :
|
| 19 |
+
polygonIntersection v w n m = 0 := by
|
| 20 |
+
by_cases hn : 1<n
|
| 21 |
+
· have hn0 : 0<n := by omega
|
| 22 |
+
obtain ⟨ε,hε,hstable⟩ := exists_polygon_intersection_stability_radius v w n m ht
|
| 23 |
+
obtain ⟨p,hnear,hinj,hpq,hline,hpar,hcorn⟩ := exists_generic_point_family
|
| 24 |
+
(fun j : Fin (m+1) => w j.val) (fun j : Fin m => w j.val)
|
| 25 |
+
(fun j : Fin m => w (j.val+1)-w j.val) (fun j => sub_ne_zero.mpr (hw j))
|
| 26 |
+
n (fun i => v i.val) (fun _ => ε) (fun _ => hε)
|
| 27 |
+
let v' := periodicPolygon n hn0 p
|
| 28 |
+
have hclose : v' n=v' 0 := periodicPolygon_closed n hn0 p
|
| 29 |
+
have hv' (i : Fin n) : v' (i.val+1) ≠ v' i.val :=
|
| 30 |
+
hinj.ne (cyclicIndex_succ_ne n hn i)
|
| 31 |
+
have hpoint (i : Fin (n+1)) (j : Fin (m+1)) : w j.val ≠ v' i.val := hpq _ j
|
| 32 |
+
have hposition : PolygonLinePosition v' w n m := by
|
| 33 |
+
refine ⟨?_,?_,?_⟩
|
| 34 |
+
· intro i j
|
| 35 |
+
exact hpar _ _ (Ne.symm (cyclicIndex_succ_ne n hn i)) j
|
| 36 |
+
· intro i j
|
| 37 |
+
change det2 (w (j.val+1)-w j.val) (p (cyclicIndex n hn0 i.val)-w j.val) ≠ 0
|
| 38 |
+
rw [det2_swap]
|
| 39 |
+
exact neg_ne_zero.mpr (hline _ j)
|
| 40 |
+
· intro i j
|
| 41 |
+
exact hcorn _ _ (Ne.symm (cyclicIndex_succ_ne n hn i)) j
|
| 42 |
+
have hzero := polygon_intersection_zero_in_line_position v' w n m hclose hd hv' hw hpoint hposition
|
| 43 |
+
have heq := hstable v' (periodicPolygon_near n hn0 v hc p ε hnear)
|
| 44 |
+
rwa [heq] at hzero
|
| 45 |
+
· have hn' : n=0 ∨ n=1 := by omega
|
| 46 |
+
rcases hn' with rfl | rfl
|
| 47 |
+
· simp [polygonIntersection]
|
| 48 |
+
· simp only [polygonIntersection,Finset.sum_range_one]
|
| 49 |
+
rw [hc]
|
| 50 |
+
simp only [segmentCrossingSign_self_left,Finset.sum_const_zero]
|
| 51 |
+
|
| 52 |
+
end Zarankiewicz
|
| 53 |
+
|
| 54 |
+
end
|
| 55 |
+
|
| 56 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/TriangleEntryExit.lean
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.TriangleSideEvent
|
| 2 |
+
import OAI.Combinatorics.Crossing.SortedSideEvents
|
| 3 |
+
import OAI.Combinatorics.Crossing.PolygonalWalks
|
| 4 |
+
import Mathlib.Tactic.FinCases
|
| 5 |
+
|
| 6 |
+
namespace OAI
|
| 7 |
+
|
| 8 |
+
noncomputable section
|
| 9 |
+
namespace Zarankiewicz
|
| 10 |
+
open scoped BigOperators Classical
|
| 11 |
+
|
| 12 |
+
def triangleStart (a b c : Plane) : Fin 3 → Plane := ![a,b,c]
|
| 13 |
+
def triangleEnd (a b c : Plane) : Fin 3 → Plane := ![b,c,a]
|
| 14 |
+
def triangleIndicator (a b c z : Plane) : ℝ :=
|
| 15 |
+
∏ i : Fin 3, positiveIndicator (orient2 (triangleStart a b c i) (triangleEnd a b c i) z)
|
| 16 |
+
|
| 17 |
+
theorem triangle_area_cycle (a b c : Plane) : orient2 b c a = orient2 a b c := by
|
| 18 |
+
dsimp [orient2,det2]
|
| 19 |
+
ring
|
| 20 |
+
|
| 21 |
+
theorem affine_side_factor (a b c d : Plane) (hn : det2 (b-a) (d-c) ≠ 0) (t : ℝ) :
|
| 22 |
+
orient2 a b (segmentPoint c d t) =
|
| 23 |
+
det2 (b-a) (d-c) * (t-secondIntersectionParameter a b c d) := by
|
| 24 |
+
rw [orient2_segment]
|
| 25 |
+
change (1-t)*orient2 a b c+t*orient2 a b d =
|
| 26 |
+
det2 (b-a) (d-c)*(t-(-orient2 a b c / det2 (b-a) (d-c)))
|
| 27 |
+
field_simp
|
| 28 |
+
linear_combination t * (orient2_difference a b c d)
|
| 29 |
+
|
| 30 |
+
theorem triangle_segment_entry_exit (a b c d e : Plane)
|
| 31 |
+
(harea : 0 < orient2 a b c)
|
| 32 |
+
(hn : ∀ i : Fin 3, det2 (triangleEnd a b c i-triangleStart a b c i) (e-d) ≠ 0)
|
| 33 |
+
(hr : Function.Injective (fun i : Fin 3 =>
|
| 34 |
+
secondIntersectionParameter (triangleStart a b c i) (triangleEnd a b c i) d e))
|
| 35 |
+
(h0 : ∀ i : Fin 3, secondIntersectionParameter (triangleStart a b c i) (triangleEnd a b c i) d e ≠ 0)
|
| 36 |
+
(h1 : ∀ i : Fin 3, secondIntersectionParameter (triangleStart a b c i) (triangleEnd a b c i) d e ≠ 1) :
|
| 37 |
+
triangleSegmentIntersection a b c d e = triangleIndicator a b c e-triangleIndicator a b c d := by
|
| 38 |
+
let r := fun i : Fin 3 => secondIntersectionParameter (triangleStart a b c i) (triangleEnd a b c i) d e
|
| 39 |
+
let b' := fun i : Fin 3 => det2 (triangleEnd a b c i-triangleStart a b c i) (e-d)
|
| 40 |
+
have hf (i : Fin 3) (t : ℝ) : b' i*(t-r i) =
|
| 41 |
+
orient2 (triangleStart a b c i) (triangleEnd a b c i) (segmentPoint d e t) :=
|
| 42 |
+
(affine_side_factor _ _ d e (hn i) t).symm
|
| 43 |
+
have hc1 : 0 < orient2 b c a := by rwa [triangle_area_cycle]
|
| 44 |
+
have hc2 : 0 < orient2 c a b := by rwa [triangle_area_cycle,triangle_area_cycle]
|
| 45 |
+
have hs (i : Fin 3) :
|
| 46 |
+
segmentCrossingSign (triangleStart a b c i) (triangleEnd a b c i) d e =
|
| 47 |
+
if 0<r i ∧ r i<1 then slopeSign (b' i) *
|
| 48 |
+
(∏ j : Fin 3, if j=i then 1 else positiveIndicator
|
| 49 |
+
(orient2 (triangleStart a b c j) (triangleEnd a b c j) (segmentPoint d e (r i)))) else 0 := by
|
| 50 |
+
fin_cases i
|
| 51 |
+
· simpa [r,b',triangleStart,triangleEnd,Fin.prod_univ_succ] using
|
| 52 |
+
segmentCrossingSign_triangle_event a b c d e harea (hn 0)
|
| 53 |
+
· simpa [r,b',triangleStart,triangleEnd,Fin.prod_univ_succ,mul_comm] using
|
| 54 |
+
segmentCrossingSign_triangle_event b c a d e hc1 (hn 1)
|
| 55 |
+
· simpa [r,b',triangleStart,triangleEnd,Fin.prod_univ_succ] using
|
| 56 |
+
segmentCrossingSign_triangle_event c a b d e hc2 (hn 2)
|
| 57 |
+
have h := sum_affine_side_events_unordered 3 r b' hr hn h0 h1
|
| 58 |
+
simp_rw [hf] at h
|
| 59 |
+
simp only [segmentPoint_one,segmentPoint_zero] at h
|
| 60 |
+
calc
|
| 61 |
+
triangleSegmentIntersection a b c d e =
|
| 62 |
+
∑ i : Fin 3, segmentCrossingSign (triangleStart a b c i) (triangleEnd a b c i) d e := by
|
| 63 |
+
simp [triangleSegmentIntersection,triangleStart,triangleEnd,Fin.sum_univ_succ]
|
| 64 |
+
ring
|
| 65 |
+
_ = _ := by simpa only [hs,triangleIndicator] using h
|
| 66 |
+
|
| 67 |
+
end Zarankiewicz
|
| 68 |
+
|
| 69 |
+
end
|
| 70 |
+
|
| 71 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/TriangleFactorization.lean
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.HalfOrderReduction
|
| 2 |
+
import OAI.Combinatorics.Crossing.WeightedGram
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
namespace Zarankiewicz
|
| 8 |
+
open scoped BigOperators
|
| 9 |
+
|
| 10 |
+
def triangleDiagonalWeight (s : ℕ) (node : OrderedNode s → ℝ) (j : BiExponent s) : ℝ :=
|
| 11 |
+
let pq := triangleNodePair s (triangleCoordEquiv s j)
|
| 12 |
+
triangleCoefficient s pq.1 pq.2 * detectorWeight node pq.1 pq.2
|
| 13 |
+
|
| 14 |
+
theorem triangleDiagonalWeight_ne_zero (s : ℕ) (node : OrderedNode s → ℝ)
|
| 15 |
+
(hn : Function.Injective node) (j : BiExponent s) : triangleDiagonalWeight s node j ≠ 0 := by
|
| 16 |
+
let pq := triangleNodePair s (triangleCoordEquiv s j)
|
| 17 |
+
have hmem : (pq.1.val,pq.2.val) ∈ twoTriangle s := (triangleCoordEquiv s j).property
|
| 18 |
+
have hpq : pq.1 ≠ pq.2 := by
|
| 19 |
+
intro he
|
| 20 |
+
have hv := congrArg Subtype.val he
|
| 21 |
+
rw [mem_twoTriangle] at hmem
|
| 22 |
+
omega
|
| 23 |
+
exact mul_ne_zero ((triangleCoefficient_ne_zero_iff s pq.1 pq.2).mpr hmem)
|
| 24 |
+
(detectorWeight_ne_zero node hn hpq)
|
| 25 |
+
|
| 26 |
+
theorem rankDetector_triangle_sum (s : ℕ) (node : OrderedNode s → ℝ) :
|
| 27 |
+
rankDetector s node (fun p q => triangleCoefficient s p q) =
|
| 28 |
+
∑ j : BiExponent s,
|
| 29 |
+
let pq := triangleNodePair s (triangleCoordEquiv s j)
|
| 30 |
+
triangleCoefficient s pq.1 pq.2 • detectorAtom s node pq.1 pq.2 := by
|
| 31 |
+
let f := fun pq : OrderedNode s × OrderedNode s =>
|
| 32 |
+
triangleCoefficient s pq.1 pq.2 • detectorAtom s node pq.1 pq.2
|
| 33 |
+
have hfull : rankDetector s node (fun p q => triangleCoefficient s p q) = ∑ pq, f pq :=
|
| 34 |
+
(Fintype.sum_prod_type f).symm
|
| 35 |
+
have hfilter : (∑ pq ∈ orderedTriangle s, f pq) = ∑ pq, f pq := by
|
| 36 |
+
apply Finset.sum_subset (Finset.filter_subset _ _)
|
| 37 |
+
intro pq hpq hnot
|
| 38 |
+
have hm : (pq.1.val,pq.2.val) ∉ twoTriangle s := by simpa [orderedTriangle] using hnot
|
| 39 |
+
have hz : triangleCoefficient s pq.1 pq.2 = 0 :=
|
| 40 |
+
not_ne_iff.mp (mt (triangleCoefficient_ne_zero_iff s pq.1 pq.2).mp hm)
|
| 41 |
+
simp only [f, hz, zero_smul]
|
| 42 |
+
rw [hfull, ← hfilter, ← Finset.sum_coe_sort]
|
| 43 |
+
exact ((triangleCoordEquiv s).trans (triangleNodeEquiv s)).sum_comp
|
| 44 |
+
(fun pq : ↥(orderedTriangle s) => f pq.val) |>.symm
|
| 45 |
+
|
| 46 |
+
theorem rankDetector_triangle_factorization (s : ℕ) (node : OrderedNode s → ℝ) :
|
| 47 |
+
rankDetector s node (fun p q => triangleCoefficient s p q) =
|
| 48 |
+
triangleMatrix s (extendOrderedNode s node) * Matrix.diagonal (triangleDiagonalWeight s node) *
|
| 49 |
+
(triangleMatrix s (extendOrderedNode s node)).transpose := by
|
| 50 |
+
rw [rankDetector_triangle_sum, weightedGram_eq_sum]
|
| 51 |
+
apply Finset.sum_congr rfl
|
| 52 |
+
intro j hj
|
| 53 |
+
simp only [triangleDiagonalWeight, detectorAtom, smul_smul]
|
| 54 |
+
congr 2
|
| 55 |
+
· funext ab
|
| 56 |
+
exact (triangleMatrix_ordered_entry s node ab j).symm
|
| 57 |
+
· funext ab
|
| 58 |
+
exact (triangleMatrix_ordered_entry s node ab j).symm
|
| 59 |
+
|
| 60 |
+
theorem rankDetector_ordered_isUnit (s : ℕ) (node : OrderedNode s → ℝ)
|
| 61 |
+
(hn : Function.Injective node) :
|
| 62 |
+
IsUnit (rankDetector s node (halfOrderMatrix (OrderedNode s))) := by
|
| 63 |
+
rw [rankDetector_halfOrder_reduction s node hn]
|
| 64 |
+
apply IsUnit.neg
|
| 65 |
+
change IsUnit (rankDetector s node (fun p q => triangleCoefficient s p q))
|
| 66 |
+
rw [rankDetector_triangle_factorization]
|
| 67 |
+
exact weightedGram_isUnit _ _
|
| 68 |
+
(triangleMatrix_isUnit s (extendOrderedNode s node) (extendOrderedNode_injOn s node hn))
|
| 69 |
+
(triangleDiagonalWeight_ne_zero s node hn)
|
| 70 |
+
|
| 71 |
+
end Zarankiewicz
|
| 72 |
+
|
| 73 |
+
end
|
| 74 |
+
|
| 75 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/TriangleOrientations.lean
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.TriangleTransversality
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
namespace Zarankiewicz
|
| 7 |
+
open scoped BigOperators Classical
|
| 8 |
+
|
| 9 |
+
theorem orient2_reverse_edge (a b c : Plane) : orient2 b a c = -orient2 a b c := by
|
| 10 |
+
dsimp [orient2,det2]
|
| 11 |
+
ring
|
| 12 |
+
|
| 13 |
+
theorem det2_reverse_edge (a b c d : Plane) : det2 (a-b) (d-c) = -det2 (b-a) (d-c) := by
|
| 14 |
+
dsimp [det2]
|
| 15 |
+
ring
|
| 16 |
+
|
| 17 |
+
theorem triangle_position_reverse (a b c d e : Plane)
|
| 18 |
+
(h : TriangleSegmentPosition a b c d e) : TriangleSegmentPosition a c b d e := by
|
| 19 |
+
refine ⟨?_,?_,?_⟩
|
| 20 |
+
· intro i
|
| 21 |
+
fin_cases i
|
| 22 |
+
· change det2 (c-a) (e-d) ≠ 0
|
| 23 |
+
rw [det2_reverse_edge c a d e]
|
| 24 |
+
exact neg_ne_zero.mpr (h.1 2)
|
| 25 |
+
· change det2 (b-c) (e-d) ≠ 0
|
| 26 |
+
rw [det2_reverse_edge b c d e]
|
| 27 |
+
exact neg_ne_zero.mpr (h.1 1)
|
| 28 |
+
· change det2 (a-b) (e-d) ≠ 0
|
| 29 |
+
rw [det2_reverse_edge a b d e]
|
| 30 |
+
exact neg_ne_zero.mpr (h.1 0)
|
| 31 |
+
· intro i
|
| 32 |
+
fin_cases i
|
| 33 |
+
· exact h.2.1 0
|
| 34 |
+
· exact h.2.1 2
|
| 35 |
+
· exact h.2.1 1
|
| 36 |
+
· intro i
|
| 37 |
+
fin_cases i
|
| 38 |
+
· change orient2 a c d ≠ 0 ∧ orient2 a c e ≠ 0
|
| 39 |
+
rw [orient2_reverse_edge c a d,orient2_reverse_edge c a e]
|
| 40 |
+
exact ⟨neg_ne_zero.mpr (h.2.2 2).1,neg_ne_zero.mpr (h.2.2 2).2⟩
|
| 41 |
+
· change orient2 c b d ≠ 0 ∧ orient2 c b e ≠ 0
|
| 42 |
+
rw [orient2_reverse_edge b c d,orient2_reverse_edge b c e]
|
| 43 |
+
exact ⟨neg_ne_zero.mpr (h.2.2 1).1,neg_ne_zero.mpr (h.2.2 1).2⟩
|
| 44 |
+
· change orient2 b a d ≠ 0 ∧ orient2 b a e ≠ 0
|
| 45 |
+
rw [orient2_reverse_edge a b d,orient2_reverse_edge a b e]
|
| 46 |
+
exact ⟨neg_ne_zero.mpr (h.2.2 0).1,neg_ne_zero.mpr (h.2.2 0).2⟩
|
| 47 |
+
|
| 48 |
+
theorem triangle_intersection_reverse (a b c d e : Plane) :
|
| 49 |
+
triangleSegmentIntersection a c b d e = -triangleSegmentIntersection a b c d e := by
|
| 50 |
+
unfold triangleSegmentIntersection
|
| 51 |
+
rw [segmentCrossingSign_reverse_left c a d e,
|
| 52 |
+
segmentCrossingSign_reverse_left b c d e,segmentCrossingSign_reverse_left a b d e]
|
| 53 |
+
ring
|
| 54 |
+
|
| 55 |
+
def orientedTriangleIndicator (a b c z : Plane) : ℝ :=
|
| 56 |
+
if 0 < orient2 a b c then triangleIndicator a b c z else -triangleIndicator a c b z
|
| 57 |
+
|
| 58 |
+
theorem oriented_triangle_entry_exit (a b c d e : Plane) (ha : orient2 a b c ≠ 0)
|
| 59 |
+
(h : TriangleSegmentPosition a b c d e) :
|
| 60 |
+
triangleSegmentIntersection a b c d e =
|
| 61 |
+
orientedTriangleIndicator a b c e-orientedTriangleIndicator a b c d := by
|
| 62 |
+
rcases lt_or_gt_of_ne ha with ha | ha
|
| 63 |
+
· have hac : 0 < orient2 a c b := by
|
| 64 |
+
rw [triangle_area_cycle b a c,orient2_reverse_edge]
|
| 65 |
+
exact neg_pos.mpr ha
|
| 66 |
+
have hh := triangle_segment_entry_exit_of_position a c b d e hac (triangle_position_reverse a b c d e h)
|
| 67 |
+
rw [triangle_intersection_reverse] at hh
|
| 68 |
+
simp only [orientedTriangleIndicator,not_lt.mpr ha.le,ite_false]
|
| 69 |
+
linarith
|
| 70 |
+
· simpa only [orientedTriangleIndicator,ha,ite_true] using triangle_segment_entry_exit_of_position a b c d e ha h
|
| 71 |
+
|
| 72 |
+
theorem triangle_closed_walk_intersection_zero (a b c : Plane) (ha : orient2 a b c ≠ 0)
|
| 73 |
+
(w : ℕ → Plane) (m : ℕ) (hw : w m = w 0)
|
| 74 |
+
(h : ∀ j ∈ Finset.range m, TriangleSegmentPosition a b c (w j) (w (j+1))) :
|
| 75 |
+
(∑ j ∈ Finset.range m, triangleSegmentIntersection a b c (w j) (w (j+1))) = 0 := by
|
| 76 |
+
have hs := telescoping_real_sum (fun j => orientedTriangleIndicator a b c (w j)) m
|
| 77 |
+
rw [hw,sub_self,Finset.sum_sub_distrib] at hs
|
| 78 |
+
calc
|
| 79 |
+
_ = ∑ j ∈ Finset.range m,
|
| 80 |
+
(orientedTriangleIndicator a b c (w (j+1))-orientedTriangleIndicator a b c (w j)) := by
|
| 81 |
+
apply Finset.sum_congr rfl
|
| 82 |
+
intro j hj
|
| 83 |
+
exact oriented_triangle_entry_exit a b c _ _ ha (h j hj)
|
| 84 |
+
_ = 0 := by rw [Finset.sum_sub_distrib]; linarith
|
| 85 |
+
|
| 86 |
+
end Zarankiewicz
|
| 87 |
+
|
| 88 |
+
end
|
| 89 |
+
|
| 90 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/TriangleSideEvent.lean
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.SegmentSides
|
| 2 |
+
import OAI.Combinatorics.Crossing.AffineSideEvents
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
namespace Zarankiewicz
|
| 8 |
+
open scoped Classical
|
| 9 |
+
|
| 10 |
+
theorem triangle_side_at_first_edge (a b c : Plane) (t : ℝ) :
|
| 11 |
+
orient2 b c (segmentPoint a b t) = (1-t)*orient2 a b c := by
|
| 12 |
+
dsimp [orient2,det2,segmentPoint]
|
| 13 |
+
ring
|
| 14 |
+
|
| 15 |
+
theorem triangle_other_side_at_first_edge (a b c : Plane) (t : ℝ) :
|
| 16 |
+
orient2 c a (segmentPoint a b t) = t*orient2 a b c := by
|
| 17 |
+
dsimp [orient2,det2,segmentPoint]
|
| 18 |
+
ring
|
| 19 |
+
|
| 20 |
+
theorem triangle_edge_side_tests (a b c d e : Plane)
|
| 21 |
+
(harea : 0 < orient2 a b c) (hn : det2 (b-a) (e-d) ≠ 0) :
|
| 22 |
+
(0 < orient2 b c (segmentPoint d e (secondIntersectionParameter a b d e)) ↔
|
| 23 |
+
firstIntersectionParameter a b d e < 1) ∧
|
| 24 |
+
(0 < orient2 c a (segmentPoint d e (secondIntersectionParameter a b d e)) ↔
|
| 25 |
+
0 < firstIntersectionParameter a b d e) := by
|
| 26 |
+
rw [← intersection_parameters_eq a b d e hn,
|
| 27 |
+
triangle_side_at_first_edge, triangle_other_side_at_first_edge]
|
| 28 |
+
constructor
|
| 29 |
+
· rw [mul_pos_iff_of_pos_right harea]
|
| 30 |
+
constructor <;> intro h <;> linarith
|
| 31 |
+
· exact mul_pos_iff_of_pos_right harea
|
| 32 |
+
|
| 33 |
+
theorem segmentCrossingSign_triangle_event (a b c d e : Plane)
|
| 34 |
+
(harea : 0 < orient2 a b c) (hn : det2 (b-a) (e-d) ≠ 0) :
|
| 35 |
+
segmentCrossingSign a b d e =
|
| 36 |
+
if 0 < secondIntersectionParameter a b d e ∧ secondIntersectionParameter a b d e < 1 then
|
| 37 |
+
slopeSign (det2 (b-a) (e-d)) *
|
| 38 |
+
(positiveIndicator (orient2 b c (segmentPoint d e (secondIntersectionParameter a b d e))) *
|
| 39 |
+
positiveIndicator (orient2 c a (segmentPoint d e (secondIntersectionParameter a b d e))))
|
| 40 |
+
else 0 := by
|
| 41 |
+
obtain ⟨hleft,hright⟩ := triangle_edge_side_tests a b c d e harea hn
|
| 42 |
+
rw [segmentCrossingSign, segmentsCrossProperly_iff_parameters a b d e hn]
|
| 43 |
+
simp only [Set.mem_Ioo,positiveIndicator,hleft,hright]
|
| 44 |
+
by_cases hu : 0 < secondIntersectionParameter a b d e ∧ secondIntersectionParameter a b d e < 1
|
| 45 |
+
· by_cases ht0 : 0 < firstIntersectionParameter a b d e <;>
|
| 46 |
+
by_cases ht1 : firstIntersectionParameter a b d e < 1 <;>
|
| 47 |
+
simp [hu,ht0,ht1,slopeSign]
|
| 48 |
+
· simp [hu]
|
| 49 |
+
|
| 50 |
+
end Zarankiewicz
|
| 51 |
+
|
| 52 |
+
end
|
| 53 |
+
|
| 54 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/TriangleTransversality.lean
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.TriangleEntryExit
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
namespace Zarankiewicz
|
| 7 |
+
|
| 8 |
+
def TriangleSegmentPosition (a b c d e : Plane) : Prop :=
|
| 9 |
+
(∀ i : Fin 3, det2 (triangleEnd a b c i-triangleStart a b c i) (e-d) ≠ 0) ∧
|
| 10 |
+
(∀ i : Fin 3, orient2 d e (triangleStart a b c i) ≠ 0) ∧
|
| 11 |
+
(∀ i : Fin 3, orient2 (triangleStart a b c i) (triangleEnd a b c i) d ≠ 0 ∧
|
| 12 |
+
orient2 (triangleStart a b c i) (triangleEnd a b c i) e ≠ 0)
|
| 13 |
+
|
| 14 |
+
theorem triangle_consecutive_roots_ne (a b c d e : Plane)
|
| 15 |
+
(ha : orient2 a b c ≠ 0) (h₀ : det2 (b-a) (e-d) ≠ 0)
|
| 16 |
+
(h₁ : det2 (c-b) (e-d) ≠ 0) (hb : orient2 d e b ≠ 0) :
|
| 17 |
+
secondIntersectionParameter a b d e ≠ secondIntersectionParameter b c d e := by
|
| 18 |
+
intro heq
|
| 19 |
+
have hz : orient2 b c (segmentPoint a b (firstIntersectionParameter a b d e)) = 0 := by
|
| 20 |
+
rw [intersection_parameters_eq a b d e h₀,heq,
|
| 21 |
+
← intersection_parameters_eq b c d e h₁,orient2_self_segment]
|
| 22 |
+
rw [triangle_side_at_first_edge] at hz
|
| 23 |
+
have ht : firstIntersectionParameter a b d e = 1 := by
|
| 24 |
+
have := (mul_eq_zero.mp hz).resolve_right ha
|
| 25 |
+
linarith
|
| 26 |
+
have hp := intersection_parameters_eq a b d e h₀
|
| 27 |
+
rw [ht,segmentPoint_one] at hp
|
| 28 |
+
apply hb
|
| 29 |
+
rw [hp,orient2_self_segment]
|
| 30 |
+
|
| 31 |
+
theorem second_parameter_ne_zero (a b c d : Plane)
|
| 32 |
+
(hn : det2 (b-a) (d-c) ≠ 0) (hc : orient2 a b c ≠ 0) :
|
| 33 |
+
secondIntersectionParameter a b c d ≠ 0 := by
|
| 34 |
+
intro h
|
| 35 |
+
have hh := affine_side_factor a b c d hn 0
|
| 36 |
+
rw [h,segmentPoint_zero] at hh
|
| 37 |
+
apply hc
|
| 38 |
+
simpa using hh
|
| 39 |
+
|
| 40 |
+
theorem second_parameter_ne_one (a b c d : Plane)
|
| 41 |
+
(hn : det2 (b-a) (d-c) ≠ 0) (hd : orient2 a b d ≠ 0) :
|
| 42 |
+
secondIntersectionParameter a b c d ≠ 1 := by
|
| 43 |
+
intro h
|
| 44 |
+
have hh := affine_side_factor a b c d hn 1
|
| 45 |
+
rw [h,segmentPoint_one] at hh
|
| 46 |
+
apply hd
|
| 47 |
+
simpa using hh
|
| 48 |
+
|
| 49 |
+
theorem triangle_roots_injective (a b c d e : Plane) (ha : orient2 a b c ≠ 0)
|
| 50 |
+
(h : TriangleSegmentPosition a b c d e) :
|
| 51 |
+
Function.Injective (fun i : Fin 3 =>
|
| 52 |
+
secondIntersectionParameter (triangleStart a b c i) (triangleEnd a b c i) d e) := by
|
| 53 |
+
have h₀ := triangle_consecutive_roots_ne a b c d e ha (h.1 0) (h.1 1) (h.2.1 1)
|
| 54 |
+
have ha₁ : orient2 b c a ≠ 0 := by rwa [triangle_area_cycle]
|
| 55 |
+
have ha₂ : orient2 c a b ≠ 0 := by rwa [triangle_area_cycle,triangle_area_cycle]
|
| 56 |
+
have h₁ := triangle_consecutive_roots_ne b c a d e ha₁ (h.1 1) (h.1 2) (h.2.1 2)
|
| 57 |
+
have h₂ := triangle_consecutive_roots_ne c a b d e ha₂ (h.1 2) (h.1 0) (h.2.1 0)
|
| 58 |
+
intro i j hij
|
| 59 |
+
fin_cases i <;> fin_cases j <;> simp_all [triangleStart,triangleEnd]
|
| 60 |
+
|
| 61 |
+
theorem triangle_segment_entry_exit_of_position (a b c d e : Plane)
|
| 62 |
+
(ha : 0 < orient2 a b c) (h : TriangleSegmentPosition a b c d e) :
|
| 63 |
+
triangleSegmentIntersection a b c d e = triangleIndicator a b c e-triangleIndicator a b c d := by
|
| 64 |
+
exact triangle_segment_entry_exit a b c d e ha h.1
|
| 65 |
+
(triangle_roots_injective a b c d e (ne_of_gt ha) h)
|
| 66 |
+
(fun i => second_parameter_ne_zero _ _ _ _ (h.1 i) (h.2.2 i).1)
|
| 67 |
+
(fun i => second_parameter_ne_one _ _ _ _ (h.1 i) (h.2.2 i).2)
|
| 68 |
+
|
| 69 |
+
end Zarankiewicz
|
| 70 |
+
|
| 71 |
+
end
|
| 72 |
+
|
| 73 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/TruncatedChainDirections.lean
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.TruncatedChainVertices
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
namespace Zarankiewicz.PolygonalChain
|
| 7 |
+
variable {O : Set Plane} {a b : Plane}
|
| 8 |
+
|
| 9 |
+
def truncatedScale (P : PolygonalChain O a b) (r : ℝ) (i : ℕ) : ℝ :=
|
| 10 |
+
1-(if i=0 then P.startFraction r else 0)-(if i+1=P.pieces then P.endFraction r else 0)
|
| 11 |
+
|
| 12 |
+
theorem truncated_start_formula (P : PolygonalChain O a b) (r : ℝ) (i : ℕ) (hi : i < P.pieces) :
|
| 13 |
+
P.truncatedVertices r i=P.vertices i+(if i=0 then P.startFraction r else 0) • trackDirection P.vertices i := by
|
| 14 |
+
by_cases h : i=0
|
| 15 |
+
· subst i
|
| 16 |
+
rw [truncatedVertices_first,startPort_eq_fraction]
|
| 17 |
+
rfl
|
| 18 |
+
· simp only [truncatedVertices,ite_eq_right h,ite_eq_right (show i ≠ P.pieces by omega),zero_smul,add_zero]
|
| 19 |
+
|
| 20 |
+
theorem truncated_end_formula (P : PolygonalChain O a b) (r : ℝ) (i : ℕ) (_hi : i < P.pieces) :
|
| 21 |
+
P.truncatedVertices r (i+1)=P.vertices (i+1)-(if i+1=P.pieces then P.endFraction r else 0) •
|
| 22 |
+
trackDirection P.vertices i := by
|
| 23 |
+
by_cases h : i+1=P.pieces
|
| 24 |
+
· have hh : i=P.pieces-1 := by omega
|
| 25 |
+
rw [h,truncatedVertices_last P (by omega) r,endPort_eq_fraction,ite_eq_left rfl]
|
| 26 |
+
simp only [trackDirection,hh,show P.pieces-1+1=P.pieces by omega]
|
| 27 |
+
· simp only [truncatedVertices,ite_eq_right (show i+1 ≠ 0 by omega),ite_eq_right h,zero_smul,sub_zero]
|
| 28 |
+
|
| 29 |
+
theorem truncated_direction (P : PolygonalChain O a b) (r : ℝ) (i : ℕ) (hi : i < P.pieces) :
|
| 30 |
+
trackDirection (P.truncatedVertices r) i=P.truncatedScale r i • trackDirection P.vertices i := by
|
| 31 |
+
change P.truncatedVertices r (i+1)-P.truncatedVertices r i=_
|
| 32 |
+
rw [truncated_end_formula P r i hi,truncated_start_formula P r i hi]
|
| 33 |
+
apply Prod.ext <;> dsimp [trackDirection,truncatedScale] <;> ring
|
| 34 |
+
|
| 35 |
+
theorem truncatedScale_pos (P : PolygonalChain O a b) (r : ℝ) (hr : 0 < r)
|
| 36 |
+
(hfirst : 4*r^2 < squaredLength (P.vertices 1-P.vertices 0))
|
| 37 |
+
(hlast : 4*r^2 < squaredLength (P.vertices P.pieces-P.vertices (P.pieces-1))) (i : ℕ) :
|
| 38 |
+
0 < P.truncatedScale r i := by
|
| 39 |
+
have hs := radialPort_parameter_half (P.vertices 0) (P.vertices 1) r hr hfirst
|
| 40 |
+
have he := radialPort_parameter_half (P.vertices (P.pieces-1)) (P.vertices P.pieces) r hr hlast
|
| 41 |
+
change 0 < P.startFraction r ∧ P.startFraction r < 1/2 at hs
|
| 42 |
+
change 0 < P.endFraction r ∧ P.endFraction r < 1/2 at he
|
| 43 |
+
unfold truncatedScale
|
| 44 |
+
split_ifs <;> linarith
|
| 45 |
+
|
| 46 |
+
theorem truncated_direction_ne_zero (P : PolygonalChain O a b)
|
| 47 |
+
(hmin : ∀ Q : PolygonalChain O a b, P.pieces ≤ Q.pieces)
|
| 48 |
+
(r : ℝ) (hr : 0 < r)
|
| 49 |
+
(hfirst : 4*r^2 < squaredLength (P.vertices 1-P.vertices 0))
|
| 50 |
+
(hlast : 4*r^2 < squaredLength (P.vertices P.pieces-P.vertices (P.pieces-1)))
|
| 51 |
+
(i : ℕ) (hi : i < P.pieces) : trackDirection (P.truncatedVertices r) i ≠ 0 := by
|
| 52 |
+
rw [P.truncated_direction r i hi]
|
| 53 |
+
exact smul_ne_zero (ne_of_gt (P.truncatedScale_pos r hr hfirst hlast i)) (P.minimum_piece_ne_zero hmin i hi)
|
| 54 |
+
|
| 55 |
+
end Zarankiewicz.PolygonalChain
|
| 56 |
+
|
| 57 |
+
end
|
| 58 |
+
|
| 59 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/TruncatedChainPath.lean
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.TruncatedTrackAvoidance
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
namespace Zarankiewicz.PolygonalChain
|
| 7 |
+
variable {O : Set Plane} {a b : Plane}
|
| 8 |
+
|
| 9 |
+
def truncated (P : PolygonalChain O a b) (hp : 0 < P.pieces) (r : ℝ) (hr : 0 < r)
|
| 10 |
+
(hfirst : r^2 < squaredLength (P.vertices 1-P.vertices 0))
|
| 11 |
+
(hlast : r^2 < squaredLength (P.vertices P.pieces-P.vertices (P.pieces-1))) :
|
| 12 |
+
PolygonalChain O (P.startPort r) (P.endPort r) where
|
| 13 |
+
pieces := P.pieces
|
| 14 |
+
vertices := P.truncatedVertices r
|
| 15 |
+
first := P.truncatedVertices_first r
|
| 16 |
+
last := P.truncatedVertices_last hp r
|
| 17 |
+
start_mem := P.inside 0 hp (openSegmentTrace_subset_segment _ _ (radialPort_mem_openSegment _ _ r hr hfirst))
|
| 18 |
+
inside := fun i hi => (P.truncated_piece_subset r hr hfirst hlast i hi).trans (P.inside i hi)
|
| 19 |
+
|
| 20 |
+
theorem truncated_segments_disjoint (P : PolygonalChain O a b)
|
| 21 |
+
(hmin : ∀ Q : PolygonalChain O a b, P.pieces ≤ Q.pieces)
|
| 22 |
+
(r : ℝ) (hr : 0 < r)
|
| 23 |
+
(hfirst : r^2 < squaredLength (P.vertices 1-P.vertices 0))
|
| 24 |
+
(hlast : r^2 < squaredLength (P.vertices P.pieces-P.vertices (P.pieces-1)))
|
| 25 |
+
(i j : ℕ) (hij : i+1 < j) (hj : j < P.pieces) :
|
| 26 |
+
Disjoint (segment ℝ (P.truncatedVertices r i) (P.truncatedVertices r (i+1)))
|
| 27 |
+
(segment ℝ (P.truncatedVertices r j) (P.truncatedVertices r (j+1))) :=
|
| 28 |
+
(P.minimum_nonadjacent_disjoint hmin i j hij hj).mono
|
| 29 |
+
(P.truncated_piece_subset r hr hfirst hlast i (by omega))
|
| 30 |
+
(P.truncated_piece_subset r hr hfirst hlast j hj)
|
| 31 |
+
|
| 32 |
+
theorem truncated_path_injective (P : PolygonalChain O a b)
|
| 33 |
+
(hmin : ∀ Q : PolygonalChain O a b, P.pieces ≤ Q.pieces) (hp : 0 < P.pieces)
|
| 34 |
+
(r : ℝ) (hr : 0 < r)
|
| 35 |
+
(hfirst : 4*r^2 < squaredLength (P.vertices 1-P.vertices 0))
|
| 36 |
+
(hlast : 4*r^2 < squaredLength (P.vertices P.pieces-P.vertices (P.pieces-1))) :
|
| 37 |
+
Function.Injective (polygonalArcPath (P.truncatedVertices r) P.pieces) := by
|
| 38 |
+
have hs : r^2 < squaredLength (P.vertices 1-P.vertices 0) := by nlinarith [sq_nonneg r]
|
| 39 |
+
have ht : r^2 < squaredLength (P.vertices P.pieces-P.vertices (P.pieces-1)) := by nlinarith [sq_nonneg r]
|
| 40 |
+
apply polygonalArcPath_injective (P.truncatedVertices r) P.pieces hp
|
| 41 |
+
· intro i hi
|
| 42 |
+
exact Ne.symm (sub_ne_zero.mp (P.truncated_direction_ne_zero hmin r hr hfirst hlast i hi))
|
| 43 |
+
· intro i j hij hj x hx hy
|
| 44 |
+
by_cases he : j=i+1
|
| 45 |
+
· subst j
|
| 46 |
+
refine ⟨rfl,?_⟩
|
| 47 |
+
have hb := P.truncated_bend_ne_zero hmin r hr hfirst hlast (i+1) (by omega) hj
|
| 48 |
+
apply adjacent_segments_meet_only_at_bend _ _ _ ?_ hx hy
|
| 49 |
+
simpa only [trackDirection,Nat.add_sub_cancel] using hb
|
| 50 |
+
· exact False.elim (Set.disjoint_left.mp (P.truncated_segments_disjoint hmin r hr hs ht i j (by omega) hj) hx hy)
|
| 51 |
+
|
| 52 |
+
end Zarankiewicz.PolygonalChain
|
| 53 |
+
|
| 54 |
+
end
|
| 55 |
+
|
| 56 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/TruncatedChainVertices.lean
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.DrawingSpokePorts
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
namespace Zarankiewicz
|
| 7 |
+
|
| 8 |
+
theorem radialPort_parameter_half (a b : Plane) (r : ℝ) (hr : 0 < r)
|
| 9 |
+
(hshort : 4*r^2 < squaredLength (b-a)) :
|
| 10 |
+
0 < r/Real.sqrt (squaredLength (b-a)) ∧ r/Real.sqrt (squaredLength (b-a)) < 1/2 := by
|
| 11 |
+
have hL : 0 < squaredLength (b-a) := by nlinarith [sq_nonneg r]
|
| 12 |
+
have hs := Real.sqrt_pos.mpr hL
|
| 13 |
+
have hs2 := Real.sq_sqrt hL.le
|
| 14 |
+
exact ⟨div_pos hr hs,(div_lt_iff₀ hs).mpr (by nlinarith)⟩
|
| 15 |
+
|
| 16 |
+
namespace PolygonalChain
|
| 17 |
+
variable {O : Set Plane} {a b : Plane}
|
| 18 |
+
|
| 19 |
+
def startFraction (P : PolygonalChain O a b) (r : ℝ) : ℝ :=
|
| 20 |
+
r/Real.sqrt (squaredLength (P.vertices 1-P.vertices 0))
|
| 21 |
+
|
| 22 |
+
def endFraction (P : PolygonalChain O a b) (r : ℝ) : ℝ :=
|
| 23 |
+
r/Real.sqrt (squaredLength (P.vertices P.pieces-P.vertices (P.pieces-1)))
|
| 24 |
+
|
| 25 |
+
def truncatedVertices (P : PolygonalChain O a b) (r : ℝ) (i : ℕ) : Plane :=
|
| 26 |
+
if i=0 then P.startPort r else if i=P.pieces then P.endPort r else P.vertices i
|
| 27 |
+
|
| 28 |
+
theorem startPort_eq_fraction (P : PolygonalChain O a b) (r : ℝ) :
|
| 29 |
+
P.startPort r=P.vertices 0+P.startFraction r • (P.vertices 1-P.vertices 0) := rfl
|
| 30 |
+
|
| 31 |
+
theorem endPort_eq_fraction (P : PolygonalChain O a b) (r : ℝ) :
|
| 32 |
+
P.endPort r=P.vertices P.pieces-P.endFraction r • (P.vertices P.pieces-P.vertices (P.pieces-1)) := by
|
| 33 |
+
unfold endPort radialPort endFraction
|
| 34 |
+
rw [squaredLength_sub_comm (P.vertices (P.pieces-1)) (P.vertices P.pieces)]
|
| 35 |
+
apply Prod.ext <;> dsimp <;> ring
|
| 36 |
+
|
| 37 |
+
theorem truncatedVertices_first (P : PolygonalChain O a b) (r : ℝ) :
|
| 38 |
+
P.truncatedVertices r 0=P.startPort r := by simp [truncatedVertices]
|
| 39 |
+
|
| 40 |
+
theorem truncatedVertices_last (P : PolygonalChain O a b) (hp : 0 < P.pieces) (r : ℝ) :
|
| 41 |
+
P.truncatedVertices r P.pieces=P.endPort r := by simp [truncatedVertices,ne_of_gt hp]
|
| 42 |
+
|
| 43 |
+
theorem truncated_piece_subset (P : PolygonalChain O a b) (r : ℝ) (hr : 0 < r)
|
| 44 |
+
(hfirst : r^2 < squaredLength (P.vertices 1-P.vertices 0))
|
| 45 |
+
(hlast : r^2 < squaredLength (P.vertices P.pieces-P.vertices (P.pieces-1)))
|
| 46 |
+
(i : ℕ) (hi : i < P.pieces) :
|
| 47 |
+
segment ℝ (P.truncatedVertices r i) (P.truncatedVertices r (i+1)) ⊆
|
| 48 |
+
segment ℝ (P.vertices i) (P.vertices (i+1)) := by
|
| 49 |
+
apply (convex_segment (𝕜 := ℝ) _ _).segment_subset
|
| 50 |
+
· by_cases h0 : i=0
|
| 51 |
+
· subst i
|
| 52 |
+
rw [truncatedVertices_first]
|
| 53 |
+
exact openSegmentTrace_subset_segment _ _ (radialPort_mem_openSegment _ _ r hr hfirst)
|
| 54 |
+
· simp only [truncatedVertices,ite_eq_right h0,ite_eq_right (show i ≠ P.pieces by omega)]
|
| 55 |
+
exact left_mem_segment ℝ _ _
|
| 56 |
+
· by_cases hn : i+1=P.pieces
|
| 57 |
+
· rw [show P.truncatedVertices r (i+1)=P.endPort r by rw [hn]; exact P.truncatedVertices_last (by omega) r]
|
| 58 |
+
have hh : i=P.pieces-1 := by omega
|
| 59 |
+
have hs : r^2 < squaredLength (P.vertices (P.pieces-1)-P.vertices P.pieces) := by
|
| 60 |
+
rwa [squaredLength_sub_comm]
|
| 61 |
+
have hx := openSegmentTrace_reverse_mem _ _ _ (radialPort_mem_openSegment _ _ r hr hs)
|
| 62 |
+
have hseg := openSegmentTrace_subset_segment _ _ hx
|
| 63 |
+
simpa only [endPort,hh,show P.pieces-1+1=P.pieces by omega] using hseg
|
| 64 |
+
· simp only [truncatedVertices,ite_eq_right (show i+1 ≠ 0 by omega),ite_eq_right hn]
|
| 65 |
+
exact right_mem_segment ℝ _ _
|
| 66 |
+
|
| 67 |
+
end PolygonalChain
|
| 68 |
+
end Zarankiewicz
|
| 69 |
+
|
| 70 |
+
end
|
| 71 |
+
|
| 72 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/TruncatedCrossingCorners.lean
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.TruncatedDrawingInteriors
|
| 2 |
+
import OAI.Combinatorics.Crossing.ReducedCrossingCorners
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
namespace Zarankiewicz
|
| 8 |
+
variable {m n : ℕ}
|
| 9 |
+
|
| 10 |
+
theorem truncated_vertices_not_crossing (D : AdmissibleDrawing m n)
|
| 11 |
+
(hnorm : NoAdjacentCrossings D) (hstraight : LocallyStraightCrossings D)
|
| 12 |
+
(P : ∀ e : BipartiteEdge m n, PolygonalChain (Set.range (D.edge e))
|
| 13 |
+
(D.vertex (.inl e.1)) (D.vertex (.inr e.2)))
|
| 14 |
+
(hmin : ∀ e, ∀ Q : PolygonalChain (Set.range (D.edge e))
|
| 15 |
+
(D.vertex (.inl e.1)) (D.vertex (.inr e.2)), (P e).pieces ≤ Q.pieces)
|
| 16 |
+
(r : ℝ)
|
| 17 |
+
(hclear : ∀ j e (i : Fin (P e).pieces),
|
| 18 |
+
¬ ((j=Sum.inl e.1 ∧ i.val=0) ∨ (j=Sum.inr e.2 ∧ i.val+1=(P e).pieces)) →
|
| 19 |
+
Disjoint (closedRoundDisk (D.vertex j) r) (segment ℝ ((P e).vertices i.val) ((P e).vertices (i.val+1))))
|
| 20 |
+
(e : BipartiteEdge m n) (i : ℕ) (hi : i ≤ (P e).pieces) :
|
| 21 |
+
(P e).truncatedVertices r i ∉ crossingPoints D.toContinuousDrawing := by
|
| 22 |
+
by_cases h0 : i=0
|
| 23 |
+
· subst i
|
| 24 |
+
rw [(P e).truncatedVertices_first]
|
| 25 |
+
intro hx
|
| 26 |
+
have hc := (drawing_chain_startPort_circle D.toContinuousDrawing e (P e) (hmin e) r).le
|
| 27 |
+
exact Set.disjoint_left.mp (vertex_disks_crossing_free D hnorm P r hclear (.inl e.1)) hc hx
|
| 28 |
+
by_cases hn : i=(P e).pieces
|
| 29 |
+
· subst i
|
| 30 |
+
rw [(P e).truncatedVertices_last (drawing_chain_pieces_pos D.toContinuousDrawing e (P e))]
|
| 31 |
+
intro hx
|
| 32 |
+
have hc := (drawing_chain_endPort_circle D.toContinuousDrawing e (P e) (hmin e) r).le
|
| 33 |
+
exact Set.disjoint_left.mp (vertex_disks_crossing_free D hnorm P r hclear (.inr e.2)) hc hx
|
| 34 |
+
· simp only [PolygonalChain.truncatedVertices,ite_eq_right h0,ite_eq_right hn]
|
| 35 |
+
exact minimum_vertices_not_crossing D hstraight e (P e) (hmin e) i hi
|
| 36 |
+
|
| 37 |
+
end Zarankiewicz
|
| 38 |
+
|
| 39 |
+
end
|
| 40 |
+
|
| 41 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/TruncatedCrossingRetention.lean
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.VertexDisksCrossingFree
|
| 2 |
+
import OAI.Combinatorics.Crossing.TruncatedTraceDecomposition
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
namespace Zarankiewicz
|
| 8 |
+
variable {m n : ℕ}
|
| 9 |
+
|
| 10 |
+
theorem crossing_mem_truncated_edge (D : AdmissibleDrawing m n) (hnorm : NoAdjacentCrossings D)
|
| 11 |
+
(P : ∀ e : BipartiteEdge m n, PolygonalChain (Set.range (D.edge e))
|
| 12 |
+
(D.vertex (.inl e.1)) (D.vertex (.inr e.2)))
|
| 13 |
+
(hmin : ∀ e, ∀ Q : PolygonalChain (Set.range (D.edge e))
|
| 14 |
+
(D.vertex (.inl e.1)) (D.vertex (.inr e.2)), (P e).pieces ≤ Q.pieces)
|
| 15 |
+
(r : ℝ) (hr : 0 < r)
|
| 16 |
+
(hshort : ∀ e, r^2 < squaredLength ((P e).vertices 1-(P e).vertices 0) ∧
|
| 17 |
+
r^2 < squaredLength ((P e).vertices (P e).pieces-(P e).vertices ((P e).pieces-1)))
|
| 18 |
+
(hclear : ∀ j e (i : Fin (P e).pieces),
|
| 19 |
+
¬ ((j=Sum.inl e.1 ∧ i.val=0) ∨ (j=Sum.inr e.2 ∧ i.val+1=(P e).pieces)) →
|
| 20 |
+
Disjoint (closedRoundDisk (D.vertex j) r) (segment ℝ ((P e).vertices i.val) ((P e).vertices (i.val+1))))
|
| 21 |
+
(e : BipartiteEdge m n) (x : Plane) (hx : x ∈ crossingPoints D.toContinuousDrawing)
|
| 22 |
+
(hxe : x ∈ edgeInterior D.toContinuousDrawing e) :
|
| 23 |
+
x ∈ Set.range (polygonalArcPath ((P e).truncatedVertices r) (P e).pieces) := by
|
| 24 |
+
have hh := edgeInterior_subset_range D.toContinuousDrawing e hxe
|
| 25 |
+
rw [drawing_edge_trace_decomposition D.toContinuousDrawing e (P e) r hr (hshort e).1 (hshort e).2] at hh
|
| 26 |
+
rcases hh with (hs | hm) | ht
|
| 27 |
+
· have hmem := center_segment_in_disk (D.vertex (.inl e.1)) ((P e).startPort r) r
|
| 28 |
+
(drawing_chain_startPort_circle D.toContinuousDrawing e (P e) (hmin e) r) hs
|
| 29 |
+
exact False.elim (Set.disjoint_left.mp (vertex_disks_crossing_free D hnorm P r hclear (.inl e.1)) hmem hx)
|
| 30 |
+
· exact hm
|
| 31 |
+
· have ht' : x ∈ segment ℝ (D.vertex (.inr e.2)) ((P e).endPort r) := by
|
| 32 |
+
simpa only [segment_symm ℝ ((P e).endPort r) (D.vertex (.inr e.2))] using ht
|
| 33 |
+
have hmem := center_segment_in_disk (D.vertex (.inr e.2)) ((P e).endPort r) r
|
| 34 |
+
(drawing_chain_endPort_circle D.toContinuousDrawing e (P e) (hmin e) r) ht'
|
| 35 |
+
exact False.elim (Set.disjoint_left.mp (vertex_disks_crossing_free D hnorm P r hclear (.inr e.2)) hmem hx)
|
| 36 |
+
|
| 37 |
+
end Zarankiewicz
|
| 38 |
+
|
| 39 |
+
end
|
| 40 |
+
|
| 41 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/TruncatedDrawingDisks.lean
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.TruncatedRadialEnds
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
namespace Zarankiewicz
|
| 7 |
+
variable {m n : ℕ}
|
| 8 |
+
|
| 9 |
+
theorem truncated_piece_vertex_disk_cases (D : ContinuousDrawing m n)
|
| 10 |
+
(P : ∀ e : BipartiteEdge m n, PolygonalChain (Set.range (D.edge e))
|
| 11 |
+
(D.vertex (.inl e.1)) (D.vertex (.inr e.2)))
|
| 12 |
+
(hmin : ∀ e, ∀ Q : PolygonalChain (Set.range (D.edge e))
|
| 13 |
+
(D.vertex (.inl e.1)) (D.vertex (.inr e.2)), (P e).pieces ≤ Q.pieces)
|
| 14 |
+
(r : ℝ) (hr : 0 < r)
|
| 15 |
+
(hshort : ∀ e, 4*r^2 < squaredLength ((P e).vertices 1-(P e).vertices 0) ∧
|
| 16 |
+
4*r^2 < squaredLength ((P e).vertices (P e).pieces-(P e).vertices ((P e).pieces-1)))
|
| 17 |
+
(hclear : ∀ j e (i : Fin (P e).pieces),
|
| 18 |
+
¬ ((j=Sum.inl e.1 ∧ i.val=0) ∨ (j=Sum.inr e.2 ∧ i.val+1=(P e).pieces)) →
|
| 19 |
+
Disjoint (closedRoundDisk (D.vertex j) r) (segment ℝ ((P e).vertices i.val) ((P e).vertices (i.val+1))))
|
| 20 |
+
(j : BipartiteVertex m n) (e : BipartiteEdge m n) (i : Fin (P e).pieces) (x : Plane)
|
| 21 |
+
(hx : x ∈ segment ℝ ((P e).truncatedVertices r i.val) ((P e).truncatedVertices r (i.val+1))) :
|
| 22 |
+
(j=Sum.inl e.1 ∧ x=(P e).startPort r) ∨
|
| 23 |
+
(j=Sum.inr e.2 ∧ x=(P e).endPort r) ∨ r^2 < squaredLength (x-D.vertex j) := by
|
| 24 |
+
have hp := drawing_chain_pieces_pos D e (P e)
|
| 25 |
+
by_cases hfirst : j=Sum.inl e.1 ∧ i.val=0
|
| 26 |
+
· have hh := (P e).truncated_first_exterior (hmin e) hp r hr (hshort e).1 (hshort e).2
|
| 27 |
+
(by simpa only [hfirst.2] using hx)
|
| 28 |
+
rcases Set.mem_insert_iff.mp hh with he | he
|
| 29 |
+
· exact Or.inl ⟨hfirst.1,he⟩
|
| 30 |
+
· right; right
|
| 31 |
+
simpa only [Set.mem_ofPred_eq,(P e).first,hfirst.1] using he
|
| 32 |
+
by_cases hlast : j=Sum.inr e.2 ∧ i.val+1=(P e).pieces
|
| 33 |
+
· have hi : i.val=(P e).pieces-1 := by omega
|
| 34 |
+
have hh := (P e).truncated_last_exterior (hmin e) hp r hr (hshort e).1 (hshort e).2
|
| 35 |
+
(by simpa only [hi,show (P e).pieces-1+1=(P e).pieces by omega] using hx)
|
| 36 |
+
rcases Set.mem_insert_iff.mp hh with he | he
|
| 37 |
+
· exact Or.inr (Or.inl ⟨hlast.1,he⟩)
|
| 38 |
+
· right; right
|
| 39 |
+
simpa only [Set.mem_ofPred_eq,(P e).last,hlast.1] using he
|
| 40 |
+
· right; right
|
| 41 |
+
have hs : r^2 < squaredLength ((P e).vertices 1-(P e).vertices 0) := by nlinarith [(hshort e).1,sq_nonneg r]
|
| 42 |
+
have ht : r^2 < squaredLength ((P e).vertices (P e).pieces-(P e).vertices ((P e).pieces-1)) := by
|
| 43 |
+
nlinarith [(hshort e).2,sq_nonneg r]
|
| 44 |
+
have hxi := (P e).truncated_piece_subset r hr hs ht i.val i.isLt hx
|
| 45 |
+
by_contra h
|
| 46 |
+
exact Set.disjoint_left.mp (hclear j e i (fun h => h.elim hfirst hlast)) (le_of_not_gt h) hxi
|
| 47 |
+
|
| 48 |
+
theorem truncated_path_vertex_disk_cases (D : ContinuousDrawing m n)
|
| 49 |
+
(P : ∀ e : BipartiteEdge m n, PolygonalChain (Set.range (D.edge e))
|
| 50 |
+
(D.vertex (.inl e.1)) (D.vertex (.inr e.2)))
|
| 51 |
+
(hmin : ∀ e, ∀ Q : PolygonalChain (Set.range (D.edge e))
|
| 52 |
+
(D.vertex (.inl e.1)) (D.vertex (.inr e.2)), (P e).pieces ≤ Q.pieces)
|
| 53 |
+
(r : ℝ) (hr : 0 < r)
|
| 54 |
+
(hshort : ∀ e, 4*r^2 < squaredLength ((P e).vertices 1-(P e).vertices 0) ∧
|
| 55 |
+
4*r^2 < squaredLength ((P e).vertices (P e).pieces-(P e).vertices ((P e).pieces-1)))
|
| 56 |
+
(hclear : ∀ j e (i : Fin (P e).pieces),
|
| 57 |
+
¬ ((j=Sum.inl e.1 ∧ i.val=0) ∨ (j=Sum.inr e.2 ∧ i.val+1=(P e).pieces)) →
|
| 58 |
+
Disjoint (closedRoundDisk (D.vertex j) r) (segment ℝ ((P e).vertices i.val) ((P e).vertices (i.val+1))))
|
| 59 |
+
(j : BipartiteVertex m n) (e : BipartiteEdge m n) (x : Plane)
|
| 60 |
+
(hx : x ∈ Set.range (polygonalArcPath ((P e).truncatedVertices r) (P e).pieces)) :
|
| 61 |
+
(j=Sum.inl e.1 ∧ x=(P e).startPort r) ∨
|
| 62 |
+
(j=Sum.inr e.2 ∧ x=(P e).endPort r) ∨ r^2 < squaredLength (x-D.vertex j) := by
|
| 63 |
+
obtain ⟨i,hi,hxi⟩ := polygonalArcPath_range_piece ((P e).truncatedVertices r) (P e).pieces
|
| 64 |
+
(drawing_chain_pieces_pos D e (P e)) x hx
|
| 65 |
+
exact truncated_piece_vertex_disk_cases D P hmin r hr hshort hclear j e ⟨i,hi⟩ x hxi
|
| 66 |
+
|
| 67 |
+
end Zarankiewicz
|
| 68 |
+
|
| 69 |
+
end
|
| 70 |
+
|
| 71 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/TruncatedDrawingInteriors.lean
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.TruncatedCrossingRetention
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
namespace Zarankiewicz
|
| 7 |
+
variable {m n : ℕ}
|
| 8 |
+
|
| 9 |
+
theorem truncated_range_subset_edgeInterior (D : ContinuousDrawing m n)
|
| 10 |
+
(P : ∀ e : BipartiteEdge m n, PolygonalChain (Set.range (D.edge e))
|
| 11 |
+
(D.vertex (.inl e.1)) (D.vertex (.inr e.2)))
|
| 12 |
+
(hmin : ∀ e, ∀ Q : PolygonalChain (Set.range (D.edge e))
|
| 13 |
+
(D.vertex (.inl e.1)) (D.vertex (.inr e.2)), (P e).pieces ≤ Q.pieces)
|
| 14 |
+
(r : ℝ) (hr : 0 < r)
|
| 15 |
+
(hshort : ∀ e, 4*r^2 < squaredLength ((P e).vertices 1-(P e).vertices 0) ∧
|
| 16 |
+
4*r^2 < squaredLength ((P e).vertices (P e).pieces-(P e).vertices ((P e).pieces-1)))
|
| 17 |
+
(hclear : ∀ j e (i : Fin (P e).pieces),
|
| 18 |
+
¬ ((j=Sum.inl e.1 ∧ i.val=0) ∨ (j=Sum.inr e.2 ∧ i.val+1=(P e).pieces)) →
|
| 19 |
+
Disjoint (closedRoundDisk (D.vertex j) r) (segment ℝ ((P e).vertices i.val) ((P e).vertices (i.val+1))))
|
| 20 |
+
(e : BipartiteEdge m n) :
|
| 21 |
+
Set.range (polygonalArcPath ((P e).truncatedVertices r) (P e).pieces) ⊆ edgeInterior D e := by
|
| 22 |
+
intro x hx
|
| 23 |
+
have hs : r^2 < squaredLength ((P e).vertices 1-(P e).vertices 0) := by nlinarith [(hshort e).1,sq_nonneg r]
|
| 24 |
+
have ht : r^2 < squaredLength ((P e).vertices (P e).pieces-(P e).vertices ((P e).pieces-1)) := by
|
| 25 |
+
nlinarith [(hshort e).2,sq_nonneg r]
|
| 26 |
+
apply edgeInterior_of_range_not_vertices D e x
|
| 27 |
+
· exact ((P e).truncated (drawing_chain_pieces_pos D e (P e)) r hr hs ht).path_range_subset hx
|
| 28 |
+
· intro j he
|
| 29 |
+
rcases truncated_path_vertex_disk_cases D P hmin r hr hshort hclear j e x hx with ⟨hj,hp⟩ | ⟨hj,hp⟩ | hout
|
| 30 |
+
· have hpi := drawing_chain_startPort_interior D e (P e) (hmin e) r hr hs
|
| 31 |
+
exact edgeInterior_not_vertex D e _ hpi j (hp.symm.trans he)
|
| 32 |
+
· have hpi := drawing_chain_endPort_interior D e (P e) (hmin e) r hr ht
|
| 33 |
+
exact edgeInterior_not_vertex D e _ hpi j (hp.symm.trans he)
|
| 34 |
+
· rw [he,sub_self] at hout
|
| 35 |
+
have hz : squaredLength (0 : Plane)=0 := by simp [squaredLength]
|
| 36 |
+
rw [hz] at hout
|
| 37 |
+
exact (sq_nonneg r).not_gt hout
|
| 38 |
+
|
| 39 |
+
theorem truncated_edge_intersections_eq (D : AdmissibleDrawing m n) (hnorm : NoAdjacentCrossings D)
|
| 40 |
+
(P : ∀ e : BipartiteEdge m n, PolygonalChain (Set.range (D.edge e))
|
| 41 |
+
(D.vertex (.inl e.1)) (D.vertex (.inr e.2)))
|
| 42 |
+
(hmin : ∀ e, ∀ Q : PolygonalChain (Set.range (D.edge e))
|
| 43 |
+
(D.vertex (.inl e.1)) (D.vertex (.inr e.2)), (P e).pieces ≤ Q.pieces)
|
| 44 |
+
(r : ℝ) (hr : 0 < r)
|
| 45 |
+
(hshort : ∀ e, 4*r^2 < squaredLength ((P e).vertices 1-(P e).vertices 0) ∧
|
| 46 |
+
4*r^2 < squaredLength ((P e).vertices (P e).pieces-(P e).vertices ((P e).pieces-1)))
|
| 47 |
+
(hclear : ∀ j e (i : Fin (P e).pieces),
|
| 48 |
+
¬ ((j=Sum.inl e.1 ∧ i.val=0) ∨ (j=Sum.inr e.2 ∧ i.val+1=(P e).pieces)) →
|
| 49 |
+
Disjoint (closedRoundDisk (D.vertex j) r) (segment ℝ ((P e).vertices i.val) ((P e).vertices (i.val+1))))
|
| 50 |
+
(e f : BipartiteEdge m n) (hef : e ≠ f) :
|
| 51 |
+
Set.range (polygonalArcPath ((P e).truncatedVertices r) (P e).pieces) ∩
|
| 52 |
+
Set.range (polygonalArcPath ((P f).truncatedVertices r) (P f).pieces) =
|
| 53 |
+
edgeInterior D.toContinuousDrawing e ∩ edgeInterior D.toContinuousDrawing f := by
|
| 54 |
+
have hweak (g : BipartiteEdge m n) :
|
| 55 |
+
r^2 < squaredLength ((P g).vertices 1-(P g).vertices 0) ∧
|
| 56 |
+
r^2 < squaredLength ((P g).vertices (P g).pieces-(P g).vertices ((P g).pieces-1)) := by
|
| 57 |
+
constructor <;> nlinarith [(hshort g).1,(hshort g).2,sq_nonneg r]
|
| 58 |
+
ext x
|
| 59 |
+
constructor
|
| 60 |
+
· rintro ⟨hx,hy⟩
|
| 61 |
+
exact ⟨truncated_range_subset_edgeInterior D.toContinuousDrawing P hmin r hr hshort hclear e hx,
|
| 62 |
+
truncated_range_subset_edgeInterior D.toContinuousDrawing P hmin r hr hshort hclear f hy⟩
|
| 63 |
+
· rintro ⟨hx,hy⟩
|
| 64 |
+
have hc : x ∈ crossingPoints D.toContinuousDrawing := ⟨e,f,hef,hx,hy⟩
|
| 65 |
+
exact ⟨crossing_mem_truncated_edge D hnorm P hmin r hr hweak hclear e x hc hx,
|
| 66 |
+
crossing_mem_truncated_edge D hnorm P hmin r hr hweak hclear f x hc hy⟩
|
| 67 |
+
|
| 68 |
+
end Zarankiewicz
|
| 69 |
+
|
| 70 |
+
end
|
| 71 |
+
|
| 72 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/TruncatedRadialDots.lean
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.TrackEndpointConnections
|
| 2 |
+
import OAI.Combinatorics.Crossing.NormalOffsetExterior
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
namespace Zarankiewicz
|
| 8 |
+
|
| 9 |
+
theorem dot2_scaled_self (v : Plane) (a b : ℝ) : dot2 (a • v) (b • v)=a*b*squaredLength v := by
|
| 10 |
+
dsimp [dot2,squaredLength]
|
| 11 |
+
ring
|
| 12 |
+
|
| 13 |
+
namespace VertexTruncation
|
| 14 |
+
variable {m n : ℕ} {D : ContinuousDrawing m n} (V : VertexTruncation D)
|
| 15 |
+
|
| 16 |
+
theorem start_radial_dot_pos (e : BipartiteEdge m n) :
|
| 17 |
+
0 < dot2 (V.startPort e-D.vertex (Sum.inl e.1)) (trackDirection (V.vertices e) 0) := by
|
| 18 |
+
have hp := V.pieces_pos e
|
| 19 |
+
have hα := (radialPort_parameter_half ((V.chain e).vertices 0) ((V.chain e).vertices 1)
|
| 20 |
+
V.radius V.radius_pos (V.short e).1).1
|
| 21 |
+
have hβ := (V.chain e).truncatedScale_pos V.radius V.radius_pos (V.short e).1 (V.short e).2 0
|
| 22 |
+
have he : V.startPort e-D.vertex (Sum.inl e.1)=
|
| 23 |
+
(V.chain e).startFraction V.radius • trackDirection (V.chain e).vertices 0 := by
|
| 24 |
+
have hh := radialPort_sub ((V.chain e).vertices 0) ((V.chain e).vertices 1) V.radius
|
| 25 |
+
change (V.chain e).startPort V.radius-(V.chain e).vertices 0=
|
| 26 |
+
(V.chain e).startFraction V.radius • trackDirection (V.chain e).vertices 0 at hh
|
| 27 |
+
simpa only [startPort,(V.chain e).first] using hh
|
| 28 |
+
rw [he]
|
| 29 |
+
change 0 < dot2 _ (trackDirection ((V.chain e).truncatedVertices V.radius) 0)
|
| 30 |
+
rw [(V.chain e).truncated_direction V.radius 0 hp,dot2_scaled_self]
|
| 31 |
+
exact mul_pos (mul_pos hα hβ)
|
| 32 |
+
(squaredLength_pos _ ((V.chain e).minimum_piece_ne_zero (V.minimal e) 0 hp))
|
| 33 |
+
|
| 34 |
+
theorem end_radial_dot_neg (e : BipartiteEdge m n) :
|
| 35 |
+
dot2 (V.endPort e-D.vertex (Sum.inr e.2))
|
| 36 |
+
(trackDirection (V.vertices e) (V.pieces e-1)) < 0 := by
|
| 37 |
+
have hp := V.pieces_pos e
|
| 38 |
+
have hp' : 0 < (V.chain e).pieces := hp
|
| 39 |
+
have hi : V.pieces e-1 < V.pieces e := by omega
|
| 40 |
+
have hα := (radialPort_parameter_half ((V.chain e).vertices ((V.chain e).pieces-1))
|
| 41 |
+
((V.chain e).vertices (V.chain e).pieces) V.radius V.radius_pos (V.short e).2).1
|
| 42 |
+
have hβ := (V.chain e).truncatedScale_pos V.radius V.radius_pos (V.short e).1 (V.short e).2 (V.pieces e-1)
|
| 43 |
+
have he : V.endPort e-D.vertex (Sum.inr e.2)=
|
| 44 |
+
(-(V.chain e).endFraction V.radius) • trackDirection (V.chain e).vertices (V.pieces e-1) := by
|
| 45 |
+
have hh : (V.chain e).endPort V.radius-(V.chain e).vertices (V.chain e).pieces=
|
| 46 |
+
(-(V.chain e).endFraction V.radius) • trackDirection (V.chain e).vertices (V.pieces e-1) := by
|
| 47 |
+
rw [(V.chain e).endPort_eq_fraction]
|
| 48 |
+
simp only [trackDirection,pieces,show (V.chain e).pieces-1+1=(V.chain e).pieces by omega,neg_smul]
|
| 49 |
+
abel
|
| 50 |
+
simpa only [endPort,(V.chain e).last] using hh
|
| 51 |
+
rw [he]
|
| 52 |
+
change dot2 _ (trackDirection ((V.chain e).truncatedVertices V.radius) (V.pieces e-1)) < 0
|
| 53 |
+
rw [(V.chain e).truncated_direction V.radius _ hi,dot2_scaled_self]
|
| 54 |
+
exact mul_neg_of_neg_of_pos (mul_neg_of_neg_of_pos (neg_neg_of_pos hα) hβ)
|
| 55 |
+
(squaredLength_pos _ ((V.chain e).minimum_piece_ne_zero (V.minimal e) _ hi))
|
| 56 |
+
|
| 57 |
+
theorem bend_ne_zero (e : BipartiteEdge m n) (i : ℕ) (hi0 : 0 < i) (hin : i < V.pieces e) :
|
| 58 |
+
det2 (trackDirection (V.vertices e) (i-1)) (trackDirection (V.vertices e) i) ≠ 0 := by
|
| 59 |
+
exact (V.chain e).truncated_bend_ne_zero (V.minimal e) V.radius V.radius_pos
|
| 60 |
+
(V.short e).1 (V.short e).2 i hi0 hin
|
| 61 |
+
|
| 62 |
+
theorem exists_forward_radius (e : BipartiteEdge m n) :
|
| 63 |
+
∃ δ : ℝ, 0<δ ∧ ∀ ε : ℝ, |ε|<δ → ∀ i : Fin (V.pieces e),
|
| 64 |
+
∃ ℓ : ℝ, 0<ℓ ∧ shiftedTrack (V.vertices e) (V.pieces e) ε (i.val+1)-
|
| 65 |
+
shiftedTrack (V.vertices e) (V.pieces e) ε i.val=ℓ • trackDirection (V.vertices e) i.val :=
|
| 66 |
+
exists_forward_shiftedTrack_radius (V.vertices e) (V.pieces e) (V.direction_ne_zero e) (V.bend_ne_zero e)
|
| 67 |
+
|
| 68 |
+
end VertexTruncation
|
| 69 |
+
end Zarankiewicz
|
| 70 |
+
|
| 71 |
+
end
|
| 72 |
+
|
| 73 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/TruncatedRadialEnds.lean
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.TruncatedChainPath
|
| 2 |
+
import OAI.Combinatorics.Crossing.RadialExterior
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
namespace Zarankiewicz
|
| 8 |
+
|
| 9 |
+
theorem radial_segment_of_coefficients (o p q v : Plane) (r α β : ℝ)
|
| 10 |
+
(hr : 0 < r) (hα : 0 < α) (hβ : 0 < β)
|
| 11 |
+
(hp : p-o=α • v) (hq : q-p=β • v) (hc : squaredLength (p-o)=r^2) :
|
| 12 |
+
segment ℝ p q ⊆ insert p {x | r^2 < squaredLength (x-o)} := by
|
| 13 |
+
have he : q=p+(β/α) • (p-o) := by
|
| 14 |
+
rw [hp,smul_smul,div_mul_cancel₀ _ (ne_of_gt hα)]
|
| 15 |
+
rw [← hq]
|
| 16 |
+
abel
|
| 17 |
+
rw [he]
|
| 18 |
+
exact radial_spur_exterior o p r (β/α) hc hr (div_pos hβ hα)
|
| 19 |
+
|
| 20 |
+
namespace PolygonalChain
|
| 21 |
+
variable {O : Set Plane} {a b : Plane}
|
| 22 |
+
|
| 23 |
+
theorem truncated_first_exterior (P : PolygonalChain O a b)
|
| 24 |
+
(hmin : ∀ Q : PolygonalChain O a b, P.pieces ≤ Q.pieces) (hp : 0 < P.pieces)
|
| 25 |
+
(r : ℝ) (hr : 0 < r)
|
| 26 |
+
(hfirst : 4*r^2 < squaredLength (P.vertices 1-P.vertices 0))
|
| 27 |
+
(hlast : 4*r^2 < squaredLength (P.vertices P.pieces-P.vertices (P.pieces-1))) :
|
| 28 |
+
segment ℝ (P.truncatedVertices r 0) (P.truncatedVertices r 1) ⊆
|
| 29 |
+
insert (P.startPort r) {x | r^2 < squaredLength (x-P.vertices 0)} := by
|
| 30 |
+
have hα := (radialPort_parameter_half (P.vertices 0) (P.vertices 1) r hr hfirst).1
|
| 31 |
+
have hβ := P.truncatedScale_pos r hr hfirst hlast 0
|
| 32 |
+
rw [P.truncatedVertices_first]
|
| 33 |
+
apply radial_segment_of_coefficients (P.vertices 0) (P.startPort r) (P.truncatedVertices r 1)
|
| 34 |
+
(trackDirection P.vertices 0) r (P.startFraction r) (P.truncatedScale r 0) hr hα hβ
|
| 35 |
+
· exact radialPort_sub (P.vertices 0) (P.vertices 1) r
|
| 36 |
+
· simpa only [trackDirection,P.truncatedVertices_first] using P.truncated_direction r 0 hp
|
| 37 |
+
· exact radialPort_on_circle (P.vertices 0) (P.vertices 1)
|
| 38 |
+
(P.minimum_vertices_ne hmin 0 1 (by omega) hp) r
|
| 39 |
+
|
| 40 |
+
theorem truncated_last_exterior (P : PolygonalChain O a b)
|
| 41 |
+
(hmin : ∀ Q : PolygonalChain O a b, P.pieces ≤ Q.pieces) (hp : 0 < P.pieces)
|
| 42 |
+
(r : ℝ) (hr : 0 < r)
|
| 43 |
+
(hfirst : 4*r^2 < squaredLength (P.vertices 1-P.vertices 0))
|
| 44 |
+
(hlast : 4*r^2 < squaredLength (P.vertices P.pieces-P.vertices (P.pieces-1))) :
|
| 45 |
+
segment ℝ (P.truncatedVertices r (P.pieces-1)) (P.truncatedVertices r P.pieces) ⊆
|
| 46 |
+
insert (P.endPort r) {x | r^2 < squaredLength (x-P.vertices P.pieces)} := by
|
| 47 |
+
have hi : P.pieces-1 < P.pieces := by omega
|
| 48 |
+
have hα := (radialPort_parameter_half (P.vertices (P.pieces-1)) (P.vertices P.pieces) r hr hlast).1
|
| 49 |
+
have hβ := P.truncatedScale_pos r hr hfirst hlast (P.pieces-1)
|
| 50 |
+
rw [P.truncatedVertices_last hp,segment_symm]
|
| 51 |
+
apply radial_segment_of_coefficients (P.vertices P.pieces) (P.endPort r)
|
| 52 |
+
(P.truncatedVertices r (P.pieces-1)) (-(trackDirection P.vertices (P.pieces-1)))
|
| 53 |
+
r (P.endFraction r) (P.truncatedScale r (P.pieces-1)) hr hα hβ
|
| 54 |
+
· rw [P.endPort_eq_fraction]
|
| 55 |
+
simp only [trackDirection,show P.pieces-1+1=P.pieces by omega,smul_neg]
|
| 56 |
+
abel
|
| 57 |
+
· have h := P.truncated_direction r (P.pieces-1) hi
|
| 58 |
+
simp only [trackDirection,show P.pieces-1+1=P.pieces by omega,P.truncatedVertices_last hp] at h ⊢
|
| 59 |
+
rw [smul_neg,← h]
|
| 60 |
+
abel
|
| 61 |
+
· have hn := Ne.symm (P.minimum_vertices_ne hmin (P.pieces-1) P.pieces hi (by omega))
|
| 62 |
+
exact radialPort_on_circle (P.vertices P.pieces) (P.vertices (P.pieces-1)) hn r
|
| 63 |
+
|
| 64 |
+
end PolygonalChain
|
| 65 |
+
end Zarankiewicz
|
| 66 |
+
|
| 67 |
+
end
|
| 68 |
+
|
| 69 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/TruncatedSegmentTransversality.lean
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.TruncatedCrossingCorners
|
| 2 |
+
import OAI.Combinatorics.Crossing.ReducedCrossingTransversality
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
namespace Zarankiewicz
|
| 8 |
+
|
| 9 |
+
theorem segment_parameter_strict_of_avoids_endpoints (a b x : Plane) (S : Set Plane)
|
| 10 |
+
(hx : x ∈ S) (ha : a ∉ S) (hb : b ∉ S) (t : ℝ) (ht : t ∈ Set.Icc (0 : ℝ) 1)
|
| 11 |
+
(he : segmentPoint a b t=x) : t ∈ Set.Ioo (0 : ℝ) 1 := by
|
| 12 |
+
have ht0 : t ≠ 0 := by
|
| 13 |
+
intro h
|
| 14 |
+
rw [h,segmentPoint_zero] at he
|
| 15 |
+
exact ha (he.symm ▸ hx)
|
| 16 |
+
have ht1 : t ≠ 1 := by
|
| 17 |
+
intro h
|
| 18 |
+
rw [h,segmentPoint_one] at he
|
| 19 |
+
exact hb (he.symm ▸ hx)
|
| 20 |
+
exact ⟨lt_of_le_of_ne ht.1 ht0.symm,lt_of_le_of_ne ht.2 ht1⟩
|
| 21 |
+
|
| 22 |
+
theorem truncated_segment_pair_transverse {m n : ℕ} (D : AdmissibleDrawing m n)
|
| 23 |
+
(hnorm : NoAdjacentCrossings D) (hstraight : LocallyStraightCrossings D)
|
| 24 |
+
(htrans : LocallyTransverseCrossings D)
|
| 25 |
+
(P : ∀ e : BipartiteEdge m n, PolygonalChain (Set.range (D.edge e))
|
| 26 |
+
(D.vertex (.inl e.1)) (D.vertex (.inr e.2)))
|
| 27 |
+
(hmin : ∀ e, ∀ Q : PolygonalChain (Set.range (D.edge e))
|
| 28 |
+
(D.vertex (.inl e.1)) (D.vertex (.inr e.2)), (P e).pieces ≤ Q.pieces)
|
| 29 |
+
(r : ℝ) (hr : 0 < r)
|
| 30 |
+
(hshort : ∀ e, 4*r^2 < squaredLength ((P e).vertices 1-(P e).vertices 0) ∧
|
| 31 |
+
4*r^2 < squaredLength ((P e).vertices (P e).pieces-(P e).vertices ((P e).pieces-1)))
|
| 32 |
+
(hclear : ∀ j e (i : Fin (P e).pieces),
|
| 33 |
+
¬ ((j=Sum.inl e.1 ∧ i.val=0) ∨ (j=Sum.inr e.2 ∧ i.val+1=(P e).pieces)) →
|
| 34 |
+
Disjoint (closedRoundDisk (D.vertex j) r) (segment ℝ ((P e).vertices i.val) ((P e).vertices (i.val+1))))
|
| 35 |
+
(e f : BipartiteEdge m n) (hef : e ≠ f) (i : Fin (P e).pieces) (j : Fin (P f).pieces) :
|
| 36 |
+
SegmentPairTransverse ((P e).truncatedVertices r i.val) ((P e).truncatedVertices r (i.val+1))
|
| 37 |
+
((P f).truncatedVertices r j.val) ((P f).truncatedVertices r (j.val+1)) := by
|
| 38 |
+
intro s hs t ht he
|
| 39 |
+
let x := segmentPoint ((P e).truncatedVertices r i.val) ((P e).truncatedVertices r (i.val+1)) s
|
| 40 |
+
have hxe : x ∈ segment ℝ ((P e).truncatedVertices r i.val) ((P e).truncatedVertices r (i.val+1)) := by
|
| 41 |
+
rw [← Path.range_segment]
|
| 42 |
+
exact ⟨⟨s,hs⟩,by simp only [Path.segment_apply,AffineMap.lineMap_apply_module,segmentPoint,x]⟩
|
| 43 |
+
have hxf : x ∈ segment ℝ ((P f).truncatedVertices r j.val) ((P f).truncatedVertices r (j.val+1)) := by
|
| 44 |
+
rw [← Path.range_segment]
|
| 45 |
+
refine ⟨⟨t,ht⟩,?_⟩
|
| 46 |
+
simpa only [Path.segment_apply,AffineMap.lineMap_apply_module,x,segmentPoint] using he.symm
|
| 47 |
+
have hie := truncated_range_subset_edgeInterior D.toContinuousDrawing P hmin r hr hshort hclear e
|
| 48 |
+
(polygonalArcPath_piece_subset_range _ _ i.val i.isLt hxe)
|
| 49 |
+
have hif := truncated_range_subset_edgeInterior D.toContinuousDrawing P hmin r hr hshort hclear f
|
| 50 |
+
(polygonalArcPath_piece_subset_range _ _ j.val j.isLt hxf)
|
| 51 |
+
have hcross : x ∈ crossingPoints D.toContinuousDrawing := ⟨e,f,hef,hie,hif⟩
|
| 52 |
+
have hcorner := truncated_vertices_not_crossing D hnorm hstraight P hmin r hclear
|
| 53 |
+
have hsi := segment_parameter_strict_of_avoids_endpoints _ _ x _ hcross
|
| 54 |
+
(hcorner e i.val (by omega)) (hcorner e (i.val+1) (by omega)) s hs rfl
|
| 55 |
+
have hti := segment_parameter_strict_of_avoids_endpoints _ _ x _ hcross
|
| 56 |
+
(hcorner f j.val (by omega)) (hcorner f (j.val+1) (by omega)) t ht he.symm
|
| 57 |
+
refine ⟨?_,hsi,hti⟩
|
| 58 |
+
have hweak (g : BipartiteEdge m n) :
|
| 59 |
+
r^2 < squaredLength ((P g).vertices 1-(P g).vertices 0) ∧
|
| 60 |
+
r^2 < squaredLength ((P g).vertices (P g).pieces-(P g).vertices ((P g).pieces-1)) := by
|
| 61 |
+
constructor <;> nlinarith [(hshort g).1,(hshort g).2,sq_nonneg r]
|
| 62 |
+
have hde := minimum_piece_det_at_crossing D hstraight htrans e f hef (P e) (P f) (hmin e) (hmin f)
|
| 63 |
+
i.val j.val i.isLt j.isLt x hie hif
|
| 64 |
+
((P e).truncated_piece_subset r hr (hweak e).1 (hweak e).2 i.val i.isLt hxe)
|
| 65 |
+
((P f).truncated_piece_subset r hr (hweak f).1 (hweak f).2 j.val j.isLt hxf)
|
| 66 |
+
change det2 (trackDirection ((P e).truncatedVertices r) i.val) (trackDirection ((P f).truncatedVertices r) j.val) ≠ 0
|
| 67 |
+
rw [(P e).truncated_direction r i.val i.isLt,(P f).truncated_direction r j.val j.isLt,
|
| 68 |
+
det2_smul_left,det2_smul_right]
|
| 69 |
+
exact mul_ne_zero (ne_of_gt ((P e).truncatedScale_pos r hr (hshort e).1 (hshort e).2 i.val))
|
| 70 |
+
(mul_ne_zero (ne_of_gt ((P f).truncatedScale_pos r hr (hshort f).1 (hshort f).2 j.val)) hde)
|
| 71 |
+
|
| 72 |
+
end Zarankiewicz
|
| 73 |
+
|
| 74 |
+
end
|
| 75 |
+
|
| 76 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/TruncatedSignedIntersections.lean
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.UniformTrackPerturbation
|
| 2 |
+
import OAI.Combinatorics.Crossing.RowCrossingCount
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
namespace Zarankiewicz.VertexTruncation
|
| 8 |
+
open scoped BigOperators
|
| 9 |
+
variable {m n : ℕ} {D : ContinuousDrawing m n} (V : VertexTruncation D)
|
| 10 |
+
|
| 11 |
+
theorem piece_subset_range (e : BipartiteEdge m n) (i : ℕ) (hi : i<V.pieces e) :
|
| 12 |
+
segment ℝ (V.vertices e i) (V.vertices e (i+1)) ⊆ Set.range (V.path e) := by
|
| 13 |
+
exact ((V.chain e).truncated (V.pieces_pos e) V.radius V.radius_pos
|
| 14 |
+
(V.weak_short e).1 (V.weak_short e).2).piece_subset_path_range i hi
|
| 15 |
+
|
| 16 |
+
def signedIntersection (e f : BipartiteEdge m n) : ℝ :=
|
| 17 |
+
if e=f then 0 else polygonIntersection (V.vertices e) (V.vertices f) (V.pieces e) (V.pieces f)
|
| 18 |
+
|
| 19 |
+
theorem signedIntersection_self (e : BipartiteEdge m n) : V.signedIntersection e e=0 := by
|
| 20 |
+
simp [signedIntersection]
|
| 21 |
+
|
| 22 |
+
theorem signedIntersection_swap (e f : BipartiteEdge m n) : V.signedIntersection f e = -V.signedIntersection e f := by
|
| 23 |
+
by_cases h : e=f
|
| 24 |
+
· subst f
|
| 25 |
+
simp [V.signedIntersection_self]
|
| 26 |
+
· simp only [signedIntersection,ite_eq_right h,ite_eq_right (Ne.symm h)]
|
| 27 |
+
exact polygonIntersection_swap _ _ _ _
|
| 28 |
+
|
| 29 |
+
theorem signedIntersection_zero_of_pairCrossings_empty {A : AdmissibleDrawing m n}
|
| 30 |
+
(V : VertexTruncation A.toContinuousDrawing) (e f : BipartiteEdge m n)
|
| 31 |
+
(hempty : pairCrossings A e f=∅) : V.signedIntersection e f=0 := by
|
| 32 |
+
classical
|
| 33 |
+
by_cases hef : e=f
|
| 34 |
+
· subst f
|
| 35 |
+
exact V.signedIntersection_self e
|
| 36 |
+
· rw [signedIntersection,ite_eq_right hef]
|
| 37 |
+
unfold polygonIntersection
|
| 38 |
+
apply Finset.sum_eq_zero
|
| 39 |
+
intro i hi
|
| 40 |
+
apply Finset.sum_eq_zero
|
| 41 |
+
intro j hj
|
| 42 |
+
have hnot : ¬ SegmentsCrossProperly (V.vertices e i) (V.vertices e (i+1))
|
| 43 |
+
(V.vertices f j) (V.vertices f (j+1)) := by
|
| 44 |
+
rintro ⟨_,s,hs,t,ht,he⟩
|
| 45 |
+
let x := segmentPoint (V.vertices e i) (V.vertices e (i+1)) s
|
| 46 |
+
have hxe : x ∈ edgeInterior A.toContinuousDrawing e := by
|
| 47 |
+
apply V.range_subset_edgeInterior e
|
| 48 |
+
apply V.piece_subset_range e i (Finset.mem_range.mp hi)
|
| 49 |
+
rw [← Path.range_segment]
|
| 50 |
+
exact ⟨⟨s,⟨hs.1.le,hs.2.le⟩⟩,by simp only [Path.segment_apply,AffineMap.lineMap_apply_module,x,segmentPoint]⟩
|
| 51 |
+
have hxf : x ∈ edgeInterior A.toContinuousDrawing f := by
|
| 52 |
+
apply V.range_subset_edgeInterior f
|
| 53 |
+
apply V.piece_subset_range f j (Finset.mem_range.mp hj)
|
| 54 |
+
rw [← Path.range_segment]
|
| 55 |
+
refine ⟨⟨t,⟨ht.1.le,ht.2.le⟩⟩,?_⟩
|
| 56 |
+
simpa only [Path.segment_apply,AffineMap.lineMap_apply_module,x,segmentPoint] using he.symm
|
| 57 |
+
have hx : x ∈ pairCrossings A e f := by
|
| 58 |
+
apply Finset.mem_filter.mpr
|
| 59 |
+
exact ⟨by simpa using (show x ∈ crossingPoints A.toContinuousDrawing from ⟨e,f,hef,hxe,hxf⟩),hef,hxe,hxf⟩
|
| 60 |
+
rw [hempty] at hx
|
| 61 |
+
exact Finset.notMem_empty x hx
|
| 62 |
+
simp [segmentCrossingSign,hnot]
|
| 63 |
+
|
| 64 |
+
theorem pairCrossings_pos_of_signedIntersection_ne_zero {A : AdmissibleDrawing m n}
|
| 65 |
+
(V : VertexTruncation A.toContinuousDrawing) (e f : BipartiteEdge m n)
|
| 66 |
+
(h : V.signedIntersection e f ≠ 0) : 0 < (pairCrossings A e f).card := by
|
| 67 |
+
by_contra hh
|
| 68 |
+
have hz : (pairCrossings A e f).card=0 := by omega
|
| 69 |
+
exact h (V.signedIntersection_zero_of_pairCrossings_empty e f (Finset.card_eq_zero.mp hz))
|
| 70 |
+
|
| 71 |
+
theorem signedIntersection_adjacent_zero {A : AdmissibleDrawing m n}
|
| 72 |
+
(V : VertexTruncation A.toContinuousDrawing) (hnorm : NoAdjacentCrossings A)
|
| 73 |
+
(e f : BipartiteEdge m n) (hadj : e.1=f.1 ∨ e.2=f.2) : V.signedIntersection e f=0 :=
|
| 74 |
+
V.signedIntersection_zero_of_pairCrossings_empty e f (pairCrossings_eq_empty_of_adjacent A hnorm e f hadj)
|
| 75 |
+
|
| 76 |
+
end Zarankiewicz.VertexTruncation
|
| 77 |
+
|
| 78 |
+
end
|
| 79 |
+
|
| 80 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/TruncatedSpokeCoordinates.lean
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.TruncatedSpokeDirections
|
| 2 |
+
import OAI.Combinatorics.Crossing.TangentTrackIdentity
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
namespace Zarankiewicz
|
| 8 |
+
variable {m n : ℕ} {D : ContinuousDrawing m n}
|
| 9 |
+
|
| 10 |
+
structure TruncatedSpokeCoordinates (V : VertexTruncation D) where
|
| 11 |
+
frame : BipartiteVertex m n → Plane
|
| 12 |
+
frame_ne_zero : ∀ j, frame j ≠ 0
|
| 13 |
+
frame_length : ∀ j, squaredLength (frame j)=V.radius^2
|
| 14 |
+
node : ∀ j, IncidentEdges j → ℝ
|
| 15 |
+
node_injective : ∀ j, Function.Injective (node j)
|
| 16 |
+
point_eq : ∀ j e, similarityPoint (D.vertex j) (frame j) (circlePoint (node j e))=V.spokePort j e
|
| 17 |
+
|
| 18 |
+
theorem nonempty_truncatedSpokeCoordinates {A : AdmissibleDrawing m n}
|
| 19 |
+
(V : VertexTruncation A.toContinuousDrawing) (hnorm : NoAdjacentCrossings A) :
|
| 20 |
+
Nonempty (TruncatedSpokeCoordinates V) := by
|
| 21 |
+
have hex (j : BipartiteVertex m n) := exists_finite_circle_coordinates
|
| 22 |
+
(A.vertex j) V.radius V.radius_pos (V.spokePort j)
|
| 23 |
+
(V.spokePort_injective hnorm j) (V.spokePort_circle j)
|
| 24 |
+
choose u hu hlen node hnode hpoint using hex
|
| 25 |
+
exact ⟨⟨u,hu,hlen,node,hnode,hpoint⟩⟩
|
| 26 |
+
|
| 27 |
+
namespace TruncatedSpokeCoordinates
|
| 28 |
+
variable {V : VertexTruncation D} (C : TruncatedSpokeCoordinates V)
|
| 29 |
+
|
| 30 |
+
def shiftedPort (j : BipartiteVertex m n) (e : IncidentEdges j) (ε : ℝ) : Plane :=
|
| 31 |
+
similarityPoint (D.vertex j) (C.frame j)
|
| 32 |
+
(circleOffset (circlePoint (C.node j e)) (V.spokeScale j e*ε))
|
| 33 |
+
|
| 34 |
+
def tangentPort (_C : TruncatedSpokeCoordinates V) (j : BipartiteVertex m n) (e : IncidentEdges j) (ε : ℝ) : Plane :=
|
| 35 |
+
V.spokePort j e+ε • normalShift (V.spokeDirection j e)
|
| 36 |
+
|
| 37 |
+
theorem tangentPort_eq (j : BipartiteVertex m n) (e : IncidentEdges j) (ε : ℝ) :
|
| 38 |
+
C.tangentPort j e ε = similarityPoint (D.vertex j) (C.frame j)
|
| 39 |
+
(circleTangentOffset (circlePoint (C.node j e)) (V.spokeScale j e*ε)) := by
|
| 40 |
+
have hh := tangentOffset_eq_normalShift (D.vertex j) (C.frame j) (circlePoint (C.node j e))
|
| 41 |
+
(V.spokeDirection j e) (V.spokeDirection_ne_zero j e)
|
| 42 |
+
(by simpa only [C.point_eq] using V.spokePort_ne_center j e)
|
| 43 |
+
(by simpa only [C.point_eq] using V.spokeDirection_parallel j e) ε
|
| 44 |
+
simpa only [C.point_eq,VertexTruncation.spokeScale,tangentPort] using hh.symm
|
| 45 |
+
|
| 46 |
+
theorem shiftedPort_level (j : BipartiteVertex m n) (e : IncidentEdges j) (ε : ℝ) :
|
| 47 |
+
det2 (V.spokeDirection j e) (C.shiftedPort j e ε-V.spokePort j e)=ε := by
|
| 48 |
+
have hh := circleOffset_track_level (D.vertex j) (C.frame j) (circlePoint (C.node j e))
|
| 49 |
+
(V.spokeDirection j e) (V.spokeDirection_ne_zero j e)
|
| 50 |
+
(by simpa only [C.point_eq] using V.spokePort_ne_center j e)
|
| 51 |
+
(by simpa only [C.point_eq] using V.spokeDirection_parallel j e) ε
|
| 52 |
+
simpa only [C.point_eq,VertexTruncation.spokeScale,shiftedPort] using hh
|
| 53 |
+
|
| 54 |
+
theorem shiftedPort_circle (j : BipartiteVertex m n) (e : IncidentEdges j) (ε : ℝ)
|
| 55 |
+
(hε : |V.spokeScale j e*ε| ≤ 1) :
|
| 56 |
+
squaredLength (C.shiftedPort j e ε-D.vertex j)=V.radius^2 := by
|
| 57 |
+
unfold shiftedPort
|
| 58 |
+
rw [similarityPoint_squaredLength,circleOffset_on_circle _ (circlePoint_on_unit_circle _) _ hε,
|
| 59 |
+
mul_one,C.frame_length]
|
| 60 |
+
|
| 61 |
+
theorem connector_strictly_outside (j : BipartiteVertex m n) (e : IncidentEdges j) (ε : ℝ)
|
| 62 |
+
(hε : |V.spokeScale j e*ε| < 1) (hne : ε ≠ 0) (t : ℝ) (ht : 0<t) :
|
| 63 |
+
V.radius^2 < squaredLength (segmentPoint (C.shiftedPort j e ε) (C.tangentPort j e ε) t-D.vertex j) := by
|
| 64 |
+
rw [C.tangentPort_eq]
|
| 65 |
+
have hh := physical_circleConnector_strictly_outside (D.vertex j) (C.frame j)
|
| 66 |
+
(circlePoint (C.node j e)) (C.frame_ne_zero j) (circlePoint_on_unit_circle _)
|
| 67 |
+
(V.spokeScale j e*ε) hε (mul_ne_zero (V.spokeScale_ne_zero j e) hne) t ht
|
| 68 |
+
simpa only [C.frame_length,shiftedPort] using hh
|
| 69 |
+
|
| 70 |
+
theorem exists_vertex_average_radius (j : BipartiteVertex m n) :
|
| 71 |
+
∃ δ : ℝ, 0 < δ ∧ ∀ t : ℝ, 0 < t → t < δ → ∀ a b c d : IncidentEdges j,
|
| 72 |
+
a ≠ b → c ≠ d →
|
| 73 |
+
(segmentCrossingSign (V.spokePort j a) (V.spokePort j b) (C.shiftedPort j c t) (C.shiftedPort j d t)+
|
| 74 |
+
segmentCrossingSign (V.spokePort j a) (V.spokePort j b) (C.shiftedPort j c (-t)) (C.shiftedPort j d (-t)))/2 =
|
| 75 |
+
chordEndpointPairing (C.node j a) (C.node j b) (C.node j c) (C.node j d) := by
|
| 76 |
+
classical
|
| 77 |
+
obtain ⟨δ,hδ,hh⟩ := physical_spoke_average_in_similarity (D.vertex j) (C.frame j) (C.frame_ne_zero j)
|
| 78 |
+
(C.node j) (V.spokeScale j) (C.node_injective j) (V.spokeScale_ne_zero j)
|
| 79 |
+
refine ⟨δ,hδ,?_⟩
|
| 80 |
+
intro t ht hsmall a b c d hab hcd
|
| 81 |
+
simpa only [C.point_eq,shiftedPort] using hh t ht hsmall a b c d hab hcd
|
| 82 |
+
|
| 83 |
+
end TruncatedSpokeCoordinates
|
| 84 |
+
end Zarankiewicz
|
| 85 |
+
|
| 86 |
+
end
|
| 87 |
+
|
| 88 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/TruncatedSpokeDirections.lean
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.VertexTruncationGeometry
|
| 2 |
+
import OAI.Combinatorics.Crossing.SpokeTrackDirections
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
namespace Zarankiewicz.VertexTruncation
|
| 8 |
+
variable {m n : ℕ} {D : ContinuousDrawing m n} (V : VertexTruncation D)
|
| 9 |
+
|
| 10 |
+
def spokePort (j : BipartiteVertex m n) (e : IncidentEdges j) : Plane :=
|
| 11 |
+
drawingSpokePort D V.chain V.radius j e
|
| 12 |
+
|
| 13 |
+
def spokeIndex (j : BipartiteVertex m n) (e : IncidentEdges j) : ℕ :=
|
| 14 |
+
if j=Sum.inl e.val.1 then 0 else V.pieces e.val-1
|
| 15 |
+
|
| 16 |
+
def spokeDirection (j : BipartiteVertex m n) (e : IncidentEdges j) : Plane :=
|
| 17 |
+
trackDirection (V.vertices e.val) (V.spokeIndex j e)
|
| 18 |
+
|
| 19 |
+
theorem spokeIndex_lt (j : BipartiteVertex m n) (e : IncidentEdges j) :
|
| 20 |
+
V.spokeIndex j e < V.pieces e.val := by
|
| 21 |
+
have hp := V.pieces_pos e.val
|
| 22 |
+
unfold spokeIndex
|
| 23 |
+
split_ifs <;> omega
|
| 24 |
+
|
| 25 |
+
theorem spokeDirection_ne_zero (j : BipartiteVertex m n) (e : IncidentEdges j) :
|
| 26 |
+
V.spokeDirection j e ≠ 0 := V.direction_ne_zero e.val _ (V.spokeIndex_lt j e)
|
| 27 |
+
|
| 28 |
+
theorem spokeDirection_eq_scale (j : BipartiteVertex m n) (e : IncidentEdges j) :
|
| 29 |
+
V.spokeDirection j e =
|
| 30 |
+
(V.chain e.val).truncatedScale V.radius (V.spokeIndex j e) •
|
| 31 |
+
drawingSpokeDirection D V.chain j e := by
|
| 32 |
+
change trackDirection ((V.chain e.val).truncatedVertices V.radius) (V.spokeIndex j e)=_
|
| 33 |
+
rw [(V.chain e.val).truncated_direction V.radius _ (V.spokeIndex_lt j e)]
|
| 34 |
+
congr 1
|
| 35 |
+
unfold spokeIndex drawingSpokeDirection
|
| 36 |
+
split_ifs <;> rfl
|
| 37 |
+
|
| 38 |
+
theorem spokePort_circle (j : BipartiteVertex m n) (e : IncidentEdges j) :
|
| 39 |
+
squaredLength (V.spokePort j e-D.vertex j)=V.radius^2 :=
|
| 40 |
+
drawingSpokePort_circle D V.chain V.minimal V.radius j e
|
| 41 |
+
|
| 42 |
+
theorem spokePort_ne_center (j : BipartiteVertex m n) (e : IncidentEdges j) :
|
| 43 |
+
V.spokePort j e-D.vertex j ≠ 0 := by
|
| 44 |
+
intro h
|
| 45 |
+
have hc := V.spokePort_circle j e
|
| 46 |
+
rw [h] at hc
|
| 47 |
+
have hz : squaredLength (0 : Plane)=0 := by simp [squaredLength]
|
| 48 |
+
rw [hz] at hc
|
| 49 |
+
nlinarith [V.radius_pos]
|
| 50 |
+
|
| 51 |
+
theorem spokeDirection_parallel (j : BipartiteVertex m n) (e : IncidentEdges j) :
|
| 52 |
+
det2 (V.spokeDirection j e) (V.spokePort j e-D.vertex j)=0 := by
|
| 53 |
+
rw [V.spokeDirection_eq_scale,det2_smul_left]
|
| 54 |
+
have hp := drawingSpokeDirection_port_parallel D V.chain V.radius j e (V.pieces_pos e.val)
|
| 55 |
+
change det2 (drawingSpokeDirection D V.chain j e) (V.spokePort j e-D.vertex j)=0 at hp
|
| 56 |
+
rw [hp,mul_zero]
|
| 57 |
+
|
| 58 |
+
def spokeScale (j : BipartiteVertex m n) (e : IncidentEdges j) : ℝ :=
|
| 59 |
+
circleTrackScale (V.spokeDirection j e) (V.spokePort j e-D.vertex j)
|
| 60 |
+
|
| 61 |
+
theorem spokeScale_ne_zero (j : BipartiteVertex m n) (e : IncidentEdges j) :
|
| 62 |
+
V.spokeScale j e ≠ 0 :=
|
| 63 |
+
circleTrackScale_ne_zero _ _ (V.spokeDirection_ne_zero j e)
|
| 64 |
+
(V.spokePort_ne_center j e) (V.spokeDirection_parallel j e)
|
| 65 |
+
|
| 66 |
+
theorem spokePort_injective {A : AdmissibleDrawing m n}
|
| 67 |
+
(V : VertexTruncation A.toContinuousDrawing) (hnorm : NoAdjacentCrossings A)
|
| 68 |
+
(j : BipartiteVertex m n) : Function.Injective (V.spokePort j) :=
|
| 69 |
+
drawingSpokePort_injective A hnorm V.chain V.minimal V.radius V.radius_pos V.weak_short j
|
| 70 |
+
|
| 71 |
+
end Zarankiewicz.VertexTruncation
|
| 72 |
+
|
| 73 |
+
end
|
| 74 |
+
|
| 75 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/TruncatedTraceDecomposition.lean
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.TruncatedChainPath
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
namespace Zarankiewicz
|
| 7 |
+
|
| 8 |
+
theorem center_segment_in_disk (o p : Plane) (r : ℝ) (hp : squaredLength (p-o)=r^2) :
|
| 9 |
+
segment ℝ o p ⊆ closedRoundDisk o r := by
|
| 10 |
+
intro x hx
|
| 11 |
+
rw [← Path.range_segment] at hx
|
| 12 |
+
obtain ⟨t,ht⟩ := hx
|
| 13 |
+
have he : squaredLength (segmentPoint o p t.val-o)=t.val^2*squaredLength (p-o) := by
|
| 14 |
+
dsimp [segmentPoint,squaredLength]
|
| 15 |
+
ring
|
| 16 |
+
have ht2 : t.val^2 ≤ 1 := by nlinarith [t.property.1,t.property.2]
|
| 17 |
+
have hh := mul_le_mul_of_nonneg_right ht2 (sq_nonneg r)
|
| 18 |
+
change squaredLength (x-o) ≤ r^2
|
| 19 |
+
have ht' : segmentPoint o p t.val=x := by
|
| 20 |
+
simpa only [Path.segment_apply,AffineMap.lineMap_apply_module,segmentPoint] using ht
|
| 21 |
+
rw [← ht',he,hp]
|
| 22 |
+
simpa only [one_mul] using hh
|
| 23 |
+
|
| 24 |
+
theorem drawing_edge_trace_decomposition {m n : ℕ} (D : ContinuousDrawing m n)
|
| 25 |
+
(e : BipartiteEdge m n)
|
| 26 |
+
(P : PolygonalChain (Set.range (D.edge e)) (D.vertex (.inl e.1)) (D.vertex (.inr e.2)))
|
| 27 |
+
(r : ℝ) (hr : 0 < r)
|
| 28 |
+
(hfirst : r^2 < squaredLength (P.vertices 1-P.vertices 0))
|
| 29 |
+
(hlast : r^2 < squaredLength (P.vertices P.pieces-P.vertices (P.pieces-1))) :
|
| 30 |
+
Set.range (D.edge e)=
|
| 31 |
+
segment ℝ (D.vertex (.inl e.1)) (P.startPort r) ∪
|
| 32 |
+
Set.range (polygonalArcPath (P.truncatedVertices r) P.pieces) ∪
|
| 33 |
+
segment ℝ (P.endPort r) (D.vertex (.inr e.2)) := by
|
| 34 |
+
have hp := drawing_chain_pieces_pos D e P
|
| 35 |
+
have hs : segment ℝ (D.vertex (.inl e.1)) (P.startPort r) ⊆ Set.range (D.edge e) := by
|
| 36 |
+
have hx := openSegmentTrace_subset_segment _ _ (radialPort_mem_openSegment (P.vertices 0) (P.vertices 1) r hr hfirst)
|
| 37 |
+
have hh := ((convex_segment (𝕜 := ℝ) _ _).segment_subset (left_mem_segment ℝ _ _) hx).trans (P.inside 0 hp)
|
| 38 |
+
simpa only [PolygonalChain.startPort,P.first] using hh
|
| 39 |
+
have ht : segment ℝ (P.endPort r) (D.vertex (.inr e.2)) ⊆ Set.range (D.edge e) := by
|
| 40 |
+
have hlen : r^2 < squaredLength (P.vertices (P.pieces-1)-P.vertices P.pieces) := by
|
| 41 |
+
rwa [squaredLength_sub_comm]
|
| 42 |
+
have hx := openSegmentTrace_subset_segment _ _
|
| 43 |
+
(openSegmentTrace_reverse_mem _ _ _ (radialPort_mem_openSegment _ _ r hr hlen))
|
| 44 |
+
have hinside := P.inside (P.pieces-1) (by omega)
|
| 45 |
+
rw [show P.pieces-1+1=P.pieces by omega] at hinside
|
| 46 |
+
have hh := ((convex_segment (𝕜 := ℝ) _ _).segment_subset hx (right_mem_segment ℝ _ _)).trans hinside
|
| 47 |
+
simpa only [PolygonalChain.endPort,P.last] using hh
|
| 48 |
+
let T := P.truncated hp r hr hfirst hlast
|
| 49 |
+
let G := ((Path.segment (D.vertex (.inl e.1)) (P.startPort r)).trans T.path).trans
|
| 50 |
+
(Path.segment (P.endPort r) (D.vertex (.inr e.2)))
|
| 51 |
+
have hG : Set.range G ⊆ Set.range (D.edge e) := by
|
| 52 |
+
dsimp [G]
|
| 53 |
+
rw [Path.trans_range,Path.trans_range,Path.range_segment,Path.range_segment]
|
| 54 |
+
exact Set.union_subset (Set.union_subset hs T.path_range_subset) ht
|
| 55 |
+
have he := path_range_eq_of_subset (D.edge e) G (D.edge_injective e) hG
|
| 56 |
+
calc
|
| 57 |
+
Set.range (D.edge e) = Set.range G := he.symm
|
| 58 |
+
_ = _ := by
|
| 59 |
+
dsimp [G]
|
| 60 |
+
rw [Path.trans_range,Path.trans_range,Path.range_segment,Path.range_segment]
|
| 61 |
+
rfl
|
| 62 |
+
|
| 63 |
+
end Zarankiewicz
|
| 64 |
+
|
| 65 |
+
end
|
| 66 |
+
|
| 67 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/TruncatedTrackAvoidance.lean
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.TruncatedChainDirections
|
| 2 |
+
import OAI.Combinatorics.Crossing.SegmentClosedIncidence
|
| 3 |
+
import OAI.Combinatorics.Crossing.SharedTrackAvoidance
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
noncomputable section
|
| 8 |
+
namespace Zarankiewicz.PolygonalChain
|
| 9 |
+
variable {O : Set Plane} {a b : Plane}
|
| 10 |
+
|
| 11 |
+
theorem truncated_bend_ne_zero (P : PolygonalChain O a b)
|
| 12 |
+
(hmin : ∀ Q : PolygonalChain O a b, P.pieces ≤ Q.pieces)
|
| 13 |
+
(r : ℝ) (hr : 0 < r)
|
| 14 |
+
(hfirst : 4*r^2 < squaredLength (P.vertices 1-P.vertices 0))
|
| 15 |
+
(hlast : 4*r^2 < squaredLength (P.vertices P.pieces-P.vertices (P.pieces-1)))
|
| 16 |
+
(i : ℕ) (hi : 0 < i) (hi' : i < P.pieces) :
|
| 17 |
+
det2 (trackDirection (P.truncatedVertices r) (i-1)) (trackDirection (P.truncatedVertices r) i) ≠ 0 := by
|
| 18 |
+
rw [P.truncated_direction r (i-1) (by omega),P.truncated_direction r i hi',det2_smul_left,det2_smul_right]
|
| 19 |
+
apply mul_ne_zero (ne_of_gt (P.truncatedScale_pos r hr hfirst hlast (i-1)))
|
| 20 |
+
apply mul_ne_zero (ne_of_gt (P.truncatedScale_pos r hr hfirst hlast i))
|
| 21 |
+
have h := P.minimum_bend_det_ne_zero hmin (i-1) (by omega)
|
| 22 |
+
simpa only [trackDirection,show i-1+1=i by omega,show i-1+2=i+1 by omega] using h
|
| 23 |
+
|
| 24 |
+
theorem truncated_offset_avoidance (P : PolygonalChain O a b)
|
| 25 |
+
(hmin : ∀ Q : PolygonalChain O a b, P.pieces ≤ Q.pieces)
|
| 26 |
+
(r : ℝ) (hr : 0 < r)
|
| 27 |
+
(hfirst : 4*r^2 < squaredLength (P.vertices 1-P.vertices 0))
|
| 28 |
+
(hlast : 4*r^2 < squaredLength (P.vertices P.pieces-P.vertices (P.pieces-1))) :
|
| 29 |
+
∃ δ : ℝ, 0 < δ ∧ ∀ t : ℝ, t ≠ 0 → |t| < δ → ∀ i j : Fin P.pieces,
|
| 30 |
+
¬ ClosedSegmentsMeet (P.truncatedVertices r i.val) (P.truncatedVertices r (i.val+1))
|
| 31 |
+
(shiftedTrack (P.truncatedVertices r) P.pieces t j.val)
|
| 32 |
+
(shiftedTrack (P.truncatedVertices r) P.pieces t (j.val+1)) := by
|
| 33 |
+
apply exists_shared_track_avoidance_radius (P.truncatedVertices r) P.pieces
|
| 34 |
+
(P.truncated_direction_ne_zero hmin r hr hfirst hlast)
|
| 35 |
+
(P.truncated_bend_ne_zero hmin r hr hfirst hlast)
|
| 36 |
+
intro i j hij
|
| 37 |
+
have hdis : Disjoint (segment ℝ (P.vertices i.val) (P.vertices (i.val+1)))
|
| 38 |
+
(segment ℝ (P.vertices j.val) (P.vertices (j.val+1))) := by
|
| 39 |
+
rcases hij with h | h
|
| 40 |
+
· exact P.minimum_nonadjacent_disjoint hmin i.val j.val h j.isLt
|
| 41 |
+
· exact (P.minimum_nonadjacent_disjoint hmin j.val i.val h i.isLt).symm
|
| 42 |
+
have hfst : r^2 < squaredLength (P.vertices 1-P.vertices 0) := by nlinarith [sq_nonneg r]
|
| 43 |
+
have hlst : r^2 < squaredLength (P.vertices P.pieces-P.vertices (P.pieces-1)) := by nlinarith [sq_nonneg r]
|
| 44 |
+
exact not_closedSegmentsMeet_of_disjoint _ _ _ _ (hdis.mono
|
| 45 |
+
(P.truncated_piece_subset r hr hfst hlst i.val i.isLt)
|
| 46 |
+
(P.truncated_piece_subset r hr hfst hlst j.val j.isLt))
|
| 47 |
+
|
| 48 |
+
end Zarankiewicz.PolygonalChain
|
| 49 |
+
|
| 50 |
+
end
|
| 51 |
+
|
| 52 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/TruncatedTrackStability.lean
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.VertexTruncationGeometry
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
namespace Zarankiewicz.VertexTruncation
|
| 7 |
+
variable {m n : ℕ} {D : AdmissibleDrawing m n}
|
| 8 |
+
|
| 9 |
+
theorem exists_distinct_edge_shift_radius (V : VertexTruncation D.toContinuousDrawing)
|
| 10 |
+
(hnorm : NoAdjacentCrossings D) (hstraight : LocallyStraightCrossings D) (htrans : LocallyTransverseCrossings D) :
|
| 11 |
+
∃ δ : ℝ, 0 < δ ∧ ∀ t : ℝ, |t| < δ → ∀ e f : BipartiteEdge m n, e ≠ f →
|
| 12 |
+
∀ i : Fin (V.pieces e), ∀ j : Fin (V.pieces f),
|
| 13 |
+
SegmentPairTransverse (V.vertices e i.val) (V.vertices e (i.val+1))
|
| 14 |
+
(shiftedTrack (V.vertices f) (V.pieces f) t j.val)
|
| 15 |
+
(shiftedTrack (V.vertices f) (V.pieces f) t (j.val+1)) ∧
|
| 16 |
+
segmentCrossingSign (V.vertices e i.val) (V.vertices e (i.val+1))
|
| 17 |
+
(shiftedTrack (V.vertices f) (V.pieces f) t j.val)
|
| 18 |
+
(shiftedTrack (V.vertices f) (V.pieces f) t (j.val+1)) =
|
| 19 |
+
segmentCrossingSign (V.vertices e i.val) (V.vertices e (i.val+1))
|
| 20 |
+
(V.vertices f j.val) (V.vertices f (j.val+1)) := by
|
| 21 |
+
classical
|
| 22 |
+
let Pair := Σ e : BipartiteEdge m n, Σ f : {f : BipartiteEdge m n // e ≠ f},
|
| 23 |
+
Fin (V.pieces e) × Fin (V.pieces f.val)
|
| 24 |
+
let a : Pair → Plane := fun k => V.vertices k.1 k.2.2.1.val
|
| 25 |
+
let b : Pair → Plane := fun k => V.vertices k.1 (k.2.2.1.val+1)
|
| 26 |
+
let c : Pair → Plane := fun k => V.vertices k.2.1.val k.2.2.2.val
|
| 27 |
+
let d : Pair → Plane := fun k => V.vertices k.2.1.val (k.2.2.2.val+1)
|
| 28 |
+
let qc : Pair → Plane := fun k => trackOffset (V.vertices k.2.1.val) (V.pieces k.2.1.val) k.2.2.2.val
|
| 29 |
+
let qd : Pair → Plane := fun k => trackOffset (V.vertices k.2.1.val) (V.pieces k.2.1.val) (k.2.2.2.val+1)
|
| 30 |
+
have hh (k : Pair) : SegmentPairTransverse (a k) (b k) (c k) (d k) :=
|
| 31 |
+
V.pair_transverse hnorm hstraight htrans k.1 k.2.1.val k.2.1.property k.2.2.1 k.2.2.2
|
| 32 |
+
obtain ⟨δ,hδ,hstable⟩ := exists_shifted_segment_pairs_radius a b c d qc qd hh
|
| 33 |
+
refine ⟨δ,hδ,?_⟩
|
| 34 |
+
intro t ht e f hef i j
|
| 35 |
+
exact hstable t ht ⟨e,⟨f,hef⟩,i,j⟩
|
| 36 |
+
|
| 37 |
+
end Zarankiewicz.VertexTruncation
|
| 38 |
+
|
| 39 |
+
end
|
| 40 |
+
|
| 41 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/TwoTriangleBasis.lean
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.BivariateCoefficients
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
namespace Zarankiewicz
|
| 7 |
+
open Module
|
| 8 |
+
open scoped BigOperators
|
| 9 |
+
|
| 10 |
+
abbrev TriangleIndex (s : ℕ) := ↥(twoTriangle s)
|
| 11 |
+
|
| 12 |
+
def triangleCoordEquiv (s : ℕ) : BiExponent s ≃ TriangleIndex s :=
|
| 13 |
+
Fintype.equivOfCardEq (by simp [BiExponent, TriangleIndex, card_twoTriangle])
|
| 14 |
+
|
| 15 |
+
def monomialVector (s : ℕ) (node : ℕ → ℝ) (p q : ℕ) : BiExponent s → ℝ :=
|
| 16 |
+
fun ab => node p ^ ab.1.val * node q ^ ab.2.val
|
| 17 |
+
|
| 18 |
+
def triangleMatrix (s : ℕ) (node : ℕ → ℝ) : Matrix (BiExponent s) (BiExponent s) ℝ :=
|
| 19 |
+
fun ab j => monomialVector s node (triangleCoordEquiv s j).val.1
|
| 20 |
+
(triangleCoordEquiv s j).val.2 ab
|
| 21 |
+
|
| 22 |
+
theorem triangleMatrix_eval (s : ℕ) (node : ℕ → ℝ) (c : BiExponent s → ℝ)
|
| 23 |
+
(j : BiExponent s) :
|
| 24 |
+
(triangleMatrix s node).transpose.mulVec c j =
|
| 25 |
+
biEval (node (triangleCoordEquiv s j).val.1) (node (triangleCoordEquiv s j).val.2)
|
| 26 |
+
(biOfCoeffs s c) := by
|
| 27 |
+
rw [biEval_biOfCoeffs]
|
| 28 |
+
simp only [Matrix.mulVec, dotProduct, Matrix.transpose_apply, triangleMatrix,
|
| 29 |
+
monomialVector, Fintype.sum_prod_type]
|
| 30 |
+
|
| 31 |
+
theorem triangleMatrix_isUnit (s : ℕ) (node : ℕ → ℝ)
|
| 32 |
+
(hn : Set.InjOn node (Set.Icc 1 (2*s+1))) : IsUnit (triangleMatrix s node) := by
|
| 33 |
+
rw [← Matrix.isUnit_transpose, ← Matrix.mulVec_injective_iff_isUnit]
|
| 34 |
+
intro c d hcd
|
| 35 |
+
apply biOfCoeffs_injective s
|
| 36 |
+
apply twoTriangle_evaluation_injective s node hn (biOfCoeffs s c) (biOfCoeffs s d)
|
| 37 |
+
(biOfCoeffs_bounded s c) (biOfCoeffs_bounded s d)
|
| 38 |
+
intro p q hpq
|
| 39 |
+
let j := (triangleCoordEquiv s).symm ⟨(p,q), hpq⟩
|
| 40 |
+
have hh := congrFun hcd j
|
| 41 |
+
rw [triangleMatrix_eval, triangleMatrix_eval] at hh
|
| 42 |
+
simpa only [j, Equiv.apply_symm_apply] using hh
|
| 43 |
+
|
| 44 |
+
def twoTriangleBasis (s : ℕ) (node : ℕ → ℝ)
|
| 45 |
+
(hn : Set.InjOn node (Set.Icc 1 (2*s+1))) :
|
| 46 |
+
Basis (BiExponent s) ℝ (BiExponent s → ℝ) :=
|
| 47 |
+
(Pi.basisFun ℝ (BiExponent s)).map
|
| 48 |
+
(LinearEquiv.ofBijective (triangleMatrix s node).mulVecLin
|
| 49 |
+
⟨Matrix.mulVec_injective_of_isUnit (triangleMatrix_isUnit s node hn),
|
| 50 |
+
Matrix.mulVec_surjective_iff_isUnit.mpr (triangleMatrix_isUnit s node hn)⟩)
|
| 51 |
+
|
| 52 |
+
theorem twoTriangleBasis_apply (s : ℕ) (node : ℕ → ℝ)
|
| 53 |
+
(hn : Set.InjOn node (Set.Icc 1 (2*s+1))) (j : BiExponent s) :
|
| 54 |
+
twoTriangleBasis s node hn j =
|
| 55 |
+
monomialVector s node (triangleCoordEquiv s j).val.1 (triangleCoordEquiv s j).val.2 := by
|
| 56 |
+
simp only [twoTriangleBasis, Basis.map_apply, Pi.basisFun_apply]
|
| 57 |
+
change (triangleMatrix s node).mulVec (Pi.single j 1) = _
|
| 58 |
+
funext i
|
| 59 |
+
simp [Matrix.mulVec_single, triangleMatrix]
|
| 60 |
+
|
| 61 |
+
end Zarankiewicz
|
| 62 |
+
|
| 63 |
+
end
|
| 64 |
+
|
| 65 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/TwoTriangleIndices.lean
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib.Data.Finset.Prod
|
| 2 |
+
import Mathlib.Order.Interval.Finset.Nat
|
| 3 |
+
import Mathlib.Data.Nat.Choose.Basic
|
| 4 |
+
import Mathlib.Tactic.Linarith
|
| 5 |
+
import Lean.Elab.Tactic.Omega
|
| 6 |
+
|
| 7 |
+
namespace OAI
|
| 8 |
+
|
| 9 |
+
namespace Zarankiewicz
|
| 10 |
+
open Finset
|
| 11 |
+
|
| 12 |
+
def lowerTriangle (s : ℕ) : Finset (ℕ × ℕ) :=
|
| 13 |
+
((Icc 1 (s+1)) ×ˢ (Icc 1 (s+1))).filter (fun z => z.2 < z.1)
|
| 14 |
+
|
| 15 |
+
def upperTriangle (s : ℕ) : Finset (ℕ × ℕ) :=
|
| 16 |
+
((Icc (s+2) (2*s+1)) ×ˢ (Icc (s+2) (2*s+1))).filter (fun z => z.1 < z.2)
|
| 17 |
+
|
| 18 |
+
def twoTriangle (s : ℕ) : Finset (ℕ × ℕ) := lowerTriangle s ∪ upperTriangle s
|
| 19 |
+
|
| 20 |
+
theorem mem_lowerTriangle (s p q : ℕ) :
|
| 21 |
+
(p,q) ∈ lowerTriangle s ↔ 1 ≤ q ∧ q < p ∧ p ≤ s+1 := by
|
| 22 |
+
simp only [lowerTriangle, mem_filter, mem_product, mem_Icc]
|
| 23 |
+
omega
|
| 24 |
+
|
| 25 |
+
theorem mem_upperTriangle (s p q : ℕ) :
|
| 26 |
+
(p,q) ∈ upperTriangle s ↔ s+1 < p ∧ p < q ∧ q ≤ 2*s+1 := by
|
| 27 |
+
simp only [upperTriangle, mem_filter, mem_product, mem_Icc]
|
| 28 |
+
omega
|
| 29 |
+
|
| 30 |
+
theorem mem_twoTriangle (s p q : ℕ) :
|
| 31 |
+
(p,q) ∈ twoTriangle s ↔
|
| 32 |
+
(1 ≤ q ∧ q < p ∧ p ≤ s+1) ∨ (s+1 < p ∧ p < q ∧ q ≤ 2*s+1) := by
|
| 33 |
+
rw [twoTriangle, mem_union, mem_lowerTriangle, mem_upperTriangle]
|
| 34 |
+
|
| 35 |
+
theorem disjoint_triangles (s : ℕ) : Disjoint (lowerTriangle s) (upperTriangle s) := by
|
| 36 |
+
apply Finset.disjoint_left.mpr
|
| 37 |
+
rintro ⟨p,q⟩ hp hq
|
| 38 |
+
rw [mem_lowerTriangle] at hp
|
| 39 |
+
rw [mem_upperTriangle] at hq
|
| 40 |
+
omega
|
| 41 |
+
|
| 42 |
+
theorem card_lowerTriangle (s : ℕ) : (lowerTriangle s).card = (s+1).choose 2 := by
|
| 43 |
+
have hswap : (lowerTriangle s).card =
|
| 44 |
+
(((Icc 1 (s+1)) ×ˢ (Icc 1 (s+1))).filter (fun z => z.1 < z.2)).card :=
|
| 45 |
+
Finset.card_equiv (Equiv.prodComm ℕ ℕ) (by
|
| 46 |
+
intro z
|
| 47 |
+
simp [lowerTriangle, and_comm, and_left_comm, and_assoc])
|
| 48 |
+
rw [hswap, Finset.card_product_filter_lt]
|
| 49 |
+
simp
|
| 50 |
+
|
| 51 |
+
theorem card_upperTriangle (s : ℕ) : (upperTriangle s).card = s.choose 2 := by
|
| 52 |
+
have h := Finset.card_product_filter_lt (s := Icc (s+2) (2*s+1))
|
| 53 |
+
have hc : (Icc (s+2) (2*s+1)).card = s := by simp; omega
|
| 54 |
+
simpa [upperTriangle, hc] using h
|
| 55 |
+
|
| 56 |
+
theorem adjacent_choose_two (s : ℕ) : (s+1).choose 2 + s.choose 2 = s*s := by
|
| 57 |
+
induction s with
|
| 58 |
+
| zero => simp
|
| 59 |
+
| succ s ih =>
|
| 60 |
+
have ha : (s+2).choose 2 = (s+1).choose 2 + (s+1) := by
|
| 61 |
+
calc
|
| 62 |
+
(s+2).choose 2 = (s+1).choose 1 + (s+1).choose 2 := Nat.choose_succ_succ (s+1) 1
|
| 63 |
+
_ = (s+1).choose 2 + (s+1) := by rw [Nat.choose_one_right]; omega
|
| 64 |
+
have hb : (s+1).choose 2 = s.choose 2 + s := by
|
| 65 |
+
simpa [Nat.choose_one_right, Nat.succ_eq_add_one, Nat.add_comm] using
|
| 66 |
+
(Nat.choose_succ_succ s 1)
|
| 67 |
+
have : s+1+1 = s+2 := by omega
|
| 68 |
+
rw [this, ha]
|
| 69 |
+
nlinarith
|
| 70 |
+
|
| 71 |
+
theorem card_twoTriangle (s : ℕ) : (twoTriangle s).card = s*s := by
|
| 72 |
+
rw [twoTriangle, card_union_of_disjoint (disjoint_triangles s), card_lowerTriangle,
|
| 73 |
+
card_upperTriangle, adjacent_choose_two]
|
| 74 |
+
|
| 75 |
+
def triangleRelabel (s k : ℕ) : ℕ := if k ≤ s then s+1+k else k-s+1
|
| 76 |
+
|
| 77 |
+
theorem triangleRelabel_injective_on (s : ℕ) :
|
| 78 |
+
Set.InjOn (triangleRelabel s) (Set.Icc 1 (2*s-1)) := by
|
| 79 |
+
intro p hp q hq he
|
| 80 |
+
simp only [Set.mem_Icc] at hp hq
|
| 81 |
+
unfold triangleRelabel at he
|
| 82 |
+
split_ifs at he <;> omega
|
| 83 |
+
|
| 84 |
+
theorem triangleRelabel_range (s k : ℕ) (hk : k ∈ Icc 1 (2*s-1)) :
|
| 85 |
+
triangleRelabel s k ∈ Icc 1 (2*s+1) ∧
|
| 86 |
+
triangleRelabel s k ≠ s+1 ∧ triangleRelabel s k ≠ 1 := by
|
| 87 |
+
simp only [mem_Icc] at hk ⊢
|
| 88 |
+
unfold triangleRelabel
|
| 89 |
+
split_ifs <;> omega
|
| 90 |
+
|
| 91 |
+
theorem relabel_twoTriangle (s : ℕ) (hs : 1 ≤ s) (p q : ℕ)
|
| 92 |
+
(hpq : (p,q) ∈ twoTriangle (s-1)) :
|
| 93 |
+
(triangleRelabel s q, triangleRelabel s p) ∈ twoTriangle s ∧
|
| 94 |
+
triangleRelabel s q ≠ s+1 ∧ triangleRelabel s p ≠ 1 := by
|
| 95 |
+
rw [mem_twoTriangle] at hpq ⊢
|
| 96 |
+
unfold triangleRelabel
|
| 97 |
+
split_ifs <;> omega
|
| 98 |
+
|
| 99 |
+
end Zarankiewicz
|
| 100 |
+
|
| 101 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/TwoTriangleUnisolvence.lean
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.Bivariate
|
| 2 |
+
import OAI.Combinatorics.Crossing.TwoTriangleIndices
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
namespace Zarankiewicz
|
| 8 |
+
open PolynomialModule
|
| 9 |
+
open Finset
|
| 10 |
+
|
| 11 |
+
theorem eq_zero_of_roots_injOn {W : Type*} [AddCommGroup W] [Module ℝ W]
|
| 12 |
+
(node : ℕ → ℝ) (S : Finset ℕ) (hn : Set.InjOn node (S : Set ℕ))
|
| 13 |
+
(p : PolynomialModule ℝ W) (hp : Bounded S.card p)
|
| 14 |
+
(he : ∀ i ∈ S, eval (node i) p = 0) : p = 0 := by
|
| 15 |
+
let x : S → ℝ := fun i => node i.val
|
| 16 |
+
have hx : Function.Injective x := by
|
| 17 |
+
intro i j hij
|
| 18 |
+
exact Subtype.ext (hn i.property j.property hij)
|
| 19 |
+
apply eq_zero_of_node_roots x hx Finset.univ p
|
| 20 |
+
· simpa using hp
|
| 21 |
+
· intro i hi
|
| 22 |
+
exact he i.val i.property
|
| 23 |
+
|
| 24 |
+
theorem twoTriangle_unisolvent (s : ℕ) (node : ℕ → ℝ)
|
| 25 |
+
(hn : Set.InjOn node (Set.Icc 1 (2*s+1))) (p : BiPoly)
|
| 26 |
+
(hp : BiBounded s s p)
|
| 27 |
+
(hv : ∀ a b, (a,b) ∈ twoTriangle s → biEval (node a) (node b) p = 0) : p = 0 := by
|
| 28 |
+
induction s generalizing node p with
|
| 29 |
+
| zero => exact (bounded_zero_iff p).mp hp.1
|
| 30 |
+
| succ k ih =>
|
| 31 |
+
have node_ne : ∀ a b, a ∈ Icc 1 (2*(k+1)+1) → b ∈ Icc 1 (2*(k+1)+1) →
|
| 32 |
+
a ≠ b → node a ≠ node b := by
|
| 33 |
+
intro a b ha hb hab he
|
| 34 |
+
exact hab (hn (by simpa only [mem_Icc, Set.mem_Icc] using ha)
|
| 35 |
+
(by simpa only [mem_Icc, Set.mem_Icc] using hb) he)
|
| 36 |
+
|
| 37 |
+
have hrow : eval (node (k+2)) p = 0 := by
|
| 38 |
+
apply eq_zero_of_roots_injOn node (Icc 1 (k+1))
|
| 39 |
+
· intro a ha b hb he
|
| 40 |
+
apply hn _ _ he <;> simp only [mem_coe, mem_Icc, Set.mem_Icc] at * <;> omega
|
| 41 |
+
· simpa using bounded_eval_outer hp (node (k+2))
|
| 42 |
+
· intro q hq
|
| 43 |
+
apply hv (k+2) q
|
| 44 |
+
rw [mem_twoTriangle]
|
| 45 |
+
simp only [mem_Icc] at hq
|
| 46 |
+
left
|
| 47 |
+
omega
|
| 48 |
+
obtain ⟨p₁, hp₁, he₁⟩ := bi_factor_row k (k+1) p hp (node (k+2)) hrow
|
| 49 |
+
|
| 50 |
+
have hcol : eval (node 1) (swapBi p₁) = 0 := by
|
| 51 |
+
apply eq_zero_of_roots_injOn node (Icc 2 (k+1))
|
| 52 |
+
· intro a ha b hb he
|
| 53 |
+
apply hn _ _ he <;> simp only [mem_coe, mem_Icc, Set.mem_Icc] at * <;> omega
|
| 54 |
+
· simpa using bounded_eval_outer (biBounded_swap hp₁) (node 1)
|
| 55 |
+
· intro a ha
|
| 56 |
+
change biEval (node 1) (node a) (swapBi p₁) = 0
|
| 57 |
+
rw [biEval_swap]
|
| 58 |
+
have hpa : biEval (node a) (node 1) p = 0 := by
|
| 59 |
+
apply hv
|
| 60 |
+
rw [mem_twoTriangle]
|
| 61 |
+
simp only [mem_Icc] at ha
|
| 62 |
+
left
|
| 63 |
+
omega
|
| 64 |
+
rw [← he₁, biEval_mulRoot] at hpa
|
| 65 |
+
apply (mul_eq_zero.mp hpa).resolve_left
|
| 66 |
+
apply sub_ne_zero.mpr
|
| 67 |
+
apply node_ne a (k+2) <;> simp only [mem_Icc] at * <;> omega
|
| 68 |
+
obtain ⟨r, hr, her⟩ := bi_factor_row k k (swapBi p₁) (biBounded_swap hp₁) (node 1) hcol
|
| 69 |
+
|
| 70 |
+
let y : ℕ → ℝ := fun i => node (triangleRelabel (k+1) i)
|
| 71 |
+
have hyrange : ∀ a, a ∈ Icc 1 (2*k+1) →
|
| 72 |
+
triangleRelabel (k+1) a ∈ Icc 1 (2*(k+1)+1) ∧
|
| 73 |
+
triangleRelabel (k+1) a ≠ k+2 ∧ triangleRelabel (k+1) a ≠ 1 := by
|
| 74 |
+
intro a ha
|
| 75 |
+
simpa only [show k+1+1 = k+2 from rfl] using
|
| 76 |
+
triangleRelabel_range (k+1) a (by simp only [mem_Icc] at *; omega)
|
| 77 |
+
have hyn : Set.InjOn y (Set.Icc 1 (2*k+1)) := by
|
| 78 |
+
intro a ha b hb he
|
| 79 |
+
have ha' : a ∈ Icc 1 (2*k+1) := by simpa only [mem_Icc, Set.mem_Icc] using ha
|
| 80 |
+
have hb' : b ∈ Icc 1 (2*k+1) := by simpa only [mem_Icc, Set.mem_Icc] using hb
|
| 81 |
+
apply triangleRelabel_injective_on (k+1)
|
| 82 |
+
· simp only [Set.mem_Icc] at *
|
| 83 |
+
omega
|
| 84 |
+
· simp only [Set.mem_Icc] at *
|
| 85 |
+
omega
|
| 86 |
+
· exact hn (by simpa only [Set.mem_Icc, mem_Icc] using (hyrange a ha').1)
|
| 87 |
+
(by simpa only [Set.mem_Icc, mem_Icc] using (hyrange b hb').1) he
|
| 88 |
+
have hrv : ∀ a b, (a,b) ∈ twoTriangle k → biEval (y a) (y b) r = 0 := by
|
| 89 |
+
intro a b hab
|
| 90 |
+
have ha : a ∈ Icc 1 (2*k+1) := by
|
| 91 |
+
rw [mem_twoTriangle] at hab
|
| 92 |
+
simp only [mem_Icc]
|
| 93 |
+
omega
|
| 94 |
+
have hb : b ∈ Icc 1 (2*k+1) := by
|
| 95 |
+
rw [mem_twoTriangle] at hab
|
| 96 |
+
simp only [mem_Icc]
|
| 97 |
+
omega
|
| 98 |
+
have hpattern := relabel_twoTriangle (k+1) (by omega) a b (by simpa using hab)
|
| 99 |
+
have hval := hv (triangleRelabel (k+1) b) (triangleRelabel (k+1) a) hpattern.1
|
| 100 |
+
rw [← he₁, biEval_mulRoot] at hval
|
| 101 |
+
have hfirst : node (triangleRelabel (k+1) b) - node (k+2) ≠ 0 :=
|
| 102 |
+
sub_ne_zero.mpr (node_ne _ _ (hyrange b hb).1 (by simp) (hyrange b hb).2.1)
|
| 103 |
+
have hp₁val := (mul_eq_zero.mp hval).resolve_left hfirst
|
| 104 |
+
have hswap : p₁ = swapBi (mulRoot (node 1) r) := by rw [her, swapBi_swapBi]
|
| 105 |
+
rw [hswap, biEval_swap, biEval_mulRoot] at hp₁val
|
| 106 |
+
apply (mul_eq_zero.mp hp₁val).resolve_left
|
| 107 |
+
exact sub_ne_zero.mpr (node_ne _ _ (hyrange a ha).1 (by simp) (hyrange a ha).2.2)
|
| 108 |
+
have hr0 := ih y hyn r hr hrv
|
| 109 |
+
have hp₁0 : p₁ = 0 := by
|
| 110 |
+
apply swapBi.injective
|
| 111 |
+
rw [← her, hr0]
|
| 112 |
+
simp [mulRoot]
|
| 113 |
+
rw [← he₁, hp₁0]
|
| 114 |
+
simp [mulRoot]
|
| 115 |
+
|
| 116 |
+
theorem twoTriangle_evaluation_injective (s : ℕ) (node : ℕ → ℝ)
|
| 117 |
+
(hn : Set.InjOn node (Set.Icc 1 (2*s+1))) (p q : BiPoly)
|
| 118 |
+
(hp : BiBounded s s p) (hq : BiBounded s s q)
|
| 119 |
+
(he : ∀ a b, (a,b) ∈ twoTriangle s → biEval (node a) (node b) p = biEval (node a) (node b) q) :
|
| 120 |
+
p = q := by
|
| 121 |
+
apply sub_eq_zero.mp
|
| 122 |
+
apply twoTriangle_unisolvent s node hn (p-q)
|
| 123 |
+
· refine ⟨bounded_sub hp.1 hq.1, ?_⟩
|
| 124 |
+
intro a
|
| 125 |
+
exact bounded_sub (hp.2 a) (hq.2 a)
|
| 126 |
+
· intro a b hab
|
| 127 |
+
rw [map_sub, he a b hab, sub_self]
|
| 128 |
+
|
| 129 |
+
end Zarankiewicz
|
| 130 |
+
|
| 131 |
+
end
|
| 132 |
+
|
| 133 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/UniformCrossTypeGeometry.lean
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.ChordExteriorSeparation
|
| 2 |
+
import OAI.Combinatorics.Crossing.ConnectorTrackAvoidance
|
| 3 |
+
import OAI.Combinatorics.Crossing.SegmentTraversalReversal
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
noncomputable section
|
| 8 |
+
namespace Zarankiewicz.TruncatedSpokeCoordinates
|
| 9 |
+
variable {m n : ℕ} {D : AdmissibleDrawing m n} {V : VertexTruncation D.toContinuousDrawing}
|
| 10 |
+
(C : TruncatedSpokeCoordinates V)
|
| 11 |
+
|
| 12 |
+
theorem exists_cross_type_radius (hnorm : NoAdjacentCrossings D) :
|
| 13 |
+
∃ δ : ℝ, 0<δ ∧ ∀ ε : ℝ, ε ≠ 0 → |ε|<δ →
|
| 14 |
+
(∀ j (f : IncidentEdges j) e (i : Fin (V.pieces e)),
|
| 15 |
+
¬ ClosedSegmentsMeet (V.vertices e i.val) (V.vertices e (i.val+1))
|
| 16 |
+
(C.shiftedPort j f ε) (C.tangentPort j f ε)) ∧
|
| 17 |
+
(∀ j (c d : IncidentEdges j) e (i : Fin (V.pieces e)),
|
| 18 |
+
¬ ClosedSegmentsMeet (V.vertices e i.val) (V.vertices e (i.val+1))
|
| 19 |
+
(C.shiftedPort j c ε) (C.shiftedPort j d ε)) ∧
|
| 20 |
+
(∀ j (a b : IncidentEdges j) e (i : Fin (V.pieces e)),
|
| 21 |
+
¬ ClosedSegmentsMeet (V.spokePort j a) (V.spokePort j b)
|
| 22 |
+
(shiftedTrack (V.vertices e) (V.pieces e) ε i.val)
|
| 23 |
+
(shiftedTrack (V.vertices e) (V.pieces e) ε (i.val+1))) ∧
|
| 24 |
+
(∀ j k (a b : IncidentEdges j) (f : IncidentEdges k),
|
| 25 |
+
¬ ClosedSegmentsMeet (V.spokePort j a) (V.spokePort j b)
|
| 26 |
+
(C.shiftedPort k f ε) (C.tangentPort k f ε)) ∧
|
| 27 |
+
(∀ j k (a b : IncidentEdges j) (c d : IncidentEdges k), a ≠ b → c ≠ d →
|
| 28 |
+
SegmentPairTransverse (V.spokePort j a) (V.spokePort j b) (C.shiftedPort k c ε) (C.shiftedPort k d ε)) ∧
|
| 29 |
+
(∀ j k, j ≠ k → ∀ (a b : IncidentEdges j) (c d : IncidentEdges k),
|
| 30 |
+
¬ ClosedSegmentsMeet (V.spokePort j a) (V.spokePort j b) (C.shiftedPort k c ε) (C.shiftedPort k d ε)) := by
|
| 31 |
+
obtain ⟨δ₀,hδ₀,htracks⟩ := V.exists_all_vertex_disk_radius
|
| 32 |
+
obtain ⟨δ₁,hδ₁,hconnectors⟩ := C.exists_all_connector_track_radius hnorm
|
| 33 |
+
obtain ⟨δ₂,hδ₂,hother⟩ := C.exists_connector_other_disks_radius
|
| 34 |
+
obtain ⟨δ₃,hδ₃,hseparate⟩ := C.exists_uniform_endpoint_radius
|
| 35 |
+
obtain ⟨δ₄,hδ₄,hscale⟩ := C.exists_uniform_scale_radius
|
| 36 |
+
let δ := min δ₀ (min δ₁ (min δ₂ (min δ₃ δ₄)))
|
| 37 |
+
have hδ : 0<δ := lt_min hδ₀ (lt_min hδ₁ (lt_min hδ₂ (lt_min hδ₃ hδ₄)))
|
| 38 |
+
have hb₀ : δ≤δ₀ := min_le_left _ _
|
| 39 |
+
have hb₁ : δ≤δ₁ := (min_le_right _ _).trans (min_le_left _ _)
|
| 40 |
+
have hb₂ : δ≤δ₂ := (min_le_right _ _).trans ((min_le_right _ _).trans (min_le_left _ _))
|
| 41 |
+
have hb₃ : δ≤δ₃ := (min_le_right _ _).trans ((min_le_right _ _).trans ((min_le_right _ _).trans (min_le_left _ _)))
|
| 42 |
+
have hb₄ : δ≤δ₄ := (min_le_right _ _).trans ((min_le_right _ _).trans ((min_le_right _ _).trans (min_le_right _ _)))
|
| 43 |
+
refine ⟨δ,hδ,?_⟩
|
| 44 |
+
intro ε hε hsmall
|
| 45 |
+
have hs := hscale ε (hsmall.trans_le hb₄)
|
| 46 |
+
have hsep := hseparate ε hε (hsmall.trans_le hb₃)
|
| 47 |
+
refine ⟨hconnectors ε hε (hsmall.trans_le hb₁),?_,?_,?_,?_,?_⟩
|
| 48 |
+
· intro j c d e i
|
| 49 |
+
exact C.track_shifted_chord_disjoint j c d ε (hs j c).le (hs j d).le (hsep j).1 e i
|
| 50 |
+
· intro j a b e i
|
| 51 |
+
exact round_chord_exterior_disjoint (D.vertex j) _ _ _ _ V.radius
|
| 52 |
+
(V.spokePort_circle j a) (V.spokePort_circle j b) (htracks ε hε (hsmall.trans_le hb₀) j e i)
|
| 53 |
+
· intro j k a b f
|
| 54 |
+
by_cases hjk : j=k
|
| 55 |
+
· subst k
|
| 56 |
+
exact C.chord_connector_disjoint_all_passages j a b f ε hε (hs j f) ((hsep j).1 a f) ((hsep j).1 b f)
|
| 57 |
+
· exact round_chord_exterior_disjoint (D.vertex j) _ _ _ _ V.radius
|
| 58 |
+
(V.spokePort_circle j a) (V.spokePort_circle j b)
|
| 59 |
+
(hother ε (hsmall.trans_le hb₂) k j (Ne.symm hjk) f)
|
| 60 |
+
· intro j k a b c d hab hcd
|
| 61 |
+
by_cases hjk : j=k
|
| 62 |
+
· subst k
|
| 63 |
+
exact C.shifted_chords_transverse j a b c d ε (fun e => (hs j e).le) (hsep j).1 (hsep j).2 hab hcd
|
| 64 |
+
· exact segmentPairTransverse_of_not_meet _ _ _ _
|
| 65 |
+
(C.different_vertex_chords_disjoint j k hjk a b c d ε (hs k c).le (hs k d).le)
|
| 66 |
+
· intro j k hjk a b c d
|
| 67 |
+
exact C.different_vertex_chords_disjoint j k hjk a b c d ε (hs k c).le (hs k d).le
|
| 68 |
+
|
| 69 |
+
end Zarankiewicz.TruncatedSpokeCoordinates
|
| 70 |
+
|
| 71 |
+
end
|
| 72 |
+
|
| 73 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/UniformSpokeRadii.lean
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.SpokeEndpointSeparation
|
| 2 |
+
import OAI.Combinatorics.Crossing.FiniteScaledRadius
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
namespace Zarankiewicz.TruncatedSpokeCoordinates
|
| 8 |
+
variable {m n : ℕ} {D : ContinuousDrawing m n} {V : VertexTruncation D}
|
| 9 |
+
(C : TruncatedSpokeCoordinates V)
|
| 10 |
+
|
| 11 |
+
theorem port_injective (C : TruncatedSpokeCoordinates V) (j : BipartiteVertex m n) : Function.Injective (V.spokePort j) := by
|
| 12 |
+
intro e f he
|
| 13 |
+
apply C.node_injective j
|
| 14 |
+
apply circlePoint_injective
|
| 15 |
+
apply similarityPoint_injective (D.vertex j) (C.frame j) (C.frame_ne_zero j)
|
| 16 |
+
simpa only [C.point_eq] using he
|
| 17 |
+
|
| 18 |
+
theorem exists_uniform_endpoint_radius :
|
| 19 |
+
∃ δ : ℝ, 0<δ ∧ ∀ ε : ℝ, ε ≠ 0 → |ε|<δ → ∀ j : BipartiteVertex m n,
|
| 20 |
+
(∀ e f : IncidentEdges j, V.spokePort j e ≠ C.shiftedPort j f ε) ∧
|
| 21 |
+
Function.Injective (fun e : IncidentEdges j => C.shiftedPort j e ε) := by
|
| 22 |
+
classical
|
| 23 |
+
choose radius hpos hprop using C.exists_endpoint_separation_radius
|
| 24 |
+
obtain ⟨δ,hδ,hbound⟩ := finite_positive_lower_bound Finset.univ radius (fun j _ => hpos j)
|
| 25 |
+
exact ⟨δ,hδ,fun ε hε hsmall j => hprop j ε hε (hsmall.trans (hbound j (Finset.mem_univ _)))⟩
|
| 26 |
+
|
| 27 |
+
theorem exists_uniform_scale_radius (_C : TruncatedSpokeCoordinates V) :
|
| 28 |
+
∃ δ : ℝ, 0<δ ∧ ∀ ε : ℝ, |ε|<δ → ∀ j (e : IncidentEdges j), |V.spokeScale j e*ε|<1 := by
|
| 29 |
+
let Spoke := Σ j : BipartiteVertex m n, IncidentEdges j
|
| 30 |
+
obtain ⟨δ,hδ,hbound⟩ := finite_scaled_radius
|
| 31 |
+
(fun s : Spoke => V.spokeScale s.1 s.2) (fun _ => (1 : ℝ)) (by intro s; norm_num)
|
| 32 |
+
exact ⟨δ,hδ,fun ε hε j e => hbound ε hε ⟨j,e⟩⟩
|
| 33 |
+
|
| 34 |
+
theorem exists_uniform_average_radius :
|
| 35 |
+
∃ δ : ℝ, 0<δ ∧ ∀ t : ℝ, 0<t → t<δ → ∀ j (a b c d : IncidentEdges j),
|
| 36 |
+
a ≠ b → c ≠ d →
|
| 37 |
+
(segmentCrossingSign (V.spokePort j a) (V.spokePort j b) (C.shiftedPort j c t) (C.shiftedPort j d t)+
|
| 38 |
+
segmentCrossingSign (V.spokePort j a) (V.spokePort j b) (C.shiftedPort j c (-t)) (C.shiftedPort j d (-t)))/2 =
|
| 39 |
+
chordEndpointPairing (C.node j a) (C.node j b) (C.node j c) (C.node j d) := by
|
| 40 |
+
classical
|
| 41 |
+
choose radius hpos hprop using C.exists_vertex_average_radius
|
| 42 |
+
obtain ⟨δ,hδ,hbound⟩ := finite_positive_lower_bound Finset.univ radius (fun j _ => hpos j)
|
| 43 |
+
exact ⟨δ,hδ,fun t ht hsmall j => hprop j t ht (hsmall.trans (hbound j (Finset.mem_univ _)))⟩
|
| 44 |
+
|
| 45 |
+
end Zarankiewicz.TruncatedSpokeCoordinates
|
| 46 |
+
|
| 47 |
+
end
|
| 48 |
+
|
| 49 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/UniformTrackPerturbation.lean
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.TruncatedTrackStability
|
| 2 |
+
import OAI.Combinatorics.Crossing.PolygonalWalks
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
namespace Zarankiewicz.VertexTruncation
|
| 8 |
+
open scoped BigOperators
|
| 9 |
+
variable {m n : ℕ} {D : AdmissibleDrawing m n}
|
| 10 |
+
|
| 11 |
+
theorem exists_all_edge_shift_radius (V : VertexTruncation D.toContinuousDrawing)
|
| 12 |
+
(hnorm : NoAdjacentCrossings D) (hstraight : LocallyStraightCrossings D) (htrans : LocallyTransverseCrossings D) :
|
| 13 |
+
∃ δ : ℝ, 0 < δ ∧ ∀ t : ℝ, t ≠ 0 → |t| < δ → ∀ e f : BipartiteEdge m n,
|
| 14 |
+
∀ i : Fin (V.pieces e), ∀ j : Fin (V.pieces f),
|
| 15 |
+
SegmentPairTransverse (V.vertices e i.val) (V.vertices e (i.val+1))
|
| 16 |
+
(shiftedTrack (V.vertices f) (V.pieces f) t j.val)
|
| 17 |
+
(shiftedTrack (V.vertices f) (V.pieces f) t (j.val+1)) ∧
|
| 18 |
+
segmentCrossingSign (V.vertices e i.val) (V.vertices e (i.val+1))
|
| 19 |
+
(shiftedTrack (V.vertices f) (V.pieces f) t j.val)
|
| 20 |
+
(shiftedTrack (V.vertices f) (V.pieces f) t (j.val+1)) =
|
| 21 |
+
if e=f then 0 else segmentCrossingSign (V.vertices e i.val) (V.vertices e (i.val+1))
|
| 22 |
+
(V.vertices f j.val) (V.vertices f (j.val+1)) := by
|
| 23 |
+
classical
|
| 24 |
+
obtain ⟨δ₀,hδ₀,hother⟩ := V.exists_distinct_edge_shift_radius hnorm hstraight htrans
|
| 25 |
+
choose radius hpos hself using V.offset_avoidance
|
| 26 |
+
obtain ⟨δ₁,hδ₁,hbound⟩ := finite_positive_lower_bound Finset.univ radius (fun e _ => hpos e)
|
| 27 |
+
refine ⟨min δ₀ δ₁,lt_min hδ₀ hδ₁,?_⟩
|
| 28 |
+
intro t ht hsmall e f i j
|
| 29 |
+
by_cases hef : e=f
|
| 30 |
+
· subst f
|
| 31 |
+
have hno := hself e t ht ((hsmall.trans_le (min_le_right _ _)).trans (hbound e (Finset.mem_univ _))) i j
|
| 32 |
+
refine ⟨?_,?_⟩
|
| 33 |
+
· intro s hs u hu he
|
| 34 |
+
exact False.elim (hno ⟨s,hs,u,hu,he⟩)
|
| 35 |
+
· have hp : ¬ SegmentsCrossProperly (V.vertices e i.val) (V.vertices e (i.val+1))
|
| 36 |
+
(shiftedTrack (V.vertices e) (V.pieces e) t j.val)
|
| 37 |
+
(shiftedTrack (V.vertices e) (V.pieces e) t (j.val+1)) :=
|
| 38 |
+
fun h => hno (closedSegmentsMeet_of_proper _ _ _ _ h)
|
| 39 |
+
simp [segmentCrossingSign,hp]
|
| 40 |
+
· obtain ⟨hT,hS⟩ := hother t (hsmall.trans_le (min_le_left _ _)) e f hef i j
|
| 41 |
+
exact ⟨hT,by simpa only [ite_eq_right hef] using hS⟩
|
| 42 |
+
|
| 43 |
+
theorem exists_uniform_track_intersections (V : VertexTruncation D.toContinuousDrawing)
|
| 44 |
+
(hnorm : NoAdjacentCrossings D) (hstraight : LocallyStraightCrossings D) (htrans : LocallyTransverseCrossings D) :
|
| 45 |
+
∃ δ : ℝ, 0 < δ ∧ ∀ t : ℝ, t ≠ 0 → |t| < δ → ∀ e f : BipartiteEdge m n,
|
| 46 |
+
polygonIntersection (V.vertices e) (shiftedTrack (V.vertices f) (V.pieces f) t) (V.pieces e) (V.pieces f) =
|
| 47 |
+
if e=f then 0 else polygonIntersection (V.vertices e) (V.vertices f) (V.pieces e) (V.pieces f) := by
|
| 48 |
+
classical
|
| 49 |
+
obtain ⟨δ,hδ,hh⟩ := V.exists_all_edge_shift_radius hnorm hstraight htrans
|
| 50 |
+
refine ⟨δ,hδ,?_⟩
|
| 51 |
+
intro t ht hsmall e f
|
| 52 |
+
by_cases hef : e=f
|
| 53 |
+
· rw [ite_eq_left hef]
|
| 54 |
+
unfold polygonIntersection
|
| 55 |
+
apply Finset.sum_eq_zero
|
| 56 |
+
intro i hi
|
| 57 |
+
apply Finset.sum_eq_zero
|
| 58 |
+
intro j hj
|
| 59 |
+
simpa only [ite_eq_left hef] using
|
| 60 |
+
(hh t ht hsmall e f ⟨i,Finset.mem_range.mp hi⟩ ⟨j,Finset.mem_range.mp hj⟩).2
|
| 61 |
+
· rw [ite_eq_right hef]
|
| 62 |
+
unfold polygonIntersection
|
| 63 |
+
apply Finset.sum_congr rfl
|
| 64 |
+
intro i hi
|
| 65 |
+
apply Finset.sum_congr rfl
|
| 66 |
+
intro j hj
|
| 67 |
+
simpa only [ite_eq_right hef] using
|
| 68 |
+
(hh t ht hsmall e f ⟨i,Finset.mem_range.mp hi⟩ ⟨j,Finset.mem_range.mp hj⟩).2
|
| 69 |
+
|
| 70 |
+
end Zarankiewicz.VertexTruncation
|
| 71 |
+
|
| 72 |
+
end
|
| 73 |
+
|
| 74 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/UniqueWalkPassage.lean
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib.Combinatorics.SimpleGraph.Paths
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
namespace Zarankiewicz
|
| 6 |
+
|
| 7 |
+
def UniqueWalkVisit {V : Type*} {G : SimpleGraph V} {a b : V} (p : G.Walk a b) (x : V) : Prop :=
|
| 8 |
+
∀ i j : ℕ, i ≤ p.length → j ≤ p.length → p.getVert i=x → p.getVert j=x → i=j
|
| 9 |
+
|
| 10 |
+
theorem walk_dart_parameters {V : Type*} {G : SimpleGraph V} {a b : V}
|
| 11 |
+
(p : G.Walk a b) (d : G.Dart) (hd : d ∈ p.darts) :
|
| 12 |
+
∃ i : ℕ, i < p.length ∧ d.fst=p.getVert i ∧ d.snd=p.getVert (i+1) := by
|
| 13 |
+
obtain ⟨i,hi⟩ := List.mem_iff_get.mp hd
|
| 14 |
+
have he := SimpleGraph.Walk.darts_getElem_eq_getVert (p:=p) i.val i.isLt
|
| 15 |
+
have hd' := hi.symm.trans he
|
| 16 |
+
refine ⟨i.val,by simpa only [p.length_darts] using i.isLt,?_,?_⟩
|
| 17 |
+
· exact congrArg (fun r : G.Dart => r.fst) hd'
|
| 18 |
+
· exact congrArg (fun r : G.Dart => r.snd) hd'
|
| 19 |
+
|
| 20 |
+
theorem unique_walk_visit_passage {V : Type*} {G : SimpleGraph V} {a b : V}
|
| 21 |
+
(p : G.Walk a b) (x : V) (hunique : UniqueWalkVisit p x)
|
| 22 |
+
(d e : G.Dart) (hd : d ∈ p.darts) (he : e ∈ p.darts) (hdx : d.snd=x) (hex : e.fst=x) :
|
| 23 |
+
∃ i : ℕ, i+1 < p.length ∧ d.fst=p.getVert i ∧
|
| 24 |
+
x=p.getVert (i+1) ∧ e.snd=p.getVert (i+2) := by
|
| 25 |
+
obtain ⟨i,hi,hdi,hdi'⟩ := walk_dart_parameters p d hd
|
| 26 |
+
obtain ⟨j,hj,hej,hej'⟩ := walk_dart_parameters p e he
|
| 27 |
+
have hij : i+1=j := hunique (i+1) j (by omega) (by omega) (hdi'.symm.trans hdx) (hej.symm.trans hex)
|
| 28 |
+
refine ⟨i,by omega,hdi,hdx.symm.trans hdi',?_⟩
|
| 29 |
+
simpa only [← hij,Nat.add_assoc] using hej'
|
| 30 |
+
|
| 31 |
+
theorem bypass_unique_walk_visit_passage {V : Type*} [DecidableEq V] {G : SimpleGraph V} {a b : V}
|
| 32 |
+
(p : G.Walk a b) (x : V) (hunique : UniqueWalkVisit p x)
|
| 33 |
+
(d e : G.Dart) (hd : d ∈ p.bypass.darts) (he : e ∈ p.bypass.darts) (hdx : d.snd=x) (hex : e.fst=x) :
|
| 34 |
+
∃ i : ℕ, i+1 < p.length ∧ d.fst=p.getVert i ∧
|
| 35 |
+
x=p.getVert (i+1) ∧ e.snd=p.getVert (i+2) :=
|
| 36 |
+
unique_walk_visit_passage p x hunique d e (p.darts_bypass_subset_darts hd)
|
| 37 |
+
(p.darts_bypass_subset_darts he) hdx hex
|
| 38 |
+
|
| 39 |
+
end Zarankiewicz
|
| 40 |
+
|
| 41 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/VertexChordIntersections.lean
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.StraightChainTransversality
|
| 2 |
+
import OAI.Combinatorics.Crossing.UniformCrossTypeGeometry
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
namespace Zarankiewicz.TruncatedSpokeCoordinates
|
| 8 |
+
variable {m n : ℕ} {D : AdmissibleDrawing m n} {V : VertexTruncation D.toContinuousDrawing}
|
| 9 |
+
(C : TruncatedSpokeCoordinates V)
|
| 10 |
+
|
| 11 |
+
theorem chordChain_intersection (j k : BipartiteVertex m n) (a b : IncidentEdges j)
|
| 12 |
+
(c d : IncidentEdges k) (ε : ℝ) :
|
| 13 |
+
polygonIntersection (V.chordChain j a b).vertices (C.shiftedChordChain k c d ε).vertices 1 1=
|
| 14 |
+
segmentCrossingSign (V.spokePort j a) (V.spokePort j b) (C.shiftedPort k c ε) (C.shiftedPort k d ε) := by
|
| 15 |
+
rw [VertexTruncation.chordChain,shiftedChordChain,PolygonalChain.intersection_single_single]
|
| 16 |
+
|
| 17 |
+
theorem exists_vertex_chord_chain_radius (hnorm : NoAdjacentCrossings D) :
|
| 18 |
+
∃ δ : ℝ, 0<δ ∧
|
| 19 |
+
(∀ ε : ℝ, ε ≠ 0 → |ε|<δ → ∀ j k (a b : IncidentEdges j) (c d : IncidentEdges k),
|
| 20 |
+
a ≠ b → c ≠ d → (V.chordChain j a b).Transverse (C.shiftedChordChain k c d ε)) ∧
|
| 21 |
+
(∀ ε : ℝ, ε ≠ 0 → |ε|<δ → ∀ j k, j ≠ k → ∀ (a b : IncidentEdges j) (c d : IncidentEdges k),
|
| 22 |
+
polygonIntersection (V.chordChain j a b).vertices (C.shiftedChordChain k c d ε).vertices 1 1=0) ∧
|
| 23 |
+
(∀ t : ℝ, 0<t → t<δ → ∀ j (a b c d : IncidentEdges j), a ≠ b → c ≠ d →
|
| 24 |
+
(polygonIntersection (V.chordChain j a b).vertices (C.shiftedChordChain j c d t).vertices 1 1+
|
| 25 |
+
polygonIntersection (V.chordChain j a b).vertices (C.shiftedChordChain j c d (-t)).vertices 1 1)/2=
|
| 26 |
+
chordEndpointPairing (C.node j a) (C.node j b) (C.node j c) (C.node j d)) := by
|
| 27 |
+
obtain ⟨δ₀,hδ₀,hgeo⟩ := C.exists_cross_type_radius hnorm
|
| 28 |
+
obtain ⟨δ₁,hδ₁,havg⟩ := C.exists_uniform_average_radius
|
| 29 |
+
refine ⟨min δ₀ δ₁,lt_min hδ₀ hδ₁,?_,?_,?_⟩
|
| 30 |
+
· intro ε hε hsmall j k a b c d hab hcd
|
| 31 |
+
have hh := (hgeo ε hε (hsmall.trans_le (min_le_left _ _))).2.2.2.2.1 j k a b c d hab hcd
|
| 32 |
+
exact PolygonalChain.transverse_single_single _ _ _ _ hh
|
| 33 |
+
· intro ε hε hsmall j k hjk a b c d
|
| 34 |
+
rw [C.chordChain_intersection]
|
| 35 |
+
exact segmentCrossingSign_eq_zero_of_not_meet _ _ _ _
|
| 36 |
+
((hgeo ε hε (hsmall.trans_le (min_le_left _ _))).2.2.2.2.2 j k hjk a b c d)
|
| 37 |
+
· intro t ht hsmall j a b c d hab hcd
|
| 38 |
+
rw [C.chordChain_intersection,C.chordChain_intersection]
|
| 39 |
+
exact havg t ht (hsmall.trans_le (min_le_right _ _)) j a b c d hab hcd
|
| 40 |
+
|
| 41 |
+
end Zarankiewicz.TruncatedSpokeCoordinates
|
| 42 |
+
|
| 43 |
+
end
|
| 44 |
+
|
| 45 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/VertexDiskSpokes.lean
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.RoundCircleChords
|
| 2 |
+
import OAI.Combinatorics.Crossing.FiniteLineAvoidance
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
namespace Zarankiewicz
|
| 8 |
+
|
| 9 |
+
theorem spokes_meet_only_at_center (v a b : Plane) (hd : det2 (a-v) (b-v) ≠ 0)
|
| 10 |
+
{x : Plane} (ha : x ∈ segment ℝ v a) (hb : x ∈ segment ℝ v b) : x=v := by
|
| 11 |
+
rw [← Path.range_segment] at ha hb
|
| 12 |
+
obtain ⟨s,hs⟩ := ha
|
| 13 |
+
obtain ⟨t,ht⟩ := hb
|
| 14 |
+
have hs' : segmentPoint v a s.val=x := by simpa [Path.segment_apply,AffineMap.lineMap_apply_module,segmentPoint] using hs
|
| 15 |
+
have ht' : segmentPoint v b t.val=x := by simpa [Path.segment_apply,AffineMap.lineMap_apply_module,segmentPoint] using ht
|
| 16 |
+
have hp := segment_intersection_parameters_unique v a v b hd s.val t.val 0 0
|
| 17 |
+
(hs'.trans ht'.symm) (by simp)
|
| 18 |
+
rw [hp.1,segmentPoint_zero] at hs'
|
| 19 |
+
exact hs'.symm
|
| 20 |
+
|
| 21 |
+
theorem spoke_in_open_disk (z v a : Plane) (r : ℝ)
|
| 22 |
+
(hv : squaredLength (v-z) < r^2) (ha : squaredLength (a-z)=r^2)
|
| 23 |
+
(t : ℝ) (ht : t ∈ Set.Ico (0 : ℝ) 1) :
|
| 24 |
+
squaredLength (segmentPoint v a t-z) < r^2 := by
|
| 25 |
+
have he : squaredLength (segmentPoint v a t-z)=
|
| 26 |
+
(1-t)*squaredLength (v-z)+t*squaredLength (a-z)-t*(1-t)*squaredLength (a-v) := by
|
| 27 |
+
dsimp [squaredLength,segmentPoint]
|
| 28 |
+
ring
|
| 29 |
+
have hpos := mul_pos (sub_pos.mpr ht.2) (sub_pos.mpr hv)
|
| 30 |
+
have hnon : 0 ≤ t*(1-t)*squaredLength (a-v) := by
|
| 31 |
+
apply mul_nonneg (mul_nonneg ht.1 (sub_nonneg.mpr ht.2.le))
|
| 32 |
+
dsimp [squaredLength]
|
| 33 |
+
positivity
|
| 34 |
+
rw [he,ha]
|
| 35 |
+
nlinarith
|
| 36 |
+
|
| 37 |
+
theorem exists_vertex_disk_point {ι : Type*} [Fintype ι] [DecidableEq ι]
|
| 38 |
+
(z : Plane) (r : ℝ) (hr : 0 < r) (p : ι → Plane) (hp : Function.Injective p)
|
| 39 |
+
(hcircle : ∀ i, squaredLength (p i-z)=r^2) :
|
| 40 |
+
∃ v : Plane, squaredLength (v-z) < r^2 ∧
|
| 41 |
+
(∀ i, v ≠ p i) ∧ (∀ i j, i ≠ j → det2 (p i-v) (p j-v) ≠ 0) := by
|
| 42 |
+
classical
|
| 43 |
+
let S := {ij : ι × ι // ij.1 ≠ ij.2}
|
| 44 |
+
obtain ⟨v,hv,havoid⟩ := exists_near_avoiding_lines
|
| 45 |
+
(fun ij : S => p ij.val.1) (fun ij : S => p ij.val.2-p ij.val.1)
|
| 46 |
+
(fun ij => sub_ne_zero.mpr (hp.ne (Ne.symm ij.property))) z (r/3) (by positivity)
|
| 47 |
+
have hinside : squaredLength (v-z) < r^2 := by
|
| 48 |
+
rw [Prod.dist_eq,Real.dist_eq,Real.dist_eq,max_lt_iff,abs_lt,abs_lt] at hv
|
| 49 |
+
have h₁ := mul_pos (sub_pos.mpr hv.1.2) (show 0 < r/3+(v.1-z.1) by linarith [hv.1.1])
|
| 50 |
+
have h₂ := mul_pos (sub_pos.mpr hv.2.2) (show 0 < r/3+(v.2-z.2) by linarith [hv.2.1])
|
| 51 |
+
change (v.1-z.1)^2+(v.2-z.2)^2 < r^2
|
| 52 |
+
nlinarith [sq_pos_of_pos hr]
|
| 53 |
+
refine ⟨v,hinside,?_,?_⟩
|
| 54 |
+
· intro i he
|
| 55 |
+
rw [he,hcircle i] at hinside
|
| 56 |
+
exact lt_irrefl _ hinside
|
| 57 |
+
· intro i j hij
|
| 58 |
+
have he : det2 (p i-v) (p j-v) = -det2 (v-p i) (p j-p i) := by dsimp [det2]; ring
|
| 59 |
+
rw [he]
|
| 60 |
+
exact neg_ne_zero.mpr (havoid ⟨(i,j),hij⟩)
|
| 61 |
+
|
| 62 |
+
end Zarankiewicz
|
| 63 |
+
|
| 64 |
+
end
|
| 65 |
+
|
| 66 |
+
end OAI
|
lean/OAI/Combinatorics/Crossing/VertexDisksCrossingFree.lean
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Combinatorics.Crossing.TruncatedDrawingDisks
|
| 2 |
+
import OAI.Combinatorics.Crossing.IncidentSpokePorts
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
namespace Zarankiewicz
|
| 8 |
+
variable {m n : ℕ}
|
| 9 |
+
|
| 10 |
+
theorem vertex_disks_crossing_free (D : AdmissibleDrawing m n) (hnorm : NoAdjacentCrossings D)
|
| 11 |
+
(P : ∀ e : BipartiteEdge m n, PolygonalChain (Set.range (D.edge e))
|
| 12 |
+
(D.vertex (.inl e.1)) (D.vertex (.inr e.2)))
|
| 13 |
+
(r : ℝ)
|
| 14 |
+
(hclear : ∀ j e (i : Fin (P e).pieces),
|
| 15 |
+
¬ ((j=Sum.inl e.1 ∧ i.val=0) ∨ (j=Sum.inr e.2 ∧ i.val+1=(P e).pieces)) →
|
| 16 |
+
Disjoint (closedRoundDisk (D.vertex j) r) (segment ℝ ((P e).vertices i.val) ((P e).vertices (i.val+1))))
|
| 17 |
+
(j : BipartiteVertex m n) :
|
| 18 |
+
Disjoint (closedRoundDisk (D.vertex j) r) (crossingPoints D.toContinuousDrawing) := by
|
| 19 |
+
apply Set.disjoint_left.mpr
|
| 20 |
+
rintro x hxd ⟨e,f,hef,hxe,hxf⟩
|
| 21 |
+
have hincident (g : BipartiteEdge m n) (hxg : x ∈ edgeInterior D.toContinuousDrawing g) :
|
| 22 |
+
j=Sum.inl g.1 ∨ j=Sum.inr g.2 := by
|
| 23 |
+
have hx := edgeInterior_subset_range D.toContinuousDrawing g hxg
|
| 24 |
+
rw [← drawing_chain_range_eq D.toContinuousDrawing g (P g)] at hx
|
| 25 |
+
obtain ⟨i,hi,hxi⟩ := polygonalArcPath_range_piece (P g).vertices (P g).pieces
|
| 26 |
+
(drawing_chain_pieces_pos D.toContinuousDrawing g (P g)) x hx
|
| 27 |
+
by_contra h
|
| 28 |
+
have hbad : ¬ ((j=Sum.inl g.1 ∧ i=0) ∨ (j=Sum.inr g.2 ∧ i+1=(P g).pieces)) :=
|
| 29 |
+
fun hh => h (hh.elim (fun hh => Or.inl hh.1) (fun hh => Or.inr hh.1))
|
| 30 |
+
exact Set.disjoint_left.mp (hclear j g ⟨i,hi⟩ hbad) hxd hxi
|
| 31 |
+
have hadj := incident_edges_adjacent j ⟨e,hincident e hxe⟩ ⟨f,hincident f hxf⟩
|
| 32 |
+
have hh : x ∈ edgeInterior D.toContinuousDrawing e ∩ edgeInterior D.toContinuousDrawing f := ⟨hxe,hxf⟩
|
| 33 |
+
rw [hnorm e f hef hadj] at hh
|
| 34 |
+
exact hh
|
| 35 |
+
|
| 36 |
+
end Zarankiewicz
|
| 37 |
+
|
| 38 |
+
end
|
| 39 |
+
|
| 40 |
+
end OAI
|