Theorem: AIG.RefStream.zip.denote_go (LeanSAT/AIG/RefStreamOperator.lean)

State before:
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
⊢ ∀ (idx : Nat) (hidx1 : idx < len),
    curr ≤ idx →
      ⟦{ aig := (go aig curr s hcurr lhs rhs f).aig, ref := (go aig curr s hcurr lhs rhs f).stream.getRef idx hidx1 },
          assign⟧ =
        ⟦f aig { lhs := lhs.getRef idx hidx1, rhs := rhs.getRef idx hidx1 }, assign⟧
Tactic:
intro idx hidx1 hidx2
State after:
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
⊢ ⟦{ aig := (go aig curr s hcurr lhs rhs f).aig, ref := (go aig curr s hcurr lhs rhs f).stream.getRef idx hidx1 },
      assign⟧ =
    ⟦f aig { lhs := lhs.getRef idx hidx1, rhs := rhs.getRef idx hidx1 }, assign⟧

State before:
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
⊢ ⟦{ aig := (go aig curr s hcurr lhs rhs f).aig, ref := (go aig curr s hcurr lhs rhs f).stream.getRef idx hidx1 },
      assign⟧ =
    ⟦f aig { lhs := lhs.getRef idx hidx1, rhs := rhs.getRef idx hidx1 }, assign⟧
Tactic:
generalize hgo : go aig curr s hcurr lhs rhs f = res
State after:
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
hgo : go aig curr s hcurr lhs rhs f = res
⊢ ⟦{ aig := res.aig, ref := res.stream.getRef idx hidx1 }, assign⟧ =
    ⟦f aig { lhs := lhs.getRef idx hidx1, rhs := rhs.getRef idx hidx1 }, assign⟧

State before:
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
hgo : go aig curr s hcurr lhs rhs f = res
⊢ ⟦{ aig := res.aig, ref := res.stream.getRef idx hidx1 }, assign⟧ =
    ⟦f aig { lhs := lhs.getRef idx hidx1, rhs := rhs.getRef idx hidx1 }, assign⟧
Tactic:
unfold go at hgo
State after:
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
hgo :
  (if hidx : curr < len then
      let res := f aig { lhs := lhs.getRef curr hidx, rhs := rhs.getRef curr hidx };
      let aig_1 := res.aig;
      let newRef := res.ref;
      let_fun this := ⋯;
      let s := s.cast this;
      let s := s.pushRef newRef;
      go aig_1 (curr + 1) s ⋯ (lhs.cast this) (rhs.cast this) f
    else
      let_fun this := ⋯;
      { aig := aig, stream := this ▸ s }) =
    res
⊢ ⟦{ aig := res.aig, ref := res.stream.getRef idx hidx1 }, assign⟧ =
    ⟦f aig { lhs := lhs.getRef idx hidx1, rhs := rhs.getRef idx hidx1 }, assign⟧

State before:
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
hgo :
  (if hidx : curr < len then
      let res := f aig { lhs := lhs.getRef curr hidx, rhs := rhs.getRef curr hidx };
      let aig_1 := res.aig;
      let newRef := res.ref;
      let_fun this := ⋯;
      let s := s.cast this;
      let s := s.pushRef newRef;
      go aig_1 (curr + 1) s ⋯ (lhs.cast this) (rhs.cast this) f
    else
      let_fun this := ⋯;
      { aig := aig, stream := this ▸ s }) =
    res
⊢ ⟦{ aig := res.aig, ref := res.stream.getRef idx hidx1 }, assign⟧ =
    ⟦f aig { lhs := lhs.getRef idx hidx1, rhs := rhs.getRef idx hidx1 }, assign⟧
Tactic:
split at hgo
State after:
case isTrue
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  (let res := f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ };
    let aig_1 := res.aig;
    let newRef := res.ref;
    let_fun this := ⋯;
    let s := s.cast this;
    let s := s.pushRef newRef;
    go aig_1 (curr + 1) s ⋯ (lhs.cast this) (rhs.cast this) f) =
    res
