sorry
case h
n : ℕ
r : Region scf
⊢ (match
      run (TopM.scoped (denoteRegion scf r [{ fst := MLIRType.index, snd := 0 }]))
        (SSAEnv.set (SSAVal.SSAVal "cn") MLIRType.index (↑n)
          (SSAEnv.set (SSAVal.SSAVal "cn_plus_1") MLIRType.index (↑n + 1)
            (SSAEnv.set (SSAVal.SSAVal "c0") MLIRType.index 0
              (SSAEnv.set (SSAVal.SSAVal "c1") MLIRType.index 1 SSAEnv.empty)))) with
    | Except.ok (a, env') =>
      match
        match run (TopM.get MLIRType.index (SSAVal.SSAVal "c1")) env' with
        | Except.ok (a, env') =>
          match run (denoteOpArgs scf [(SSAVal.SSAVal "cn_plus_1", MLIRType.index)]) env' with
          | Except.ok (a_1, env') => Except.ok ({ fst := MLIRType.index, snd := a } :: a_1, env')
          | Except.error e => Except.error e
        | Except.error e => Except.error e with
      | Except.ok (a, env') =>
        run
          (OpM.toTopM [TopM.scoped ∘ denoteRegion scf r]
            (match IOp.mk "scf.for'" [] a [OpM.denoteRegion r 0] (AttrDict.mk []) with
            | IOp.mk "scf.if" resTy [{ fst := MLIRType.int Signedness.Signless 1, snd := b }] [rthen, relse] attrs =>
              ite (b = 1) rthen relse []
            |
            IOp.mk "scf.for" resTy
                [{ fst := MLIRType.index, snd := lo }, { fst := MLIRType.index, snd := hi },
                  { fst := MLIRType.index, snd := step }]
                [body] attrs =>
              do
              let _ ←
                run_loop_bounded_stepped (Int.toNat ((hi - lo) / step)) lo step default fun i x =>
                    body [{ fst := MLIRType.index, snd := i }]
              pure []
            |
            IOp.mk "scf.for'" resTy [{ fst := MLIRType.index, snd := lo }, { fst := MLIRType.index, snd := hi }] [body]
                attrs =>
              run_loop_bounded (Int.toNat (hi - lo)) lo [] body
            | IOp.mk "scf.yield" resTy vs [] attrs => pure vs
            | IOp.mk "scf.assert" resTy [{ fst := MLIRType.int Signedness.Signless 1, snd := arg }] [] attrs =>
              if arg = 0 then
                OpM.Error
                  (toString "" ++
                          toString
                            (match AttrDict.find attrs "msg" with
                            | some (AttrValue.str str) => str
                            | x => "") ++
                        toString ": " ++
                      toString arg ++
                    toString " <assert failed>")
              else pure []
            | IOp.mk "scf.execute_region" resTy args [rgn] attrs => rgn args
            | IOp.mk name resTy args regions attrs => OpM.Unhandled ("scf unhandled: " ++ name)))
          env'
      | Except.error e => Except.error e
    | Except.error e => Except.error e) =
    run
      (OpM.toTopM [TopM.scoped ∘ denoteRegion scf r]
        (run_loop_bounded (Int.toNat (↑n + 1)) 0 [] (OpM.denoteRegion r 0)))
      (SSAEnv.set (SSAVal.SSAVal "cn") MLIRType.index (↑n)
        (SSAEnv.set (SSAVal.SSAVal "cn_plus_1") MLIRType.index (↑n + 1)
          (SSAEnv.set (SSAVal.SSAVal "c0") MLIRType.index 0
            (SSAEnv.set (SSAVal.SSAVal "c1") MLIRType.index 1 SSAEnv.empty))))

case h.a
n : ℕ
r : Region scf
⊢ SSAVal.SSAVal "cn_plus_1" ≠ SSAVal.SSAVal "c0"

case h.a
n : ℕ
r : Region scf
⊢ SSAVal.SSAVal "cn" ≠ SSAVal.SSAVal "c0"

case a
n : ℕ
r : Region scf
⊢ SSAVal.SSAVal "cn" ≠ SSAVal.SSAVal "cn_plus_1"

case a
n : ℕ
r : Region scf
⊢ SSAVal.SSAVal "cn_plus_1" ≠ SSAVal.SSAVal "c0"

case a
n : ℕ
r : Region scf
⊢ SSAVal.SSAVal "cn" ≠ SSAVal.SSAVal "c0"
case h.a
n : ℕ
r : Region scf
⊢ SSAVal.SSAVal "cn_plus_1" ≠ SSAVal.SSAVal "c0"

case h.a
n : ℕ
r : Region scf
⊢ SSAVal.SSAVal "cn" ≠ SSAVal.SSAVal "c0"

case a
n : ℕ
r : Region scf
⊢ SSAVal.SSAVal "cn" ≠ SSAVal.SSAVal "cn_plus_1"

case a
n : ℕ
r : Region scf
⊢ SSAVal.SSAVal "cn_plus_1" ≠ SSAVal.SSAVal "c0"

case a
n : ℕ
r : Region scf
⊢ SSAVal.SSAVal "cn" ≠ SSAVal.SSAVal "c0"