File size: 5,577 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 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 | import OAI.Combinatorics.EditApproximation.Geometry.ChargedRandomGlobalQuery
import OAI.Combinatorics.EditApproximation.Geometry.ChargedCoarseOracle
import OAI.Combinatorics.EditApproximation.Geometry.SourceRankedWork
namespace OAI
/-! A fixed accepted source family leaves a nonanticipating coarse query:
coarse values enter only when the corresponding leaf is requested. -/
namespace EditApproximation
section Coarse
variable {Ο Ξ± : Type*} [DecidableEq Ξ±] {M J R : β} [NeZero M] [NeZero R]
(source target : List Ξ±) (N P F exponent H Q T S passes copies : β)
(factor : β β β) (multiplier : β β β) (tau eta kappa delta : β)
(readGroup : β β β β PhysicalInternalNode M J β Fin R β GroupScalarKey M F Q β FiniteQuery Ο)
(readInteger : β β β β PhysicalInternalNode M J β Fin R β (β Γ TargetInterval target.length) β β β FiniteQuery Ο)
(sourceAnswer : Ο β β)
theorem physicalRandomGlobalQuery_refinement_initial_independent
(left right : PhysicalEntry M J target.length β β)
(parent : PhysicalTableRequest M J target.length)
(hi : Β¬ parent.index β€ T) (hd : parent.node.1.val < J)
(hw : Β¬ (physicalSourceInterval source.length parent.node).hi -
(physicalSourceInterval source.length parent.node).lo β€ 1) :
physicalRandomGlobalQuery source target N P F exponent H Q T S copies factor multiplier
tau eta kappa delta readGroup readInteger left parent =
physicalRandomGlobalQuery source target N P F exponent H Q T S copies factor multiplier
tau eta kappa delta readGroup readInteger right parent := by
unfold physicalRandomGlobalQuery
rw [dite_eq_left β¨by omega, hd, hwβ©, dite_eq_left β¨by omega, hd, hwβ©]
/-- Coarse answers enter the charged program only at coarse leaves. -/
theorem chargedRandomGlobalQuery_table_initial_independent
(left right : PhysicalEntry M J target.length β β)
(parent : {request : PhysicalTableRequest M J target.length // request.Bounded passes copies T S}) :
chargedRandomGlobalQuery source target N P F exponent H Q T S passes copies factor multiplier
tau eta kappa delta readGroup readInteger left (.inr parent) =
chargedRandomGlobalQuery source target N P F exponent H Q T S passes copies factor multiplier
tau eta kappa delta readGroup readInteger right (.inr parent) := by
unfold chargedRandomGlobalQuery
dsimp only
split_ifs with hi hd hw
Β· rfl
Β· rfl
Β· unfold physicalRandomBoundedQuery SourceRanked.restrictBody
rw [physicalRandomGlobalQuery_refinement_initial_independent source target N P F exponent H Q T S
copies factor multiplier tau eta kappa delta readGroup readInteger left right parent.val hi hd hw]
Β· rfl
/-- The flattened program receives each coarse answer from an explicit
external read. The constant zero here is never used as a seed answer. -/
noncomputable def chargedRandomCoarseQuery (root : ChargedPhysicalRequest M J target.length passes copies T S) :
FiniteQuery (PhysicalEntry M J target.length) :=
match root with
| .inl entry => .read entry FiniteQuery.done
| .inr parent =>
(SourceRanked.projectedBody ChargedPhysicalRequest.rank
(chargedRandomGlobalQuery source target N P F exponent H Q T S passes copies factor multiplier
tau eta kappa delta readGroup readInteger (fun _ => 0)) sourceAnswer (.inr parent)).substitute
(fun child => chargedRandomCoarseQuery child.val)
termination_by root.rank
decreasing_by exact child.property
theorem chargedRandomCoarseQuery_value
(initial : PhysicalEntry M J target.length β β)
(root : ChargedPhysicalRequest M J target.length passes copies T S) :
(chargedRandomCoarseQuery source target N P F exponent H Q T S passes copies factor multiplier
tau eta kappa delta readGroup readInteger sourceAnswer root).value (fun entry => (initial entry : β)) =
rankedProgramValue ChargedPhysicalRequest.rank
(SourceRanked.projectedBody ChargedPhysicalRequest.rank
(chargedRandomGlobalQuery source target N P F exponent H Q T S passes copies factor multiplier
tau eta kappa delta readGroup readInteger initial) sourceAnswer) root := by
have hall : β level root, root.rank = level β
(chargedRandomCoarseQuery source target N P F exponent H Q T S passes copies factor multiplier
tau eta kappa delta readGroup readInteger sourceAnswer root).value (fun entry => (initial entry : β)) =
rankedProgramValue ChargedPhysicalRequest.rank
(SourceRanked.projectedBody ChargedPhysicalRequest.rank
(chargedRandomGlobalQuery source target N P F exponent H Q T S passes copies factor multiplier
tau eta kappa delta readGroup readInteger initial) sourceAnswer) root := by
intro level
induction level using Nat.strong_induction_on with
| h level ih =>
intro root hlevel
cases root with
| inl entry =>
rw [chargedRandomCoarseQuery, rankedProgramValue]
rfl
| inr parent =>
rw [chargedRandomCoarseQuery, FiniteQuery.substitute_value, rankedProgramValue]
unfold SourceRanked.projectedBody
rw [
chargedRandomGlobalQuery_table_initial_independent source target N P F exponent H Q T S passes copies
factor multiplier tau eta kappa delta readGroup readInteger (fun _ => 0) initial parent]
congr 1
funext child
exact ih child.val.rank (hlevel βΈ child.property) child.val rfl
exact hall root.rank root rfl
end Coarse
end EditApproximation
end OAI
|