File size: 2,922 Bytes
3277efa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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