Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 6a6beaa

Browse files
urkudmergify[bot]
andauthored
chore(data/list/basic): drop append_foldl and append_foldr, add map_nil and prod_singleton (#2057)
`append_foldl` and `append_foldr` were unused duplicates of `foldl_append` and `foldr_append` Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent 7be3e93 commit 6a6beaa

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/data/list/basic.lean

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@
22
Copyright (c) 2014 Parikshit Khanna. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Parikshit Khanna, Jeremy Avigad, Leonardo de Moura, Floris van Doorn, Mario Carneiro
5-
6-
Basic properties of lists.
75
-/
86
import
97
tactic.interactive tactic.mk_iff_of_inductive_prop
108
logic.basic logic.function logic.relator
119
algebra.group order.basic
1210
data.list.defs data.nat.basic data.option.basic
1311
data.bool data.prod data.fin
12+
13+
/-!
14+
# Basic properties of lists
15+
-/
16+
1417
open function nat
1518

1619
namespace list
@@ -306,12 +309,6 @@ by induction s; intros; contradiction
306309
theorem append_ne_nil_of_ne_nil_right (s t : list α) : t ≠ [] → s ++ t ≠ [] :=
307310
by induction s; intros; contradiction
308311

309-
theorem append_foldl (f : α → β → α) (a : α) (s t : list β) : foldl f a (s ++ t) = foldl f (foldl f a s) t :=
310-
by {induction s with b s H generalizing a, refl, simp only [foldl, cons_append], rw H _}
311-
312-
theorem append_foldr (f : α → β → β) (a : β) (s t : list α) : foldr f a (s ++ t) = foldr f (foldr f a t) s :=
313-
by {induction s with b s H generalizing a, refl, simp only [foldr, cons_append], rw H _}
314-
315312
@[simp] lemma append_eq_nil {p q : list α} : (p ++ q) = [] ↔ p = [] ∧ q = [] :=
316313
by cases p; simp only [nil_append, cons_append, eq_self_iff_true, true_and, false_and]
317314

@@ -1086,6 +1083,8 @@ end insert_nth
10861083

10871084
/- map -/
10881085

1086+
@[simp] lemma map_nil (f : α → β) : map f [] = [] := rfl
1087+
10891088
lemma map_congr {f g : α → β} : ∀ {l : list α}, (∀ x ∈ l, f x = g x) → map f l = map g l
10901089
| [] _ := rfl
10911090
| (a::l) h := let ⟨h₁, h₂⟩ := forall_mem_cons.1 h in
@@ -1495,6 +1494,9 @@ variables [monoid α] {l l₁ l₂ : list α} {a : α}
14951494
@[simp, to_additive]
14961495
theorem prod_nil : ([] : list α).prod = 1 := rfl
14971496

1497+
@[to_additive]
1498+
theorem prod_singleton : [a].prod = a := one_mul a
1499+
14981500
@[simp, to_additive]
14991501
theorem prod_cons : (a::l).prod = a * l.prod :=
15001502
calc (a::l).prod = foldl (*) (a * 1) l : by simp only [list.prod, foldl_cons, one_mul, mul_one]

0 commit comments

Comments
 (0)