File size: 5,789 Bytes
a72760f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
import OAI.NumberTheory.Ostmann.Tree.CycleQuartetActionsClassification
import OAI.NumberTheory.Ostmann.Tree.QuartetLocal
import OAI.NumberTheory.Ostmann.Tree.QuartetRemainingMeans

namespace OAI

noncomputable section
open scoped BigOperators
namespace Ostmann.Tree.CycleQuartet
open Quartet Ostmann.FiniteField
variable {p : ℕ} [Fact p.Prime]
local instance cycleLocalMajorantCharDecEq : DecidableEq (MulChar (ZMod p) ℂ) := Classical.decEq _

def bottomSign (P : Parameters (ZMod p) 2) (side freeRight : Bool) : Bool :=
  match P with
  | .branch _ _ _ _ L R => parameterSign (if side then R else L) freeRight

def orientedCharacter (inverse : Bool) (ρ : MulChar (ZMod p) ℂ) : MulChar (ZMod p) ℂ :=
  if inverse then ρ⁻¹ else ρ

def selectedMajorant (P : Parameters (ZMod p) 2) (g : ZMod p → ℂ)
    (κ : Kind) (ρ : MulChar (ZMod p) ℂ) (y : ZMod p) : ℝ :=
  match κ with
  | .same side inverse => FiniteField.sameLocalMajorant g
      (bottomSign P side false) (bottomSign P (!side) false) side (orientedCharacter inverse ρ) y
  | .cross a b inverse => FiniteField.crossLocalMajorant g
      (bottomSign P false a) (bottomSign P true b) a b (orientedCharacter inverse ρ) y

def unselectedMajorant (P : Parameters (ZMod p) 2) (g : ZMod p → ℂ)
    (ρ : MulChar (ZMod p) ℂ) (y : ZMod p) : ℝ :=
  if ρ=1 then FiniteField.untouchedLocalMajorant g (bottomSign P false false)
    (bottomSign P true false) y else 0

theorem selectedMajorant_nonneg (P : Parameters (ZMod p) 2) (g : ZMod p → ℂ)
    (κ : Kind) (ρ : MulChar (ZMod p) ℂ) (y : ZMod p) :
    0≤ selectedMajorant P g κ ρ y := by
  cases κ with
  | same side inverse => exact FiniteField.sameLocalMajorant_nonneg _ _ _ _ _ _
  | cross a b inverse => exact FiniteField.crossLocalMajorant_nonneg _ _ _ _ _ _ _

theorem unselectedMajorant_nonneg (P : Parameters (ZMod p) 2) (g : ZMod p → ℂ)
    (ρ : MulChar (ZMod p) ℂ) (y : ZMod p) : 0≤ unselectedMajorant P g ρ y := by
  unfold unselectedMajorant
  split_ifs
  · exact FiniteField.untouchedLocalMajorant_nonneg _ _ _ _
  · exact le_rfl

theorem selectedMajorant_mean_small (P : Parameters (ZMod p) 2) (g : ZMod p → ℂ)
    (κ : Kind) (ρ : MulChar (ZMod p) ℂ) (hg0 : g 0=0) (hg : l2Sq g≤1) :
    unitMean (selectedMajorant P g κ ρ)≤25600*treeError g := by
  cases κ with
  | same side inverse =>
    exact (FiniteField.sameLocalMajorant_mean_small _ _ _ _ _ hg0 hg).trans
      (mul_le_mul_of_nonneg_right (by norm_num) (treeError_nonneg g))
  | cross a b inverse => exact FiniteField.crossLocalMajorant_mean_small _ _ _ _ _ _ hg0 hg

omit [Fact p.Prime] in
theorem sum_orientedCharacter (inverse : Bool) (H : MulChar (ZMod p) ℂ → ℝ) :
    (∑ ρ : MulChar (ZMod p) ℂ,H (orientedCharacter inverse ρ)) = ∑ ρ : MulChar (ZMod p) ℂ,H ρ := by
  cases inverse
  · rfl
  · exact (Equiv.inv (MulChar (ZMod p) ℂ)).bijective.sum_comp H

