File size: 4,746 Bytes
cdec422
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.OrbitData
import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.GroupedRecovery
import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.OrbitFibers

namespace OAI

/-! Group assignments, orbit counts and extraction capacities. -/

noncomputable section

namespace MatrixMultiplication.AllFieldGroupOrbitData

open AllFieldHistory AllFieldHistoryGroupMasks AllFieldHistoryGroupedRecovery
open AllFieldGroupOrbitCount JointCoarseHashing PermutationMatching
attribute [local instance] Classical.propDecidable Classical.decEq

variable {K tick : ℕ}

local instance canonicalGroupAction (allocation : Allocation) (m : ℕ) (sigma : Placement) :
    MulAction
      (HalfClassPermutations (GroupPositions (K := K) (tick := tick) (sigma := sigma) allocation m))
      (JointCanonicalization.CanonicalPairs (groupCounts (K := K) (tick := tick) allocation m sigma)
        (fun h => Fin (activeHalfLength h.val) → Fin 7)
        (fun h => Fin (activeHalfLength h.val) → Fin 7)) :=
  completeWordPairMulAction

local instance canonicalGroupFintype (allocation : Allocation) (m : ℕ) (sigma : Placement) :
    Fintype
      (JointCanonicalization.CanonicalPairs (groupCounts (K := K) (tick := tick) allocation m sigma)
        (fun h => Fin (activeHalfLength h.val) → Fin 7)
        (fun h => Fin (activeHalfLength h.val) → Fin 7)) := by
  letI : ∀ c : GroupClasses K tick sigma,
      Fintype (GroupPositions allocation m c) := fun _ => Fin.fintype _
  letI : ∀ c : GroupClasses K tick sigma,
      DecidableEq (GroupPositions allocation m c) := fun _ => Classical.decEq _
  letI : ∀ c : GroupClasses K tick sigma,
      Fintype (GroupLetters c) := fun _ => Pi.instFintype
  exact HistorySymmetry.completeWordPairFintype

def tag (allocation : Allocation) (m : ℕ) (sigma : Placement) (side : Fin 3) :
    Raw (K := K) (tick := tick) allocation m sigma ↪ Variable (K := K) (tick := tick) allocation m sigma where
  toFun w := (side, w)
  inj' := by intro w v h; exact congrArg Prod.snd h

theorem full_eq_tagged_fiber (allocation : Allocation) (m : ℕ) (sigma : Placement)
    (e : Targets (K := K) (tick := tick) allocation m sigma) (o : Orbit (K := K) (tick := tick) allocation m sigma) :
    full allocation m sigma e o =
      (JointOrbitFibers.transportedFiber (groupCoordinates allocation m sigma e) o.2).map
        (tag allocation m sigma o.1) := by
  ext v
  constructor
  · intro hv
    have hh := (Finset.mem_filter.mp hv).2
    apply Finset.mem_map.mpr
    refine ⟨v.2, ?_, ?_⟩
    · exact (JointOrbitFibers.mem_transportedFiber (groupCoordinates allocation m sigma e)).mpr hh.2
    · exact Prod.ext hh.1.symm rfl
  · intro hv
    obtain ⟨w, hw, rfl⟩ := Finset.mem_map.mp hv
    exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, rfl,
      (JointOrbitFibers.mem_transportedFiber (groupCoordinates allocation m sigma e)).mp hw⟩

theorem full_eq_tagged_localOrbit (allocation : Allocation) (m : ℕ) (sigma : Placement)
    (e : Targets (K := K) (tick := tick) allocation m sigma)
    (side : Fin 3) (w : Raw (K := K) (tick := tick) allocation m sigma) :
    full allocation m sigma e (side, orbitOf allocation m sigma e w) =
      (localOrbit allocation m sigma e w).map (tag allocation m sigma side) := by
  rw [full_eq_tagged_fiber]
  dsimp only [orbitOf]
  erw [JointOrbitFibers.transportedFiber_mk]
  apply congrArg (fun t : Finset (Raw (K := K) (tick := tick) allocation m sigma) =>
    t.map (tag allocation m sigma side))
  ext v
  simp only [localOrbit, GroupOrbitProjection.rawOrbit, GroupOrbitProjection.transportedOrbit,
    OrbitCounting.orbitSet,
    Finset.mem_image, Finset.mem_univ, true_and]
  rfl

@[simp] theorem full_card_localOrbit (allocation : Allocation) (m : ℕ) (sigma : Placement)
    (e : Targets (K := K) (tick := tick) allocation m sigma)
    (side : Fin 3) (w : Raw (K := K) (tick := tick) allocation m sigma) :
    (full allocation m sigma e (side, orbitOf allocation m sigma e w)).card =
      (localOrbit allocation m sigma e w).card := by
  rw [full_eq_tagged_localOrbit, Finset.card_map]

theorem full_filter_card_localOrbit (allocation : Allocation) (m : ℕ) (sigma : Placement)
    (e : Targets (K := K) (tick := tick) allocation m sigma)
    (side : Fin 3) (w : Raw (K := K) (tick := tick) allocation m sigma) (bad : Variable (K := K) (tick := tick) allocation m sigma → Prop) :
    ((full allocation m sigma e (side, orbitOf allocation m sigma e w)).filter bad).card =
      ((localOrbit allocation m sigma e w).filter (fun v => bad (side, v))).card := by
  rw [full_eq_tagged_localOrbit, Finset.filter_map]
  exact Finset.card_map _

end MatrixMultiplication.AllFieldGroupOrbitData

end

end OAI