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
|