open Classical in
theorem CC_exact {f : LocallyConstant C ℤ} (hf : Linear_CC' C hsC ho f = 0) :
    ∃ y, πs C o y = f := by
  dsimp [Linear_CC', Linear_CC'₀, Linear_CC'₁] at hf
  simp only [sub_eq_zero, ← LocallyConstant.coe_inj, LocallyConstant.coe_comap,
    continuous_CC'₀, continuous_CC'₁] at hf
  let C₀C : C0 C ho → C := fun x ↦ ⟨x.val, x.prop.1⟩
  have h₀ : Continuous C₀C := Continuous.subtype_mk continuous_induced_dom _
  let C₁C : π (C1 C ho) (ord I · < o) → C :=
    fun x ↦ ⟨SwapTrue o x.val, (swapTrue_mem_C1 C hsC ho x).1⟩
  have h₁ : Continuous C₁C := Continuous.subtype_mk
    ((continuous_swapTrue o).comp continuous_subtype_val) _
  refine ⟨LocallyConstant.piecewise' ?_ (isClosed_C0 C hC ho)
      (isClosed_proj _ o (isClosed_C1 C hC ho)) (f.comap C₀C) (f.comap C₁C) ?_, ?_⟩
  · rintro _ ⟨y, hyC, rfl⟩
    simp only [Set.mem_union, Set.mem_setOf_eq, Set.mem_univ, iff_true]
    rw [← union_C0C1_eq C ho] at hyC
    refine hyC.imp (fun hyC ↦ ?_) (fun hyC ↦ ⟨y, hyC, rfl⟩)
    rwa [C0_projOrd C hsC ho hyC]
  · intro x hx
    simpa only [h₀, h₁, LocallyConstant.coe_comap] using (congrFun hf ⟨x, hx⟩).symm
  · ext ⟨x, hx⟩
    rw [← union_C0C1_eq C ho] at hx
    cases' hx with hx₀ hx₁
    · have hx₀' : ProjRestrict C (ord I · < o) ⟨x, hx⟩ = x
      · simpa only [ProjRestrict, Set.MapsTo.val_restrict_apply] using C0_projOrd C hsC ho hx₀
      simp only [hx₀', hx₀, h₀, LocallyConstant.piecewise'_apply_left, LocallyConstant.coe_comap,
        Function.comp_apply, πs_apply, continuous_projRestrict]
    · have hx₁' : (ProjRestrict C (ord I · < o) ⟨x, hx⟩).val ∈ π (C1 C ho) (ord I · < o)
      · simpa only [ProjRestrict, Set.MapsTo.val_restrict_apply] using ⟨x, hx₁, rfl⟩
      

Proof state:
case refine_3.h.mk.inr
I : Type u
inst✝² : Inhabited I
inst✝¹ : LinearOrder I
inst✝ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
o : Ordinal.{u}
hC : IsClosed C
hsC : contained C (Order.succ o)
ho : o < Ordinal.type fun x x_1 => x < x_1
f : LocallyConstant ↑C ℤ
hf : ⇑f ∘ CC'₁ C hsC ho = ⇑f ∘ CC'₀ C ho
C₀C : ↑(C0 C ho) → ↑C := fun x => { val := ↑x, property := (_ : ↑x ∈ C) }
h₀ : Continuous C₀C
C₁C : ↑(π (C1 C ho) fun x => ord I x < o) → ↑C := fun x => { val := SwapTrue o ↑x, property := (_ : SwapTrue o ↑x ∈ C) }
h₁ : Continuous C₁C
x : I → Bool
hx : x ∈ C
hx₁ : x ∈ C1 C ho
hx₁' : ↑(ProjRestrict C (fun x => ord I x < o) { val := x, property := hx }) ∈ π (C1 C ho) fun x => ord I x < o
⊢ ((πs C o)
        (LocallyConstant.piecewise'
          (_ : ∀ ⦃a : I → Bool⦄, (a ∈ π C fun x => ord I x < o) → a ∈ C0 C ho ∪ π (C1 C ho) fun x => ord I x < o)
          (_ : IsClosed (C0 C ho)) (_ : IsClosed (π (C1 C ho) fun x => ord I x < o)) (LocallyConstant.comap C₀C f)
          (LocallyConstant.comap C₁C f)
          (_ :
            ∀ (x : I → Bool) (hx : x ∈ C0 C ho ∩ π (C1 C ho) fun x => ord I x < o),
              (LocallyConstant.comap C₀C f) { val := x, property := (_ : x ∈ C0 C ho) } =
                (LocallyConstant.comap C₁C f) { val := x, property := (_ : x ∈ π (C1 C ho) fun x => ord I x < o) })))
      { val := x, property := hx } =
    f { val := x, property := hx }

Next tactic:
simp only [πs_apply, continuous_projRestrict, LocallyConstant.coe_comap, Function.comp_apply,
        hx₁', LocallyConstant.piecewise'_apply_right, h₁]