File size: 3,511 Bytes
62291ee
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import OAI.NumberTheory.Ostmann.Conclusion.PartitionPermutations

namespace OAI

noncomputable section
open scoped BigOperators
namespace Ostmann.Conclusion

def overlapRelation {r m : ℕ} (σ : Equiv.Perm (Fin r × Fin m)) (a b : Fin r) : Prop :=
  ∃ u v : Fin m, (σ (a,u)).1 = (σ (b,v)).1

def OverlapComponent {r m : ℕ} (σ : Equiv.Perm (Fin r × Fin m)) :=
  Quotient (Relation.EqvGen.setoid (overlapRelation σ))

instance {r m : ℕ} (σ : Equiv.Perm (Fin r × Fin m)) : Finite (OverlapComponent σ) := by
  unfold OverlapComponent
  infer_instance

instance {r m : ℕ} (σ : Equiv.Perm (Fin r × Fin m)) : Fintype (OverlapComponent σ) :=
  Fintype.ofFinite _

instance {r m : ℕ} (σ : Equiv.Perm (Fin r × Fin m)) : DecidableEq (OverlapComponent σ) :=
  Classical.decEq _

def leftComponent {r m : ℕ} (σ : Equiv.Perm (Fin r × Fin m))
    (a : Fin r) : OverlapComponent σ := Quotient.mk _ a

def rightComponent {r m : ℕ} (σ : Equiv.Perm (Fin r × Fin m)) (hm : 0 < m)
    (b : Fin r) : OverlapComponent σ :=
  leftComponent σ (σ.symm (b,⟨0,hm⟩)).1

theorem leftComponent_surjective {r m : ℕ} (σ : Equiv.Perm (Fin r × Fin m)) :
    Function.Surjective (leftComponent σ) := by
  exact Quotient.mk_surjective

theorem slot_component {r m : ℕ} (σ : Equiv.Perm (Fin r × Fin m)) (hm : 0 < m)
    (x : Fin r × Fin m) : leftComponent σ x.1 = rightComponent σ hm (σ x).1 := by
  apply Quotient.sound
  apply Relation.EqvGen.rel
  refine ⟨x.2,(σ.symm ((σ x).1,⟨0,hm⟩)).2,?_⟩
  simp only [Prod.mk.eta, Equiv.apply_symm_apply]

theorem component_card_balance {r m : ℕ} (σ : Equiv.Perm (Fin r × Fin m))
    (hm : 0 < m) (i : OverlapComponent σ) :
    Fintype.card {a // leftComponent σ a = i} =
      Fintype.card {b // rightComponent σ hm b = i} := by
  let e : PartitionMatching (fun x : Fin r × Fin m => leftComponent σ x.1)
      (fun x : Fin r × Fin m => rightComponent σ hm x.1) :=
    ⟨σ,fun x => (slot_component σ hm x).symm⟩
  have h := Fintype.card_congr (partitionMatchingEquiv _ _ e i)
  simp only [card_slotFiber] at h
  exact Nat.eq_of_mul_eq_mul_right hm h

theorem component_card_pos {r m : ℕ} (σ : Equiv.Perm (Fin r × Fin m))
    (i : OverlapComponent σ) : 0 < Fintype.card {a // leftComponent σ a = i} := by
  obtain ⟨a,ha⟩ := leftComponent_surjective σ i
  exact Fintype.card_pos_iff.mpr ⟨⟨a,ha⟩⟩

theorem component_cards_sum {r m : ℕ} (σ : Equiv.Perm (Fin r × Fin m)) :
    ∑ i : OverlapComponent σ, Fintype.card {a // leftComponent σ a = i} = r := by
  have h := Fintype.card_congr (Equiv.sigmaFiberEquiv (leftComponent σ))
  simpa only [Fintype.card_sigma, Fintype.card_fin] using h

theorem overlapComponent_card_le {r m : ℕ} (σ : Equiv.Perm (Fin r × Fin m)) :
    Fintype.card (OverlapComponent σ) ≤ r := by
  simpa only [Fintype.card_fin] using
    Fintype.card_le_of_surjective (leftComponent σ) (leftComponent_surjective σ)

theorem component_matching_card {r m : ℕ} (σ : Equiv.Perm (Fin r × Fin m))
    (hm : 0 < m) :
    Nat.card (PartitionMatching (fun x : Fin r × Fin m => leftComponent σ x.1)
      (fun x : Fin r × Fin m => rightComponent σ hm x.1)) =
      ∏ i : OverlapComponent σ, (Fintype.card {a // leftComponent σ a = i} * m).factorial :=
  card_slotPartitionMatching _ _ (component_card_balance σ hm)

def BadArrangement {r m : ℕ} (σ : Equiv.Perm (Fin r × Fin m)) : Prop :=
  3*r < 4*Fintype.card (OverlapComponent σ)

end Ostmann.Conclusion

end

end OAI