File size: 2,215 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
import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.InitialEntropy

namespace OAI

/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/

namespace MatrixMultiplication.AllFieldInitialOrbit

open AllFieldParameters AllFieldHistory AllFieldInitialEntropy
open scoped BigOperators

theorem source_total (p : PlacedInitial) :
    (initialShapeCode p).1.val + (initialShapeCode p).2.1.val +
      (initialShapeCode p).2.2.val = 16 := by
  unfold initialShapeCode rootShape
  rw [encodePhysicalShape_total]
  exact (root_shape_spec _ (initialShape_mem _)).2

theorem decodeShape_injective : Function.Injective decodeShape := by
  intro u v h
  apply Prod.ext
  · exact Fin.ext (congrFun h 0)
  · apply Prod.ext
    · exact Fin.ext (congrFun h 1)
    · exact Fin.ext (congrFun h 2)

theorem decodeShape_mem_shapes (u : JointPopulation.Shape)
    (hu : u.1.val + u.2.1.val + u.2.2.val = 16) :
    decodeShape u ∈ shapes 16 := by
  simp only [shapes, List.mem_flatMap, List.mem_map, List.mem_range]
  refine ⟨u.1.val, by omega, u.2.1.val, by omega, ?_⟩
  funext i
  fin_cases i
  · rfl
  · rfl
  · change 16 - u.1.val - u.2.1.val = u.2.2.val
    omega

theorem initialShapeCode_eq_iff (p : PlacedInitial) (u : JointPopulation.Shape) :
    initialShapeCode p = u ↔
      physicalShape p.2 (sortedInitial.get p.1) = decodeShape u := by
  have hdecode : decodeShape (initialShapeCode p) =
      physicalShape p.2 (sortedInitial.get p.1) := by
    funext i
    exact initialShapeCode_side p i
  rw [← hdecode]
  exact decodeShape_injective.eq_iff.symm

theorem weighted_shape_fiber_count : ∀ u ∈ shapes 16,
    (∑ p : PlacedInitial,
      if physicalShape p.2 (sortedInitial.get p.1) = u
      then initialMultiplicity (sortedInitial.get p.1) else 0) = 6 := by
  decide +kernel

theorem weighted_fiber_count (u : JointPopulation.Shape)
    (hu : u.1.val + u.2.1.val + u.2.2.val = 16) :
    (∑ p : PlacedInitial, if initialShapeCode p = u
      then initialMultiplicity (sortedInitial.get p.1) else 0) = 6 := by
  simp only [initialShapeCode_eq_iff]
  exact weighted_shape_fiber_count _ (decodeShape_mem_shapes u hu)

end MatrixMultiplication.AllFieldInitialOrbit

end OAI