-- Mathlib/.lake/packages/lean4/src/lean/Std/Tactic/BVDecide/LRAT/Internal/Convert.lean
theorem CNF.Clause.mem_lrat_of_mem (clause : CNF.Clause (PosFin n)) (h1 : l ∈ clause)
    (h2 : DefaultClause.ofArray clause.toArray = some lratClause) : l ∈ lratClause.clause

Proof state:
case cons.h_2.isFalse.isFalse.tail.a.h2
n : Nat
l hd : Literal (PosFin n)
tl : List (Literal (PosFin n))
ih :
  ∀ {lratClause : DefaultClause n}, l ∈ tl → DefaultClause.ofArray tl.toArray = some lratClause → l ∈ lratClause.clause
lratClause : DefaultClause n
acc✝¹ : Option (DefaultClause n)
acc✝ : DefaultClause n
heq :
  List.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some DefaultClause.empty) tl =
    some acc✝
h✝¹ : ¬List.contains acc✝.clause (hd.fst, !hd.snd) = true
h✝ : ¬List.contains acc✝.clause hd = true
h2 : some { clause := hd :: acc✝.clause, nodupkey := ⋯, nodup := ⋯ } = some lratClause
a✝ : List.Mem l tl
⊢ (let fold_fn := fun l acc =>
      match acc with
      | none => none
      | some acc => acc.insert l;
    Array.foldr fold_fn (some DefaultClause.empty) tl.toArray) =
    some acc✝

Tactic:
rw [← Array.foldr_toList, List.toArray_toList]

Result:
case cons.h_2.isFalse.isFalse.tail.a.h2
n : Nat
l hd : Literal (PosFin n)
tl : List (Literal (PosFin n))
ih :
  ∀ {lratClause : DefaultClause n}, l ∈ tl → DefaultClause.ofArray tl.toArray = some lratClause → l ∈ lratClause.clause
lratClause : DefaultClause n
acc✝¹ : Option (DefaultClause n)
acc✝ : DefaultClause n
heq :
  List.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some DefaultClause.empty) tl =
    some acc✝
h✝¹ : ¬List.contains acc✝.clause (hd.fst, !hd.snd) = true
h✝ : ¬List.contains acc✝.clause hd = true
h2 : some { clause := hd :: acc✝.clause, nodupkey := ⋯, nodup := ⋯ } = some lratClause
a✝ : List.Mem l tl
⊢ List.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some DefaultClause.empty) { toList := tl }.toList =
    some acc✝

Proof state:
n : Nat
l hd : Literal (PosFin n)
tl : List (Literal (PosFin n))
ih :
  ∀ {lratClause : DefaultClause n}, l ∈ tl → DefaultClause.ofArray tl.toArray = some lratClause → l ∈ lratClause.clause
lratClause : DefaultClause n
acc✝¹ : Option (DefaultClause n)
acc✝ : DefaultClause n
heq :
  List.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some DefaultClause.empty) tl =
    some acc✝
h✝ : ¬List.contains acc✝.clause (hd.fst, !hd.snd) = true
h : List.contains acc✝.clause hd = true
h2 : some acc✝ = some acc✝
a✝ : List.Mem l tl
⊢ (let fold_fn := fun l acc =>
      match acc with
      | none => none
      | some acc => acc.insert l;
    Array.foldr fold_fn (some DefaultClause.empty) tl.toArray) =
    some acc✝

Tactic:
rw [← Array.foldr_toList, List.toArray_toList]

Result:
n : Nat
l hd : Literal (PosFin n)
tl : List (Literal (PosFin n))
ih :
  ∀ {lratClause : DefaultClause n}, l ∈ tl → DefaultClause.ofArray tl.toArray = some lratClause → l ∈ lratClause.clause
lratClause : DefaultClause n
acc✝¹ : Option (DefaultClause n)
acc✝ : DefaultClause n
heq :
  List.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some DefaultClause.empty) tl =
    some acc✝
h✝ : ¬List.contains acc✝.clause (hd.fst, !hd.snd) = true
h : List.contains acc✝.clause hd = true
h2 : some acc✝ = some acc✝
a✝ : List.Mem l tl
⊢ List.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some DefaultClause.empty) { toList := tl }.toList =
    some acc✝

