cfahlgren1's picture
download
raw
3.59 kB
import OAI.Combinatorics.EditApproximation.Refinement.PhysicalScalarSource
import OAI.Combinatorics.EditApproximation.Refinement.PhysicalNodeEncoding
import Mathlib.Data.Nat.Pairing
import OAI.Combinatorics.EditApproximation.Definitions
namespace OAI
/-! Scalar-source addresses are computed from physical coordinates by
integer pairing. No enumeration of the probability space is performed. -/
namespace EditApproximation
variable {M J N n exponent F Q R B : ℕ}
theorem physicalScalarCode_injective (hM : 1 ≤ M) :
Function.Injective (@physicalScalarCode M J N n exponent F Q R B) := by
intro left right heq
rcases left with ⟨left, li⟩
rcases right with ⟨right, ri⟩
cases left with
| inl left =>
cases right with
| inl right =>
have hp : Nat.pair (physicalEntryCode (left.1.1.val, left.1.2.2))
(Nat.pair left.1.2.1.val (Nat.pair left.2.val.val li.val)) =
Nat.pair (physicalEntryCode (right.1.1.val, right.1.2.2))
(Nat.pair right.1.2.1.val (Nat.pair right.2.val.val ri.val)) := by
change 2 * _ = 2 * _ at heq
omega
rcases Nat.pair_eq_pair.mp hp with ⟨he, hs⟩
rcases Nat.pair_eq_pair.mp hs with ⟨hs, hr⟩
rcases Nat.pair_eq_pair.mp hr with ⟨hr, ht⟩
have he := physicalEntryCode_injective hM he
have hn : left.1.1 = right.1.1 := Subtype.ext (congrArg Prod.fst he)
have hq := congrArg Prod.snd he
have hs : left.1.2.1 = right.1.2.1 := Fin.ext hs
have hr : left.2 = right.2 := Subtype.ext (Fin.ext hr)
have ht : li = ri := Fin.ext ht
rcases left with ⟨⟨node, scale, q⟩, range⟩
rcases right with ⟨⟨node', scale', q'⟩, range'⟩
dsimp only at hn hq hs hr
subst node'
subst scale'
subst q'
subst range'
cases ht
rfl
| inr right =>
change 2 * _ = 2 * _ + 1 at heq
omega
| inr left =>
cases right with
| inl right =>
change 2 * _ + 1 = 2 * _ at heq
omega
| inr right =>
have hp : Nat.pair (physicalNodeCode left.1.val)
(Nat.pair left.2.1.val (Nat.pair left.2.2.1.val (Nat.pair left.2.2.2.val
(Nat.pair li.1.val (Nat.pair li.2.1.val li.2.2.val))))) =
Nat.pair (physicalNodeCode right.1.val)
(Nat.pair right.2.1.val (Nat.pair right.2.2.1.val (Nat.pair right.2.2.2.val
(Nat.pair ri.1.val (Nat.pair ri.2.1.val ri.2.2.val))))) := by
change 2 * _ + 1 = 2 * _ + 1 at heq
omega
rcases Nat.pair_eq_pair.mp hp with ⟨hn, hp⟩
rcases Nat.pair_eq_pair.mp hp with ⟨hs, hp⟩
rcases Nat.pair_eq_pair.mp hp with ⟨hx, hp⟩
rcases Nat.pair_eq_pair.mp hp with ⟨hy, hp⟩
rcases Nat.pair_eq_pair.mp hp with ⟨ht, hp⟩
rcases Nat.pair_eq_pair.mp hp with ⟨hl, hv⟩
have hn : left.1 = right.1 := Subtype.ext (physicalNodeCode_injective hM hn)
have hs : left.2.1 = right.2.1 := Fin.ext hs
have hx : left.2.2.1 = right.2.2.1 := Fin.ext hx
have hy : left.2.2.2 = right.2.2.2 := Fin.ext hy
rcases left with ⟨node, scale, x, y⟩
rcases right with ⟨node', scale', x', y'⟩
dsimp only at hn hs hx hy
subst node'
subst scale'
subst x'
subst y'
rcases li with ⟨time, label, value⟩
rcases ri with ⟨time', label', value'⟩
have ht : time = time' := Fin.ext ht
cases ht
have hl : label = label' := Fin.ext hl
cases hl
have hv : value = value' := Fin.ext hv
cases hv
rfl
end EditApproximation
end OAI

Xet Storage Details

Size:
3.59 kB
·
Xet hash:
f9725dfc9985d9965ebda0a6a2de25634914dd6743b7b6737abfa4d8df4d27d1

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