File size: 3,733 Bytes
4a56cd6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import OAI.MeasureTheory.DyadicAvoidance.LocalPredicateFactor
import OAI.MeasureTheory.DyadicAvoidance.FiniteTableModel

namespace OAI

noncomputable section

namespace Problem310.FiniteLocalPredicate

open RoutingPath GridSeparation LocalPredicateFactor FiniteTableModel

variable {M d : β„•}

/-- The leaf reached from a local child, with its ambient-depth proof retained. -/
def localLeaf (choose : List (Child M) β†’ ℝ β†’ Child M)
    (r : β„•) (P : List (Child M)) (hdepth : P.length + r = d) (x : ℝ) : Leaf M d :=
  ⟨routeFrom choose r P x, (length_routeFrom choose r P x).trans hdepth⟩

/-- Table lookup at a valid node depends only on a finer common grid. -/
theorem selector_lookup_eq {b : Node M d β†’ Fin M β†’ β„•} (Ο‰ : SelectorTable b)
    (Q : Node M d) (i : Fin M) {B : β„•} (hb : b Q i ≀ B) {x y : ℝ}
    (hxy : ⌊(2 : ℝ) ^ (B + 2) * Int.fract xβŒ‹ =
      ⌊(2 : ℝ) ^ (B + 2) * Int.fract yβŒ‹) :
    Ο‰ (selectorAddress b Q i x) = Ο‰ (selectorAddress b Q i y) := by
  exact table_eq_of_finest_key hb (fun k => Ο‰ ⟨(Q, i), k⟩) hxy

/-- The analogous statement for an actual dependent terminal-table address. -/
theorem terminal_lookup_eq {b : Leaf M d β†’ β„•} (Ο‰ : TerminalTable b)
    (L : Leaf M d) {B : β„•} (hb : b L ≀ B) {x y : ℝ}
    (hxy : ⌊(2 : ℝ) ^ (B + 2) * Int.fract xβŒ‹ =
      ⌊(2 : ℝ) ^ (B + 2) * Int.fract yβŒ‹) :
    Ο‰ (terminalAddress b L x) = Ο‰ (terminalAddress b L y) := by
  exact table_eq_of_finest_key hb (fun k => Ο‰ ⟨L, k⟩) hxy

/-- Concrete local terminal predicates in the finite table model factor through
the largest resolution in the child subtree. `rule` may be the canonical
first-success/default rule; no assumptions on that rule are needed. -/
theorem finite_local_predicate_factors
    (bS : Node M d β†’ Fin M β†’ β„•) (bT : Leaf M d β†’ β„•)
    (Ο‰S : SelectorTable bS) (Ο‰T : TerminalTable bT)
    (choose : List (Child M) β†’ ℝ β†’ Child M)
    (rule : List (Child M) β†’ (Fin M β†’ Bool) β†’ Child M)
    (hchoose : βˆ€ Q x, choose Q x = rule Q (fun i => selectorValue bS Ο‰S Q i x))
    (r : β„•) (P : List (Child M)) (hdepth : P.length + r = d)
    (U : Node M d) (i : Fin M) (B : β„•)
    (hbS : βˆ€ Q : Node M d, P.IsPrefix Q.val β†’ βˆ€ j, bS Q j ≀ B)
    (hbT : βˆ€ L : Leaf M d, P.IsPrefix L.val β†’ bT L ≀ B)
    (hIn : bS U i ≀ B) {x y : ℝ}
    (hxy : ⌊(2 : ℝ) ^ (B + 2) * Int.fract xβŒ‹ =
      ⌊(2 : ℝ) ^ (B + 2) * Int.fract yβŒ‹) :
    (Ο‰S (selectorAddress bS U i x) &&
      Ο‰T (terminalAddress bT (localLeaf choose r P hdepth x) x)) =
    (Ο‰S (selectorAddress bS U i y) &&
      Ο‰T (terminalAddress bT (localLeaf choose r P hdepth y) y)) := by
  have hchoice : βˆ€ Q : List (Child M), P.IsPrefix Q β†’ Q.length < P.length + r β†’
      βˆ€ u v : ℝ, ⌊(2 : ℝ) ^ (B + 2) * Int.fract uβŒ‹ =
        ⌊(2 : ℝ) ^ (B + 2) * Int.fract vβŒ‹ β†’ choose Q u = choose Q v := by
    intro Q hPQ hlen u v huv
    have hQ : Q.length < d := hlen.trans_eq hdepth
    rw [hchoose Q u, hchoose Q v]
    apply congrArg (rule Q)
    funext j
    have hlook := selector_lookup_eq Ο‰S (⟨Q, hQ⟩ : Node M d) j
      (hbS ⟨Q, hQ⟩ hPQ j) huv
    simpa only [selectorValue, dite_eq_left hQ] using hlook
  have hroute := route_eq_of_key_eq choose
    (fun z : ℝ => ⌊(2 : ℝ) ^ (B + 2) * Int.fract zβŒ‹) r P hchoice hxy
  have hleaf : localLeaf choose r P hdepth x = localLeaf choose r P hdepth y :=
    Subtype.ext hroute
  have hprefix : P.IsPrefix (localLeaf choose r P hdepth y).val :=
    prefix_routeFrom choose r P y
  rw [selector_lookup_eq Ο‰S U i hIn hxy, hleaf,
    terminal_lookup_eq Ο‰T (localLeaf choose r P hdepth y) (hbT _ hprefix) hxy]

end Problem310.FiniteLocalPredicate

end

end OAI