introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
3.58 kB
import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.CanonicalCW
namespace OAI
/-! Joint tensor extraction, compatibility and entropy estimates. -/
noncomputable section
namespace MatrixMultiplication.JointPopulationCWNonzero
open MatrixMultiplication.Foundation JointPopulation JointCanonicalization JointCanonicalCW
open CWStrands InheritedMasks
open scoped BigOperators
attribute [local instance] Classical.propDecidable
variable {H F : Type*} [Fintype H] [DecidableEq H] [Field F]
omit [DecidableEq H] in
theorem class_half_products_nonzero
(counts : H β†’ Shape β†’ β„•) (leftLength rightLength : H β†’ β„•)
(parentShape : H β†’ Fin 3 β†’ β„•) (hleft : βˆ€ h, leftLength h ≀ 8)
(hsupp : βˆ€ h u, 0 < counts h u β†’ βˆ€ s, shapeNat u s ≀ parentShape h s)
(e : Target counts)
(x y z : RawPairs counts (Left leftLength) (Right rightLength))
(hsource : sourceTensor counts (Left leftLength) (Right rightLength)
(parentTensor (F := F) leftLength rightLength parentShape) x y z β‰  0)
(hx : coarseMask counts (Left leftLength) (Right rightLength)
(coarse leftLength rightLength hleft) 0 e x)
(hy : coarseMask counts (Left leftLength) (Right rightLength)
(coarse leftLength rightLength hleft) 1 e y)
(hz : coarseMask counts (Left leftLength) (Right rightLength)
(coarse leftLength rightLength hleft) 2 e z)
(h : H) (u : Shape) (hn : 0 < counts h u) :
(∏ i : Class counts e h u,
shapeTensor (F := F) (Fin (leftLength h)) (shapeNat u)
(x h i.val).1 (y h i.val).1 (z h i.val).1) β‰  0 ∧
(∏ i : Class counts e h u,
shapeTensor (F := F) (Fin (rightLength h)) (parentShape h - shapeNat u)
(x h i.val).2 (y h i.val).2 (z h i.val).2) β‰  0 := by
change (∏ h' : H, ∏ i : Positions counts h',
parentTensor (F := F) leftLength rightLength parentShape h'
(x h' i) (y h' i) (z h' i)) β‰  0 at hsource
have hparent (i : Positions counts h) :
parentTensor (F := F) leftLength rightLength parentShape h
(x h i) (y h i) (z h i) β‰  0 :=
Finset.prod_ne_zero_iff.mp
(Finset.prod_ne_zero_iff.mp hsource h (Finset.mem_univ h)) i (Finset.mem_univ i)
have hhalves (i : Class counts e h u) :
shapeTensor (F := F) (Fin (leftLength h)) (shapeNat u)
(x h i.val).1 (y h i.val).1 (z h i.val).1 *
shapeTensor (F := F) (Fin (rightLength h)) (parentShape h - shapeNat u)
(x h i.val).2 (y h i.val).2 (z h i.val).2 β‰  0 := by
have hx' : coarse leftLength rightLength hleft 0 h (x h i.val) = u.1 := by
simpa [shapeSide, i.property] using hx h i.val
have hy' : coarse leftLength rightLength hleft 1 h (y h i.val) = u.2.1 := by
simpa [shapeSide, i.property] using hy h i.val
have hz' : coarse leftLength rightLength hleft 2 h (z h i.val) = u.2.2 := by
simpa [shapeSide, i.property] using hz h i.val
have hblock : block (Left leftLength) (Right rightLength)
(parentTensor (F := F) leftLength rightLength parentShape)
(coarse leftLength rightLength hleft) (h, u)
(x h i.val) (y h i.val) (z h i.val) β‰  0 := by
simpa [block, hx', hy', hz'] using hparent i.val
rw [block_eq_product leftLength rightLength parentShape hleft h u
(hsupp h u hn)] at hblock
exact hblock
constructor
Β· apply Finset.prod_ne_zero_iff.mpr
intro i _
exact (mul_ne_zero_iff.mp (hhalves i)).1
Β· apply Finset.prod_ne_zero_iff.mpr
intro i _
exact (mul_ne_zero_iff.mp (hhalves i)).2
end MatrixMultiplication.JointPopulationCWNonzero
end
end OAI