3
4

1 回答 1

1

I am not sure this is an ideal solution, but it does work for me. First we need a lemma to weaken the bounded range:

def range_weaken {a b : ℤ} : zbound (a + 1) b → zbound a b
  | ⟨i, ⟨lbound, rbound⟩⟩ :=
    ⟨i, and.intro
          (le_of_add_le_left _ 1 _ dec_trivial lbound)
          rbound⟩

Then we can redefine range in terms of weakened ranges:

def range : ∀(a b : ℤ), list (zbound a b) 
  | fro to := if h : fro < to
              then ⟨fro, and.intro (le_refl _) h⟩
                   :: list.map range_weaken (range (fro + 1) to)
              else []
  using_well_founded { ... }

Note: I couldn't find a lemma I was looking for, so I hand-proved the following:

def le_of_add_le_left (a b c : ℤ) : 0 ≤ b → a + b ≤ c → a ≤ c
于 2018-01-08T23:36:16.373 回答