theorem selectedMajorant_mean_total (P : Parameters (ZMod p) 2) (g : ZMod p → ℂ)
    (κ : Kind) (hg0 : g 0=0) (hg : l2Sq g≤1) :
    (∑ ρ : MulChar (ZMod p) ℂ,unitMean (selectedMajorant P g κ ρ))≤256 := by
  cases κ with
  | same side inverse =>
    change (∑ ρ : MulChar (ZMod p) ℂ,unitMean (FiniteField.sameLocalMajorant g
      (bottomSign P side false) (bottomSign P (!side) false) side (orientedCharacter inverse ρ)))≤256
    rw [sum_orientedCharacter inverse (fun ρ => unitMean (FiniteField.sameLocalMajorant g
      (bottomSign P side false) (bottomSign P (!side) false) side ρ))]
    exact FiniteField.sameLocalMajorant_mean_total _ _ _ _ hg0 hg
  | cross a b inverse =>
    change (∑ ρ : MulChar (ZMod p) ℂ,unitMean (FiniteField.crossLocalMajorant g
      (bottomSign P false a) (bottomSign P true b) a b (orientedCharacter inverse ρ)))≤256
    rw [sum_orientedCharacter inverse (fun ρ => unitMean (FiniteField.crossLocalMajorant g
      (bottomSign P false a) (bottomSign P true b) a b ρ))]
    exact (FiniteField.crossLocalMajorant_mean_total _ _ _ _ _ hg0 hg).trans (by norm_num)

theorem unselectedMajorant_mean_total (P : Parameters (ZMod p) 2) (g : ZMod p → ℂ)
    (hg0 : g 0=0) (hg : l2Sq g≤1) :
    (∑ ρ : MulChar (ZMod p) ℂ,unitMean (unselectedMajorant P g ρ))≤256 := by
  classical
  have he (ρ : MulChar (ZMod p) ℂ) : unitMean (unselectedMajorant P g ρ) =
      if ρ=1 then unitMean (FiniteField.untouchedLocalMajorant g (bottomSign P false false)
        (bottomSign P true false)) else 0 := by
    by_cases hρ : ρ=1 <;> simp [unselectedMajorant,hρ,unitMean]
  simp_rw [he]
  simp only [Finset.sum_ite_eq',Finset.mem_univ,ite_true]
  exact (FiniteField.untouchedLocalMajorant_mean _ _ _ hg0 hg).trans (by norm_num)

theorem selectedMajorant_same_node (N : NodeInput (ZMod p) 1) (g : ZMod p → ℂ)
    (side inverse : Bool) (ρ : MulChar (ZMod p) ℂ) (y : ZMod p) :
    selectedMajorant N.parameters g (.same side inverse) ρ y =
      N.sameLocalMajorant g side (orientedCharacter inverse ρ) y := by
  cases side <;> rfl

theorem selectedMajorant_cross_node (N : NodeInput (ZMod p) 1) (g : ZMod p → ℂ)
    (a b inverse : Bool) (ρ : MulChar (ZMod p) ℂ) (y : ZMod p) :
    selectedMajorant N.parameters g (.cross a b inverse) ρ y =
      N.crossLocalMajorant g a b (orientedCharacter inverse ρ) y := by
  simp only [selectedMajorant, bottomSign, NodeInput.parameters, Bool.false_eq_true,
    ↓reduceIte, FiniteField.crossLocalMajorant, NodeInput.crossLocalMajorant,
    norm_div, Complex.norm_natCast]

theorem unselectedMajorant_node (N : NodeInput (ZMod p) 1) (g : ZMod p → ℂ)
    (ρ : MulChar (ZMod p) ℂ) (y : ZMod p) :
    unselectedMajorant N.parameters g ρ y = if ρ=1 then N.untouchedLocalMajorant g y else 0 := rfl

end Ostmann.Tree.CycleQuartet
end

end OAI