File size: 2,436 Bytes
e5a97c6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import OAI.Combinatorics.MatrixRemoval.OrderedHost
import OAI.Combinatorics.MatrixRemoval.HostBodyOrder

namespace OAI

/-!
# Body localization for the independent host enumerations

The canonical full-axis enumeration gives exhaustive body-mode localization.
All comparisons use the actual row and column indices; no order-reflection
certificate remains as an assumption.
-/

namespace Problem348.OrderedHost

open Construction

theorem rowIndex_reflects_variable_order {h : ℕ} (v w : VariablePosition h)
    (hvw : rowIndex h (.inr (.inl v)) < rowIndex h (.inr (.inl w))) :
    TreePositions.rowKey h v < TreePositions.rowKey h w :=
  (rowIndex_variable_lt_iff v w).mp hvw

theorem columnIndex_reflects_variable_order {h : ℕ} (v w : VariablePosition h)
    (hvw : columnIndex h (.inr (.inl v)) < columnIndex h (.inr (.inl w))) :
    TreePositions.columnKey h v < TreePositions.columnKey h w :=
  (columnIndex_variable_lt_iff v w).mp hvw

/-- The actual independent enumerations discharge all four numerical mode orders. -/
theorem bodyNodeOrder_of_indices {h : ℕ} {t : Mode h}
    {r₀ r₁ c₀ c₁ : Position h}
    (hr₀ : rowRole t 0 r₀) (hr₁ : rowRole t 1 r₁)
    (hc₀ : colRole t 0 c₀) (hc₁ : colRole t 1 c₁)
    (hrow : rowIndex h r₀ < rowIndex h r₁)
    (hcol : columnIndex h c₀ < columnIndex h c₁) :
    BodyNodeOrder t r₀ r₁ c₀ c₁ :=
  bodyNodeOrder_of_ordered (rowIndex h) (columnIndex h)
    rowIndex_reflects_variable_order columnIndex_reflects_variable_order
    hr₀ hr₁ hc₀ hc₁ hrow hcol

/-- Every correctly assigned ordered body in the canonical host has its
top-left cell on the shared leaf diagonal. -/
theorem body_leaf_diagonal {h : ℕ} {t : Mode h}
    {r₀ r₁ c₀ c₁ : Position h}
    (hr₀ : rowRole t 0 r₀) (hr₁ : rowRole t 1 r₁)
    (hc₀ : colRole t 0 c₀) (hc₁ : colRole t 1 c₁)
    (hrow : rowIndex h r₀ < rowIndex h r₁)
    (hcol : columnIndex h c₀ < columnIndex h c₁)
    (hb : ModeLocalization.IsP (host r₀ c₀) (host r₀ c₁)
      (host r₁ c₀) (host r₁ c₁)) :
    ∃ z : Fin (2 ^ h),
      r₀ = Sum.inr (Sum.inl (Fin.last (2 * h), z)) ∧
      c₀ = Sum.inr (Sum.inl (Fin.last (2 * h), z)) :=
  host_ordered_body_leaf_diagonal (rowIndex h) (columnIndex h)
    rowIndex_reflects_variable_order columnIndex_reflects_variable_order
    hr₀ hr₁ hc₀ hc₁ hrow hcol hb

end Problem348.OrderedHost

end OAI