@Vtec234 Added the missing info.
Given
```lean
def f3 (s : Nat × Array (Array Nat)) : Array Nat :=
s.2[1].push s.1
```
We produce the following `InfoTree` for the body (originally at line 30)
```
Array.push (Array.getOp s.snd 1) s.fst : Array Nat @ ⟨30, 2⟩-⟨30, 17⟩
s : Nat × Array (Array Nat) @ ⟨30, 2⟩-⟨30, 3⟩
Prod.snd : {α β : Type} → α × β → β @ ⟨30, 4⟩-⟨30, 5⟩
Array.getOp : {α : Type} → [inst : Inhabited α] → Array α → Nat → α @ ⟨30, 5⟩-⟨30, 6⟩
1 : Nat @ ⟨30, 6⟩-⟨30, 7⟩
Array.push : {α : Type} → Array α → α → Array α @ ⟨30, 9⟩-⟨30, 13⟩
s.fst : Nat @ ⟨30, 14⟩-⟨30, 17⟩
s : Nat × Array (Array Nat) @ ⟨30, 14⟩-⟨30, 15⟩
Prod.fst : {α β : Type} → α × β → α @ ⟨30, 16⟩-⟨30, 17⟩
```
32 lines
594 B
Text
32 lines
594 B
Text
import Lean
|
||
|
||
open Lean.Elab
|
||
|
||
elab "enableInfo!" : command => enableInfoTree
|
||
|
||
elab "showInfoTrees!" : command => do
|
||
let trees ← getInfoTrees
|
||
trees.forM fun tree => do
|
||
IO.println f!"{← tree.format}"
|
||
|
||
enableInfo!
|
||
|
||
def f (x : Nat) : Nat × Nat :=
|
||
let y := ⟨x, x⟩
|
||
id y
|
||
|
||
def h : (x y : Nat) → (b : Bool) → x + 0 = x :=
|
||
fun x y b => by
|
||
simp
|
||
exact rfl
|
||
|
||
def f2 : (x y : Nat) → (b : Bool) → Nat :=
|
||
fun x y b =>
|
||
let (z, w) := (x + y, x - y)
|
||
let z1 := z + w
|
||
z + z1
|
||
|
||
def f3 (s : Nat × Array (Array Nat)) : Array Nat :=
|
||
s.2[1].push s.1
|
||
|
||
showInfoTrees!
|