Theorem: SCF.FOR_PEELING.equivalent
Proof state before:
case h
n : ℕ
r : Region scf
⊢ (match
      match
        match
          Except.ok
            (match
                if H' : MLIRType.index = MLIRType.index then
                  some
                    (cast
                      (_ :
                        (match MLIRType.index with
                          | MLIRType.float a => Float
                          | MLIRType.int signedness sz => FinInt sz
                          | MLIRType.tensor1d => Tensor1D
                          | MLIRType.tensor2d => Tensor2D
                          | MLIRType.tensor4d => Tensor4D
                          | MLIRType.index => ℤ
                          | MLIRType.undefined a => Unit
                          | MLIRType.extended σ => Unit
                          | MLIRType.erased => Unit) =
                          match MLIRType.index with
                          | MLIRType.float a => Float
                          | MLIRType.int signedness sz => FinInt sz
                          | MLIRType.tensor1d => Tensor1D
                          | MLIRType.tensor2d => Tensor2D
                          | MLIRType.tensor4d => Tensor4D
                          | MLIRType.index => ℤ
                          | MLIRType.undefined a => Unit
                          | MLIRType.extended σ => Unit
                          | MLIRType.erased => Unit)
                      0)
                else none with
              | some v => v
              | none => default,
              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 run (denoteOpArgs scf []) env' with
          | Except.ok (a_1, env') => run (pure ({ 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.mapDenoteRegion scf [r])
            (Semantics.semantics_op (IOp.mk "scf.execute_region" [] a (OpM.denoteRegions [r] 0) (AttrDict.mk []))))
          env'
      | Except.error e => Except.error e 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') => run (pure ({ 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.mapDenoteRegion scf [r])
            (Semantics.semantics_op (IOp.mk "scf.for'" [] a (OpM.denoteRegions [r] 0) (AttrDict.mk []))))
          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"
Tactic:
simp
Proof state after:
case h
n : ℕ
r : Region scf
⊢ (match
      match
        match
          run (denoteOpArgs scf [])
            (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') => run (pure ({ fst := MLIRType.index, snd := 0 } :: a)) env'
        | Except.error e => Except.error e with
      | Except.ok (a, env') =>
        run
          (OpM.toTopM (TopM.mapDenoteRegion scf [r])
            (Semantics.semantics_op (IOp.mk "scf.execute_region" [] a (OpM.denoteRegions [r] 0) (AttrDict.mk []))))
          env'
      | Except.error e => Except.error e 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') => run (pure ({ 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.mapDenoteRegion scf [r])
            (Semantics.semantics_op (IOp.mk "scf.for'" [] a (OpM.denoteRegions [r] 0) (AttrDict.mk []))))
          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"