Proof state:
case cons.h_2.isFalse.isTrue
n : Nat
l hd : Literal (PosFin n)
tl : List (Literal (PosFin n))
ih :
  ∀ {lratClause : DefaultClause n}, l ∈ tl → DefaultClause.ofArray tl.toArray = some lratClause → l ∈ lratClause.clause
lratClause : DefaultClause n
h1 : l ∈ hd :: tl
acc✝¹ : Option (DefaultClause n)
acc✝ : DefaultClause n
heq✝ :
  List.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some DefaultClause.empty) tl =
    some acc✝
h✝ : ¬List.contains acc✝.clause (hd.fst, !hd.snd) = true
h : List.contains acc✝.clause hd = true
h2 : some acc✝ = some acc✝
⊢ l ∈ acc✝.clause

Tactic:
cases h1

Result:
case cons.h_2.isFalse.isTrue.head
n : Nat
l : Literal (PosFin n)
tl : List (Literal (PosFin n))
ih :
  ∀ {lratClause : DefaultClause n}, l ∈ tl → DefaultClause.ofArray tl.toArray = some lratClause → l ∈ lratClause.clause
lratClause : DefaultClause n
acc✝¹ : Option (DefaultClause n)
acc✝ : DefaultClause n
heq✝ :
  List.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some DefaultClause.empty) tl =
    some acc✝
h2 : some acc✝ = some acc✝
h✝ : ¬List.contains acc✝.clause (l.fst, !l.snd) = true
h : List.contains acc✝.clause l = true
⊢ l ∈ acc✝.clause

case cons.h_2.isFalse.isTrue.tail
n : Nat
l hd : Literal (PosFin n)
tl : List (Literal (PosFin n))
ih :
  ∀ {lratClause : DefaultClause n}, l ∈ tl → DefaultClause.ofArray tl.toArray = some lratClause → l ∈ lratClause.clause
lratClause : DefaultClause n
acc✝¹ : Option (DefaultClause n)
acc✝ : DefaultClause n
heq✝ :
  List.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some DefaultClause.empty) tl =
    some acc✝
h✝ : ¬List.contains acc✝.clause (hd.fst, !hd.snd) = true
h : List.contains acc✝.clause hd = true
h2 : some acc✝ = some acc✝
a✝ : List.Mem l tl
⊢ l ∈ acc✝.clause

Proof state:
case cons
n : Nat
l hd : Literal (PosFin n)
tl : List (Literal (PosFin n))
ih :
  ∀ {lratClause : DefaultClause n}, l ∈ tl → DefaultClause.ofArray tl.toArray = some lratClause → l ∈ lratClause.clause
lratClause : DefaultClause n
h1 : l ∈ hd :: tl
h2 :
  (match
      List.foldr
        (fun l acc =>
          match acc with
          | none => none
          | some acc => acc.insert l)
        (some DefaultClause.empty) tl with
    | none => none
    | some acc => acc.insert hd) =
    some lratClause
⊢ l ∈ lratClause.clause

Tactic:
split at h2

Result:
case cons.h_1
n : Nat
l hd : Literal (PosFin n)
tl : List (Literal (PosFin n))
ih :
  ∀ {lratClause : DefaultClause n}, l ∈ tl → DefaultClause.ofArray tl.toArray = some lratClause → l ∈ lratClause.clause
lratClause : DefaultClause n
h1 : l ∈ hd :: tl
acc✝ : Option (DefaultClause n)
heq✝ :
  List.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some DefaultClause.empty) tl =
    none
h2 : none = some lratClause
⊢ l ∈ lratClause.clause

case cons.h_2
n : Nat
l hd : Literal (PosFin n)
tl : List (Literal (PosFin n))
ih :
  ∀ {lratClause : DefaultClause n}, l ∈ tl → DefaultClause.ofArray tl.toArray = some lratClause → l ∈ lratClause.clause
lratClause : DefaultClause n
h1 : l ∈ hd :: tl
acc✝¹ : Option (DefaultClause n)
acc✝ : DefaultClause n
heq✝ :
  List.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some DefaultClause.empty) tl =
    some acc✝
h2 : acc✝.insert hd = some lratClause
⊢ l ∈ lratClause.clause