⊢ ⟦{ aig := res.aig, ref := res.stream.getRef idx hidx1 }, assign⟧ =
    ⟦f aig { lhs := lhs.getRef idx hidx1, rhs := rhs.getRef idx hidx1 }, assign⟧

case isFalse
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : ¬curr < len
hgo :
  (let_fun this := ⋯;
    { aig := aig, stream := this ▸ s }) =
    res
⊢ ⟦{ aig := res.aig, ref := res.stream.getRef idx hidx1 }, assign⟧ =
    ⟦f aig { lhs := lhs.getRef idx hidx1, rhs := rhs.getRef idx hidx1 }, assign⟧

State before:
case isTrue
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  (let res := f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ };
    let aig_1 := res.aig;
    let newRef := res.ref;
    let_fun this := ⋯;
    let s := s.cast this;
    let s := s.pushRef newRef;
    go aig_1 (curr + 1) s ⋯ (lhs.cast this) (rhs.cast this) f) =
    res
⊢ ⟦{ aig := res.aig, ref := res.stream.getRef idx hidx1 }, assign⟧ =
    ⟦f aig { lhs := lhs.getRef idx hidx1, rhs := rhs.getRef idx hidx1 }, assign⟧

case isFalse
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : ¬curr < len
hgo :
  (let_fun this := ⋯;
    { aig := aig, stream := this ▸ s }) =
    res
⊢ ⟦{ aig := res.aig, ref := res.stream.getRef idx hidx1 }, assign⟧ =
    ⟦f aig { lhs := lhs.getRef idx hidx1, rhs := rhs.getRef idx hidx1 }, assign⟧
