Theorem: SSAScope.get_some_getT (MLIR/Semantics/SSAEnv.lean)

State before:
α σ : Type
ε : σ → Type
δ : Dialect α σ ε
name : SSAVal
scope : SSAScope δ
τ : MLIRType δ
v : MLIRType.eval τ
⊢ get name scope τ = some v → getT name scope = some { fst := τ, snd := v }
Tactic:
rw [get_to_getT]
State after:
α σ : Type
ε : σ → Type
δ : Dialect α σ ε
name : SSAVal
scope : SSAScope δ
τ : MLIRType δ
v : MLIRType.eval τ
⊢ (match getT name scope with
      | none => none
      | some { fst := τ', snd := v' } =>
        if H : τ' = τ then
          some
            (cast
              (_ :
                (match τ' 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 σ => ε σ
                  | MLIRType.erased => Unit) =
                  match τ 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 σ => ε σ
                  | MLIRType.erased => Unit)
              v')
        else none) =
      some v →
    getT name scope = some { fst := τ, snd := v }

State before:
α σ : Type
ε : σ → Type
δ : Dialect α σ ε
name : SSAVal
scope : SSAScope δ
τ : MLIRType δ
v : MLIRType.eval τ
⊢ (match getT name scope with
      | none => none
      | some { fst := τ', snd := v' } =>
        if H : τ' = τ then
          some
            (cast
              (_ :
                (match τ' 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 σ => ε σ
                  | MLIRType.erased => Unit) =
                  match τ 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 σ => ε σ
                  | MLIRType.erased => Unit)
              v')
        else none) =
      some v →
    getT name scope = some { fst := τ, snd := v }
Tactic:
split <;> simp at * <;> try contradiction
State after:
case h_2
α σ : Type
ε : σ → Type
δ : Dialect α σ ε
name : SSAVal
scope : SSAScope δ
τ : MLIRType δ
v : MLIRType.eval τ
x✝ : Option ((τ : MLIRType δ) × MLIRType.eval τ)
τ'✝ : MLIRType δ
v'✝ : MLIRType.eval τ'✝
heq✝ : getT name scope = some { fst := τ'✝, snd := v'✝ }
⊢ (if h : τ'✝ = τ then
        some
          (cast
            (_ :
              (match τ'✝ 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 σ => ε σ
                | MLIRType.erased => Unit) =
                match τ 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 σ => ε σ
                | MLIRType.erased => Unit)
            v'✝)
      else none) =
      some v →
    getT name scope = some { fst := τ, snd := v }

State before:
α σ : Type
ε : σ → Type
δ : Dialect α σ ε
name : SSAVal
scope : SSAScope δ
τ : MLIRType δ
v : MLIRType.eval τ
x✝ : Option ((τ : MLIRType δ) × MLIRType.eval τ)
τ' : MLIRType δ
v'✝ : MLIRType.eval τ'
Hget : getT name scope = some { fst := τ', snd := v'✝ }
⊢ (if h : τ' = τ then
        some
          (cast
            (_ :
              (match τ' 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 σ => ε σ
                | MLIRType.erased => Unit) =
                match τ 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 σ => ε σ
                | MLIRType.erased => Unit)
            v'✝)
      else none) =
      some v →
    getT name scope = some { fst := τ, snd := v }
Tactic:
case h_2 _ τ' _ Hget =>
byCases Hτ: τ' = τ
intros H
rw [←H, Hget]
rfl
State after:
no goals

State before:
α σ : Type
ε : σ → Type
δ : Dialect α σ ε
name : SSAVal
scope : SSAScope δ
τ : MLIRType δ
v : MLIRType.eval τ
x✝ : Option ((τ : MLIRType δ) × MLIRType.eval τ)
τ' : MLIRType δ
v'✝ : MLIRType.eval τ'
Hget : getT name scope = some { fst := τ', snd := v'✝ }
⊢ (if h : τ' = τ then
        some
          (cast
            (_ :
              (match τ' 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 σ => ε σ
                | MLIRType.erased => Unit) =
                match τ 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 σ => ε σ
                | MLIRType.erased => Unit)
            v'✝)
      else none) =
      some v →
    getT name scope = some { fst := τ, snd := v }
Tactic:
byCases Hτ: τ' = τ
State after:
case h1
α σ : Type
ε : σ → Type
δ : Dialect α σ ε
name : SSAVal
scope : SSAScope δ
τ : MLIRType δ
v : MLIRType.eval τ
x✝ : Option ((τ : MLIRType δ) × MLIRType.eval τ)
v'✝ : MLIRType.eval τ
Hget : getT name scope = some { fst := τ, snd := v'✝ }
⊢ cast
        (_ :
          (match τ 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 σ => ε σ
            | MLIRType.erased => Unit) =
            match τ 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 σ => ε σ
            | MLIRType.erased => Unit)
        v'✝ =
      v →
    getT name scope = some { fst := τ, snd := v }

State before:
case h1
α σ : Type
ε : σ → Type
δ : Dialect α σ ε
name : SSAVal
scope : SSAScope δ
τ : MLIRType δ
v : MLIRType.eval τ
x✝ : Option ((τ : MLIRType δ) × MLIRType.eval τ)
v'✝ : MLIRType.eval τ
Hget : getT name scope = some { fst := τ, snd := v'✝ }
⊢ cast
        (_ :
          (match τ 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 σ => ε σ
            | MLIRType.erased => Unit) =
            match τ 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 σ => ε σ
            | MLIRType.erased => Unit)
        v'✝ =
      v →
    getT name scope = some { fst := τ, snd := v }
Tactic:
intros H
State after:
case h1
α σ : Type
ε : σ → Type
δ : Dialect α σ ε
name : SSAVal
scope : SSAScope δ
τ : MLIRType δ
v : MLIRType.eval τ
x✝ : Option ((τ : MLIRType δ) × MLIRType.eval τ)
v'✝ : MLIRType.eval τ
Hget : getT name scope = some { fst := τ, snd := v'✝ }
H :
  cast
      (_ :
        (match τ 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 σ => ε σ
          | MLIRType.erased => Unit) =
          match τ 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 σ => ε σ
          | MLIRType.erased => Unit)
      v'✝ =
    v
⊢ getT name scope = some { fst := τ, snd := v }

State before:
case h1
α σ : Type
ε : σ → Type
δ : Dialect α σ ε
name : SSAVal
scope : SSAScope δ
τ : MLIRType δ
v : MLIRType.eval τ
x✝ : Option ((τ : MLIRType δ) × MLIRType.eval τ)
v'✝ : MLIRType.eval τ
Hget : getT name scope = some { fst := τ, snd := v'✝ }
H :
  cast
      (_ :
        (match τ 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 σ => ε σ
          | MLIRType.erased => Unit) =
          match τ 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 σ => ε σ
          | MLIRType.erased => Unit)
      v'✝ =
    v
⊢ getT name scope = some { fst := τ, snd := v }
Tactic:
rw [←H, Hget]
State after:
case h1
α σ : Type
ε : σ → Type
δ : Dialect α σ ε
name : SSAVal
scope : SSAScope δ
τ : MLIRType δ
v : MLIRType.eval τ
x✝ : Option ((τ : MLIRType δ) × MLIRType.eval τ)
v'✝ : MLIRType.eval τ
Hget : getT name scope = some { fst := τ, snd := v'✝ }
H :
  cast
      (_ :
        (match τ 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 σ => ε σ
          | MLIRType.erased => Unit) =
          match τ 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 σ => ε σ
          | MLIRType.erased => Unit)
      v'✝ =
    v
⊢ some { fst := τ, snd := v'✝ } =
    some
      { fst := τ,
        snd :=
          cast
            (_ :
              (match τ 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 σ => ε σ
                | MLIRType.erased => Unit) =
                match τ 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 σ => ε σ
                | MLIRType.erased => Unit)
            v'✝ }

State before:
case h1
α σ : Type
ε : σ → Type
δ : Dialect α σ ε
name : SSAVal
scope : SSAScope δ
τ : MLIRType δ
v : MLIRType.eval τ
x✝ : Option ((τ : MLIRType δ) × MLIRType.eval τ)
v'✝ : MLIRType.eval τ
Hget : getT name scope = some { fst := τ, snd := v'✝ }
H :
  cast
      (_ :
        (match τ 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 σ => ε σ
          | MLIRType.erased => Unit) =
          match τ 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 σ => ε σ
          | MLIRType.erased => Unit)
      v'✝ =
    v
⊢ some { fst := τ, snd := v'✝ } =
    some
      { fst := τ,
        snd :=
          cast
            (_ :
              (match τ 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 σ => ε σ
                | MLIRType.erased => Unit) =
                match τ 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 σ => ε σ
                | MLIRType.erased => Unit)
            v'✝ }
Tactic:
rfl
State after:
no goals