cfahlgren1's picture
download
raw
3.28 kB
import OAI.Combinatorics.EditApproximation.Refinement.PhysicalInputEncoding
import OAI.Combinatorics.EditApproximation.Geometry.StateDomain
import OAI.Combinatorics.EditApproximation.Definitions
namespace OAI
/-! Computable base-M node labels and mixed-radix table-entry keys.
Equal source intervals at different physical nodes keep distinct keys. -/
namespace EditApproximation
theorem treeLayerCode_bound (M d : ℕ) (path : TreeLayer M d) :
treeLayerCode M d path < M ^ d := by
induction d with
| zero => exact Nat.zero_lt_one
| succ d ih =>
have hp := ih path.1
have hi := path.2.isLt
change path.2.val + M * treeLayerCode M d path.1 < M ^ (d + 1)
rw [pow_succ]
nlinarith only [hi, Nat.mul_le_mul_left M (Nat.succ_le_of_lt hp)]
theorem treeLayerCode_injective (M d : ℕ) : Function.Injective (treeLayerCode M d) := by
induction d with
| zero => intro first second _; cases first; cases second; rfl
| succ d ih =>
rintro ⟨first, i⟩ ⟨second, j⟩ heq
obtain ⟨hlabel, hpath⟩ := mixedRadix_injective i.isLt j.isLt heq
exact Prod.ext (ih hpath) (Fin.ext hlabel)
theorem physicalNode_layer_bound {M J : ℕ} (hM : 1 ≤ M) (node : PhysicalNode M J) :
treeLayerCode M node.1.val node.2 < M ^ J :=
(treeLayerCode_bound M node.1.val node.2).trans_le
(pow_le_pow_right₀ hM (Nat.le_of_lt_succ node.1.isLt))
theorem physicalNodeCode_injective {M J : ℕ} (hM : 1 ≤ M) :
Function.Injective (@physicalNodeCode M J) := by
rintro ⟨depth, path⟩ ⟨depth', path'⟩ heq
obtain ⟨hp, hd⟩ := mixedRadix_injective
(physicalNode_layer_bound hM ⟨depth, path⟩)
(physicalNode_layer_bound hM ⟨depth', path'⟩) heq
have hdepth : depth = depth' := Fin.ext hd
subst depth'
have hpath := treeLayerCode_injective M depth.val hp
change path = path' at hpath
subst path'
rfl
theorem physicalNodeCode_bound {M J : ℕ} (hM : 1 ≤ M) (node : PhysicalNode M J) :
physicalNodeCode node < M ^ J * (J + 1) := by
have hpath := physicalNode_layer_bound hM node
have hdepth := node.1.isLt
unfold physicalNodeCode
nlinarith only [hpath, Nat.mul_le_mul_left (M ^ J) (Nat.succ_le_of_lt hdepth)]
theorem physicalEntryCode_injective {M J n : ℕ} (hM : 1 ≤ M) :
Function.Injective (@physicalEntryCode M J n) := by
rintro ⟨node, q⟩ ⟨node', q'⟩ heq
obtain ⟨hq, hn⟩ := mixedRadix_injective
(by simpa only [Nat.one_mul] using childInputCode_bound ((0 : Fin 1), q))
(by simpa only [Nat.one_mul] using childInputCode_bound ((0 : Fin 1), q')) heq
have hstate := childInputCode_injective 1 n hq
have hqeq : q = q' := congrArg (fun pair : Fin 1 × TargetInterval n => pair.2) hstate
exact Prod.ext (physicalNodeCode_injective hM hn) hqeq
theorem physicalEntryCode_bound {M J n : ℕ} (hM : 1 ≤ M) (state : PhysicalEntry M J n) :
physicalEntryCode state < (n + 1) ^ 2 * (M ^ J * (J + 1)) := by
have hstate : childInputCode ((0 : Fin 1), state.2) < (n + 1) ^ 2 := by
simpa only [Nat.one_mul] using childInputCode_bound ((0 : Fin 1), state.2)
have hnode := physicalNodeCode_bound hM state.1
unfold physicalEntryCode
nlinarith only [hstate, Nat.mul_le_mul_left ((n + 1) ^ 2) (Nat.succ_le_of_lt hnode)]
end EditApproximation
end OAI

Xet Storage Details

Size:
3.28 kB
·
Xet hash:
a8e9a5b026671360f24a36052e409fef689aa172faed8411a3687a1e47a36a18

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.