Remove maximal chain witness from FiniteHeightLattice
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -234,10 +234,7 @@ instance [Inhabited α] : FiniteHeightLattice (AboveBelow α) where
|
||||
toLattice := inferInstance
|
||||
toOrderBot := inferInstance
|
||||
toOrderTop := inferInstance
|
||||
longestChain :=
|
||||
((RelSeries.singleton _ bot).snoc (mk default)
|
||||
(by rw [RelSeries.last_singleton]; exact bot_lt_mk default)).snoc top
|
||||
(by rw [RelSeries.last_snoc]; exact mk_lt_top default)
|
||||
height := 2
|
||||
chains_bounded := boundedChains
|
||||
|
||||
end AboveBelow
|
||||
|
||||
@@ -31,8 +31,7 @@ instance : FiniteHeightLattice Bool where
|
||||
toLattice := inferInstance
|
||||
toOrderBot := inferInstance
|
||||
toOrderTop := inferInstance
|
||||
longestChain := (RelSeries.singleton _ (⊥ : Bool)).snoc (⊤ : Bool)
|
||||
(by rw [RelSeries.last_singleton]; exact bot_lt_top)
|
||||
height := 1
|
||||
chains_bounded := boundedChains
|
||||
|
||||
end Bool
|
||||
|
||||
@@ -107,66 +107,18 @@ section FiniteHeight
|
||||
|
||||
variable [FiniteHeightLattice β]
|
||||
|
||||
private lemma consBot_strictMono {n : ℕ} :
|
||||
StrictMono (fun b : β => (Fin.cons b (⊥ : Fin n → β) : Fin (n + 1) → β)) := by
|
||||
intro a b hab
|
||||
refine lt_iff_le_and_ne.mpr ⟨?_, ?_⟩
|
||||
· refine Pi.le_def.mpr (fun i => Fin.cases ?_ (fun j => ?_) i)
|
||||
· simpa using hab.le
|
||||
· simp
|
||||
· exact fun h => hab.ne (by simpa using congrFun h 0)
|
||||
|
||||
private lemma consTop_strictMono {n : ℕ} :
|
||||
StrictMono (fun f : Fin n → β => (Fin.cons (⊤ : β) f : Fin (n + 1) → β)) := by
|
||||
intro f g hfg
|
||||
refine lt_iff_le_and_ne.mpr ⟨?_, ?_⟩
|
||||
· refine Pi.le_def.mpr (fun i => Fin.cases ?_ (fun j => ?_) i)
|
||||
· simp
|
||||
· simpa using Pi.le_def.mp hfg.le j
|
||||
· intro h
|
||||
apply hfg.ne
|
||||
funext j
|
||||
simpa using congrFun h j.succ
|
||||
|
||||
/-- The maximal chain in `Fin n → β`: walk the first tuple element from `⊥` to `⊤`
|
||||
through `β`'s longest chain, then do that with the second element, and so on. -/
|
||||
private def stdChain : (n : ℕ) →
|
||||
{ s : LTSeries (Fin n → β) //
|
||||
s.head = (⊥ : Fin n → β) ∧
|
||||
s.length = n * (FiniteHeightLattice.longestChain (α := β)).length }
|
||||
| 0 => ⟨RelSeries.singleton _ ⊥, by rw [RelSeries.head_singleton], by simp⟩
|
||||
| n + 1 =>
|
||||
let prev := stdChain n
|
||||
⟨RelSeries.smash
|
||||
((FiniteHeightLattice.longestChain (α := β)).map
|
||||
(fun b => (Fin.cons b (⊥ : Fin n → β) : Fin (n + 1) → β)) consBot_strictMono)
|
||||
(prev.1.map (fun f => (Fin.cons (⊤ : β) f : Fin (n + 1) → β)) consTop_strictMono)
|
||||
(by
|
||||
rw [LTSeries.last_map, LTSeries.head_map,
|
||||
FiniteHeightLattice.longestChain_last, prev.2.1]),
|
||||
by
|
||||
simp only [RelSeries.head_smash, LTSeries.head_map]
|
||||
rw [FiniteHeightLattice.longestChain_head]
|
||||
funext i
|
||||
refine Fin.cases ?_ (fun j => ?_) i <;> simp [Pi.bot_apply],
|
||||
by
|
||||
show (FiniteHeightLattice.longestChain (α := β)).length + prev.1.length
|
||||
= (n + 1) * (FiniteHeightLattice.longestChain (α := β)).length
|
||||
rw [prev.2.2, Nat.succ_mul]; exact Nat.add_comm _ _⟩
|
||||
|
||||
instance instFiniteHeight {n : ℕ} : FiniteHeightLattice (Fin n → β) where
|
||||
toLattice := inferInstance
|
||||
toOrderBot := inferInstance
|
||||
toOrderTop := inferInstance
|
||||
longestChain := (stdChain n).1
|
||||
height := n * FiniteHeightLattice.height (α := β)
|
||||
chains_bounded := fun c => by
|
||||
obtain ⟨cs, _, _, hbound⟩ := exists_unzip c
|
||||
refine hbound.trans ?_
|
||||
rw [(stdChain n).2.2]
|
||||
calc ∑ i, (cs i).length
|
||||
≤ ∑ _i : Fin n, (FiniteHeightLattice.longestChain (α := β)).length :=
|
||||
≤ ∑ _i : Fin n, FiniteHeightLattice.height (α := β) :=
|
||||
Finset.sum_le_sum (fun i _ => FiniteHeightLattice.chains_bounded (cs i))
|
||||
_ = n * (FiniteHeightLattice.longestChain (α := β)).length := by
|
||||
_ = n * FiniteHeightLattice.height (α := β) := by
|
||||
simp [Finset.sum_const, Finset.card_univ, Fintype.card_fin]
|
||||
|
||||
end FiniteHeight
|
||||
|
||||
Reference in New Issue
Block a user