File size: 2,922 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
import OAI.SetTheory.PartitionPrinciple.Transfinite.InaccessibleBounds

namespace OAI

section

namespace PartitionPilot.Compression.RecursiveMaps
universe u v w
variable {X : Type u} {Column : Type v} {Coord : Type w} {P : MeetOrder X}
variable (C : LinearHeightOrder Column) (D : LinearHeightOrder Coord)
variable (depth : X β†’ Nat) (columns : Nat β†’ Column)
variable (seed : {x : X // depth x = 0} β†’ Column Γ— Coord)
variable (coordinate : {x : X // depth x β‰  0} β†’ Coord)

def depthHeightValue (x : X) : Column Γ— Coord :=
  if h : depth x = 0 then seed ⟨x, h⟩ else (columns (depth x), coordinate ⟨x, h⟩)

theorem depthHeightValue_old (x : X) (h : depth x = 0) :
    depthHeightValue depth columns seed coordinate x = seed ⟨x, h⟩ := by
  simp only [depthHeightValue, dite_eq_left h]

theorem depthHeightValue_fresh (x : X) (h : depth x β‰  0) :
    depthHeightValue depth columns seed coordinate x = (columns (depth x), coordinate ⟨x, h⟩) := by
  simp only [depthHeightValue, dite_eq_right h]

def depthLayerHeight
    (monotone : βˆ€ x y, P.le x y β†’ depth x ≀ depth y)
    (increasing : βˆ€ n m, n < m β†’ C.lt (columns n) (columns m))
    (above : βˆ€ x n, C.lt (seed x).1 (columns n))
    (seedStrict : βˆ€ x y, P.le x.val y.val β†’ x.val β‰  y.val β†’ (C.lex D).lt (seed x) (seed y))
    (coordinateStrict : βˆ€ x y, depth x.val = depth y.val β†’ P.le x.val y.val β†’
      x.val β‰  y.val β†’ D.lt (coordinate x) (coordinate y)) :
    StrictHeight P (C.lex D).toHeightOrder where
  value := depthHeightValue depth columns seed coordinate
  strict x y lower different := by
    have depths := monotone x y lower
    by_cases hx : depth x = 0
    Β· rw [depthHeightValue_old depth columns seed coordinate x hx]
      by_cases hy : depth y = 0
      Β· rw [depthHeightValue_old depth columns seed coordinate y hy]
        exact seedStrict ⟨x, hx⟩ ⟨y, hy⟩ lower different
      Β· rw [depthHeightValue_fresh depth columns seed coordinate y hy]
        exact Or.inl (above ⟨x, hx⟩ (depth y))
    Β· have hy : depth y β‰  0 := by omega
      rw [depthHeightValue_fresh depth columns seed coordinate x hx,
        depthHeightValue_fresh depth columns seed coordinate y hy]
      by_cases same : depth x = depth y
      · exact Or.inr ⟨congrArg columns same, coordinateStrict ⟨x, hx⟩ ⟨y, hy⟩ same lower different⟩
      Β· exact Or.inl (increasing _ _ (by omega))

theorem depthHeightValue_column_bound (cap : Column)
    (oldBound : βˆ€ x, C.lt (seed x).1 cap) (columnBound : βˆ€ n, C.lt (columns n) cap) (x : X) :
    C.lt (depthHeightValue depth columns seed coordinate x).1 cap := by
  by_cases h : depth x = 0
  Β· rw [depthHeightValue_old depth columns seed coordinate x h]
    exact oldBound ⟨x, h⟩
  Β· rw [depthHeightValue_fresh depth columns seed coordinate x h]
    exact columnBound (depth x)

end PartitionPilot.Compression.RecursiveMaps

end

end OAI