Skip to content

Commit

Permalink
feat(data/list/chain): Simp lemma for chain r a (l ++ b :: c :: m) (#…
Browse files Browse the repository at this point in the history
…12969)




Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
  • Loading branch information
vihdzp and eric-wieser committed Mar 29, 2022
1 parent 1cdbc35 commit 0f92307
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/data/list/chain.lean
Expand Up @@ -64,6 +64,10 @@ theorem chain_split {a b : α} {l₁ l₂ : list α} : chain R a (l₁ ++ b :: l
by induction l₁ with x l₁ IH generalizing a;
simp only [*, nil_append, cons_append, chain.nil, chain_cons, and_true, and_assoc]

@[simp] theorem chain_append_cons_cons {a b c : α} {l₁ l₂ : list α} :
chain R a (l₁ ++ b :: c :: l₂) ↔ chain R a (l₁ ++ [b]) ∧ R b c ∧ chain R c l₂ :=
by rw [chain_split, chain_cons]

theorem chain_map (f : β → α) {b : β} {l : list β} :
chain R (f b) (map f l) ↔ chain (λ a b : β, R (f a) (f b)) b l :=
by induction l generalizing b; simp only [map, chain.nil, chain_cons, *]
Expand Down

0 comments on commit 0f92307

Please sign in to comment.