Tactic:
. dsimp at hgo
  cases Nat.eq_or_lt_of_le hidx2 with
  | inl heq =>
    rw [← hgo]
    rw [go_getRef]
    rw [AIG.RefStream.getRef_push_ref_eq']
    . simp only [← heq]
      rw [go_denote_mem_prefix]
      . simp
      . simp [Ref.hgate]
    . rw [heq]
  | inr hlt =>
    rw [← hgo]
    rw [denote_go]
    . simp [-Ref_cast']
    . omega
State after:
case isFalse
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : ¬curr < len
hgo :
  (let_fun this := ⋯;
    { aig := aig, stream := this ▸ s }) =
    res
⊢ ⟦{ aig := res.aig, ref := res.stream.getRef idx hidx1 }, assign⟧ =
    ⟦f aig { lhs := lhs.getRef idx hidx1, rhs := rhs.getRef idx hidx1 }, assign⟧

State before:
case isFalse
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : ¬curr < len
hgo :
  (let_fun this := ⋯;
    { aig := aig, stream := this ▸ s }) =
    res
⊢ ⟦{ aig := res.aig, ref := res.stream.getRef idx hidx1 }, assign⟧ =
    ⟦f aig { lhs := lhs.getRef idx hidx1, rhs := rhs.getRef idx hidx1 }, assign⟧
Tactic:
. omega
State after:
no goals

State before:
case isTrue
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  (let res := f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ };
    let aig_1 := res.aig;
    let newRef := res.ref;
    let_fun this := ⋯;
    let s := s.cast this;
    let s := s.pushRef newRef;
    go aig_1 (curr + 1) s ⋯ (lhs.cast this) (rhs.cast this) f) =
    res
⊢ ⟦{ aig := res.aig, ref := res.stream.getRef idx hidx1 }, assign⟧ =
    ⟦f aig { lhs := lhs.getRef idx hidx1, rhs := rhs.getRef idx hidx1 }, assign⟧
Tactic:
dsimp at hgo
State after:
case isTrue
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
⊢ ⟦{ aig := res.aig, ref := res.stream.getRef idx hidx1 }, assign⟧ =
    ⟦f aig { lhs := lhs.getRef idx hidx1, rhs := rhs.getRef idx hidx1 }, assign⟧

State before:
case isTrue
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
⊢ ⟦{ aig := res.aig, ref := res.stream.getRef idx hidx1 }, assign⟧ =
    ⟦f aig { lhs := lhs.getRef idx hidx1, rhs := rhs.getRef idx hidx1 }, assign⟧
Tactic:
cases Nat.eq_or_lt_of_le hidx2 with
| inl heq =>
  rw [← hgo]
  rw [go_getRef]
  rw [AIG.RefStream.getRef_push_ref_eq']
  . simp only [← heq]
    rw [go_denote_mem_prefix]
    . simp
    . simp [Ref.hgate]
  . rw [heq]
| inr hlt =>
  rw [← hgo]
  rw [denote_go]
  . simp [-Ref_cast']
  . omega
State after:
no goals

State before:
case isTrue.inl
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
heq : curr = idx
⊢ ⟦{ aig := res.aig, ref := res.stream.getRef idx hidx1 }, assign⟧ =
    ⟦f aig { lhs := lhs.getRef idx hidx1, rhs := rhs.getRef idx hidx1 }, assign⟧
Tactic:
rw [← hgo]
State after:
case isTrue.inl
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
heq : curr = idx
⊢ ⟦{
        aig :=
          (go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
              ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
              (rhs.cast ⋯) f).aig,
        ref :=
          (go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
                  ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯
                  (lhs.cast ⋯) (rhs.cast ⋯) f).stream.getRef
            idx hidx1 },
      assign⟧ =
    ⟦f aig { lhs := lhs.getRef idx hidx1, rhs := rhs.getRef idx hidx1 }, assign⟧

State before:
case isTrue.inl
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
heq : curr = idx
⊢ ⟦{
        aig :=
          (go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
              ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
              (rhs.cast ⋯) f).aig,
        ref :=
          (go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
                  ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯
                  (lhs.cast ⋯) (rhs.cast ⋯) f).stream.getRef
            idx hidx1 },
      assign⟧ =
    ⟦f aig { lhs := lhs.getRef idx hidx1, rhs := rhs.getRef idx hidx1 }, assign⟧
Tactic:
rw [go_getRef]
State after:
case isTrue.inl
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
heq : curr = idx
⊢ ⟦{
        aig :=
          (go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
              ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
              (rhs.cast ⋯) f).aig,
        ref :=
          (((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref).getRef idx
                ?isTrue.inl.hidx).cast
            ⋯ },
      assign⟧ =
    ⟦f aig { lhs := lhs.getRef idx hidx1, rhs := rhs.getRef idx hidx1 }, assign⟧

case isTrue.inl.hidx
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
heq : curr = idx
⊢ idx < curr + 1

State before:
case isTrue.inl
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
heq : curr = idx
⊢ ⟦{
        aig :=
          (go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
              ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
              (rhs.cast ⋯) f).aig,
        ref :=
          (((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref).getRef idx
                ?isTrue.inl.hidx).cast
            ⋯ },
      assign⟧ =
    ⟦f aig { lhs := lhs.getRef idx hidx1, rhs := rhs.getRef idx hidx1 }, assign⟧

case isTrue.inl.hidx
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
heq : curr = idx
⊢ idx < curr + 1
Tactic:
rw [AIG.RefStream.getRef_push_ref_eq']
State after:
case isTrue.inl
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
heq : curr = idx
⊢ ⟦{
        aig :=
          (go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
              ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
              (rhs.cast ⋯) f).aig,
        ref := (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref.cast ⋯ },
      assign⟧ =
    ⟦f aig { lhs := lhs.getRef idx hidx1, rhs := rhs.getRef idx hidx1 }, assign⟧

case isTrue.inl.hidx
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
heq : curr = idx
⊢ idx = curr

State before:
case isTrue.inl
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
heq : curr = idx
⊢ ⟦{
        aig :=
          (go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
              ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
              (rhs.cast ⋯) f).aig,
        ref := (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref.cast ⋯ },
      assign⟧ =
    ⟦f aig { lhs := lhs.getRef idx hidx1, rhs := rhs.getRef idx hidx1 }, assign⟧

case isTrue.inl.hidx
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
heq : curr = idx
⊢ idx = curr
Tactic:
. simp only [← heq]
  rw [go_denote_mem_prefix]
  . simp
  . simp [Ref.hgate]
State after:
case isTrue.inl.hidx
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
heq : curr = idx
⊢ idx = curr

State before:
case isTrue.inl.hidx
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
heq : curr = idx
⊢ idx = curr
Tactic:
. rw [heq]
State after:
no goals

State before:
case isTrue.inl
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
heq : curr = idx
⊢ ⟦{
        aig :=
          (go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
              ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
              (rhs.cast ⋯) f).aig,
        ref := (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref.cast ⋯ },
      assign⟧ =
    ⟦f aig { lhs := lhs.getRef idx hidx1, rhs := rhs.getRef idx hidx1 }, assign⟧
Tactic:
simp only [← heq]
State after:
case isTrue.inl
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
heq : curr = idx
⊢ ⟦{
        aig :=
          (go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
              ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
              (rhs.cast ⋯) f).aig,
        ref := (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref.cast ⋯ },
      assign⟧ =
    ⟦f aig { lhs := lhs.getRef curr ⋯, rhs := rhs.getRef curr ⋯ }, assign⟧

State before:
case isTrue.inl
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
heq : curr = idx
⊢ ⟦{
        aig :=
          (go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
              ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
              (rhs.cast ⋯) f).aig,
        ref := (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref.cast ⋯ },
      assign⟧ =
    ⟦f aig { lhs := lhs.getRef curr ⋯, rhs := rhs.getRef curr ⋯ }, assign⟧
Tactic:
rw [go_denote_mem_prefix]
State after:
case isTrue.inl
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
heq : curr = idx
⊢ ⟦{ aig := (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig,
        ref :=
          { gate := ((f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref.cast ⋯).gate,
            hgate := ?isTrue.inl.hstart } },
      assign⟧ =
    ⟦f aig { lhs := lhs.getRef curr ⋯, rhs := rhs.getRef curr ⋯ }, assign⟧

case isTrue.inl.hstart
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
heq : curr = idx
⊢ ((f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref.cast ⋯).gate <
    (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig.decls.size

State before:
case isTrue.inl
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
heq : curr = idx
⊢ ⟦{ aig := (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig,
        ref :=
          { gate := ((f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref.cast ⋯).gate,
            hgate := ?isTrue.inl.hstart } },
      assign⟧ =
    ⟦f aig { lhs := lhs.getRef curr ⋯, rhs := rhs.getRef curr ⋯ }, assign⟧

case isTrue.inl.hstart
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
heq : curr = idx
⊢ ((f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref.cast ⋯).gate <
    (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig.decls.size
Tactic:
. simp
State after:
case isTrue.inl.hstart
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
heq : curr = idx
⊢ ((f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref.cast ⋯).gate <
    (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig.decls.size

State before:
case isTrue.inl.hstart
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
heq : curr = idx
⊢ ((f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref.cast ⋯).gate <
    (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig.decls.size
Tactic:
. simp [Ref.hgate]
State after:
no goals

State before:
case isTrue.inl
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
heq : curr = idx
⊢ ⟦{ aig := (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig,
        ref :=
          { gate := ((f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref.cast ⋯).gate,
            hgate := ?isTrue.inl.hstart } },
      assign⟧ =
    ⟦f aig { lhs := lhs.getRef curr ⋯, rhs := rhs.getRef curr ⋯ }, assign⟧
Tactic:
simp
State after:
no goals

State before:
case isTrue.inl.hstart
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
heq : curr = idx
⊢ ((f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref.cast ⋯).gate <
    (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig.decls.size
Tactic:
simp [Ref.hgate]
State after:
no goals

State before:
case isTrue.inl.hidx
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
heq : curr = idx
⊢ idx = curr
Tactic:
rw [heq]
State after:
no goals

State before:
case isTrue.inr
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
hlt : curr < idx
⊢ ⟦{ aig := res.aig, ref := res.stream.getRef idx hidx1 }, assign⟧ =
    ⟦f aig { lhs := lhs.getRef idx hidx1, rhs := rhs.getRef idx hidx1 }, assign⟧
Tactic:
rw [← hgo]
State after:
case isTrue.inr
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
hlt : curr < idx
⊢ ⟦{
        aig :=
          (go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
              ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
              (rhs.cast ⋯) f).aig,
        ref :=
          (go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
                  ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯
                  (lhs.cast ⋯) (rhs.cast ⋯) f).stream.getRef
            idx hidx1 },
      assign⟧ =
    ⟦f aig { lhs := lhs.getRef idx hidx1, rhs := rhs.getRef idx hidx1 }, assign⟧

State before:
case isTrue.inr
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
hlt : curr < idx
⊢ ⟦{
        aig :=
          (go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
              ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
              (rhs.cast ⋯) f).aig,
        ref :=
          (go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
                  ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯
                  (lhs.cast ⋯) (rhs.cast ⋯) f).stream.getRef
            idx hidx1 },
      assign⟧ =
    ⟦f aig { lhs := lhs.getRef idx hidx1, rhs := rhs.getRef idx hidx1 }, assign⟧
Tactic:
rw [denote_go]
State after:
case isTrue.inr
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
hlt : curr < idx
⊢ ⟦f (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig
        { lhs := (lhs.cast ⋯).getRef idx hidx1, rhs := (rhs.cast ⋯).getRef idx hidx1 },
      assign⟧ =
    ⟦f aig { lhs := lhs.getRef idx hidx1, rhs := rhs.getRef idx hidx1 }, assign⟧

case isTrue.inr.a
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
hlt : curr < idx
⊢ curr + 1 ≤ idx

State before:
case isTrue.inr
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
hlt : curr < idx
⊢ ⟦f (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig
        { lhs := (lhs.cast ⋯).getRef idx hidx1, rhs := (rhs.cast ⋯).getRef idx hidx1 },
      assign⟧ =
    ⟦f aig { lhs := lhs.getRef idx hidx1, rhs := rhs.getRef idx hidx1 }, assign⟧

case isTrue.inr.a
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
hlt : curr < idx
⊢ curr + 1 ≤ idx
Tactic:
. simp [-Ref_cast']
State after:
case isTrue.inr.a
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
hlt : curr < idx
⊢ curr + 1 ≤ idx

State before:
case isTrue.inr.a
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
hlt : curr < idx
⊢ curr + 1 ≤ idx
Tactic:
. omega
State after:
no goals

State before:
case isTrue.inr
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
hlt : curr < idx
⊢ ⟦f (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig
        { lhs := (lhs.cast ⋯).getRef idx hidx1, rhs := (rhs.cast ⋯).getRef idx hidx1 },
      assign⟧ =
    ⟦f aig { lhs := lhs.getRef idx hidx1, rhs := rhs.getRef idx hidx1 }, assign⟧
Tactic:
simp [-Ref_cast']
State after:
no goals

State before:
case isTrue.inr.a
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : curr < len
hgo :
  go (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).aig (curr + 1)
      ((s.cast ⋯).pushRef (f aig { lhs := lhs.getRef curr h✝, rhs := rhs.getRef curr h✝ }).ref) ⋯ (lhs.cast ⋯)
      (rhs.cast ⋯) f =
    res
hlt : curr < idx
⊢ curr + 1 ≤ idx
Tactic:
omega
State after:
no goals

State before:
case isFalse
α : Type
inst✝³ : BEq α
inst✝² : Hashable α
inst✝¹ : DecidableEq α
aig✝ : AIG α
len : Nat
assign : α → Bool
aig : AIG α
curr : Nat
hcurr : curr ≤ len
s : aig.RefStream curr
lhs rhs : aig.RefStream len
f : (aig : AIG α) → aig.BinaryInput → Entrypoint α
inst✝ : LawfulOperator α BinaryInput f
chainable : LawfulZipOperator α f
idx : Nat
hidx1 : idx < len
hidx2 : curr ≤ idx
res : RefStreamEntry α len
h✝ : ¬curr < len
hgo :
  (let_fun this := ⋯;
    { aig := aig, stream := this ▸ s }) =
    res
⊢ ⟦{ aig := res.aig, ref := res.stream.getRef idx hidx1 }, assign⟧ =
    ⟦f aig { lhs := lhs.getRef idx hidx1, rhs := rhs.getRef idx hidx1 }, assign⟧
Tactic:
omega
State after:
no goals