@@ -550,7 +550,7 @@ assume n, if_neg n
550
550
theorem index_of_eq_length {a : α} {l : list α} : index_of a l = length l ↔ a ∉ l :=
551
551
begin
552
552
induction l with b l ih; simp [-add_comm],
553
- by_cases a = b with h ; simp [h, -add_comm],
553
+ by_cases h : a = b; simp [h, -add_comm],
554
554
{ intro, contradiction },
555
555
{ rw ← ih, exact ⟨succ_inj, congr_arg _⟩ }
556
556
end
@@ -561,7 +561,7 @@ index_of_eq_length.2
561
561
theorem index_of_le_length {a : α} {l : list α} : index_of a l ≤ length l :=
562
562
begin
563
563
induction l with b l ih; simp [-add_comm, index_of_cons],
564
- by_cases a = b with h ; simp [h, -add_comm, zero_le],
564
+ by_cases h : a = b; simp [h, -add_comm, zero_le],
565
565
exact succ_le_succ ih
566
566
end
567
567
@@ -622,7 +622,7 @@ ext $ λn, if h₁ : n < length l₁
622
622
else let h₁ := le_of_not_gt h₁ in by rw [nth_ge_len h₁, nth_ge_len (by rwa [← hl])]
623
623
624
624
@[simp] theorem index_of_nth_le [decidable_eq α] {a : α} : ∀ {l : list α} h, nth_le l (index_of a l) h = a
625
- | (b::l) h := by by_cases a = b with h' ; simp *
625
+ | (b::l) h := by by_cases h' : a = b; simp *
626
626
627
627
@[simp] theorem index_of_nth [decidable_eq α] {a : α} {l : list α} (h : a ∈ l) : nth l (index_of a l) = some a :=
628
628
by rw [nth_le_nth, index_of_nth_le (index_of_lt_length.2 h)]
@@ -1129,7 +1129,7 @@ theorem filter_map_eq_filter (p : α → Prop) [decidable_pred p] :
1129
1129
begin
1130
1130
funext l,
1131
1131
induction l with a l IH, {simp},
1132
- by_cases p a with pa ; simp [filter_map, option.guard, pa, IH]
1132
+ by_cases pa : p a ; simp [filter_map, option.guard, pa, IH]
1133
1133
end
1134
1134
1135
1135
theorem filter_map_filter_map (f : α → option β) (g : β → option γ) (l : list α) :
@@ -1253,11 +1253,11 @@ by rw ← filter_map_eq_filter; exact filter_map_sublist_filter_map _ s
1253
1253
1254
1254
@[simp] theorem span_eq_take_drop (p : α → Prop ) [decidable_pred p] : ∀ (l : list α), span p l = (take_while p l, drop_while p l)
1255
1255
| [] := rfl
1256
- | (a::l) := by by_cases p a with pa ; simp [span, take_while, drop_while, pa, span_eq_take_drop l]
1256
+ | (a::l) := by by_cases pa : p a ; simp [span, take_while, drop_while, pa, span_eq_take_drop l]
1257
1257
1258
1258
@[simp] theorem take_while_append_drop (p : α → Prop ) [decidable_pred p] : ∀ (l : list α), take_while p l ++ drop_while p l = l
1259
1259
| [] := rfl
1260
- | (a::l) := by by_cases p a with pa ; simp [take_while, drop_while, pa, take_while_append_drop l]
1260
+ | (a::l) := by by_cases pa : p a ; simp [take_while, drop_while, pa, take_while_append_drop l]
1261
1261
1262
1262
def countp (p : α → Prop ) [decidable_pred p] : list α → nat
1263
1263
| [] := 0
@@ -1621,7 +1621,7 @@ by simp [insert.def, h]
1621
1621
1622
1622
@[simp] theorem mem_insert_iff {a b : α} {l : list α} : a ∈ insert b l ↔ a = b ∨ a ∈ l :=
1623
1623
begin
1624
- by_cases b ∈ l with h' ; simp [h'],
1624
+ by_cases h' : b ∈ l; simp [h'],
1625
1625
apply (or_iff_right_of_imp _).symm,
1626
1626
exact λ e, e.symm ▸ h'
1627
1627
end
@@ -1670,7 +1670,7 @@ theorem exists_erase_eq {a : α} {l : list α} (h : a ∈ l) :
1670
1670
∃ l₁ l₂, a ∉ l₁ ∧ l = l₁ ++ a :: l₂ ∧ l.erase a = l₁ ++ l₂ :=
1671
1671
by induction l with b l ih; [cases h, {
1672
1672
simp at h,
1673
- by_cases b = a with e ,
1673
+ by_cases e : b = a,
1674
1674
{ subst b, exact ⟨[], l, not_mem_nil _, rfl, by simp⟩ },
1675
1675
{ exact let ⟨l₁, l₂, h₁, h₂, h₃⟩ := ih (h.resolve_left (ne.symm e)) in
1676
1676
⟨b::l₁, l₂, not_mem_cons_of_ne_of_not_mem (ne.symm e) h₁,
@@ -1684,7 +1684,7 @@ end
1684
1684
1685
1685
theorem erase_append_left {a : α} : ∀ {l₁ : list α} (l₂), a ∈ l₁ → (l₁++l₂).erase a = l₁.erase a ++ l₂
1686
1686
| (x::xs) l₂ h := begin
1687
- by_cases x = a with h' ; simp [h'],
1687
+ by_cases h' : x = a; simp [h'],
1688
1688
rw erase_append_left l₂ (mem_of_ne_of_mem (ne.symm h') h)
1689
1689
end
1690
1690
@@ -1939,7 +1939,7 @@ mem_union.2 (or.inr h)
1939
1939
theorem sublist_suffix_of_union : ∀ l₁ l₂ : list α, ∃ t, t <+ l₁ ∧ t ++ l₂ = l₁ ∪ l₂
1940
1940
| [] l₂ := ⟨[], by refl, rfl⟩
1941
1941
| (a::l₁) l₂ := let ⟨t, s, e⟩ := sublist_suffix_of_union l₁ l₂ in
1942
- by simp [e.symm]; by_cases a ∈ t ++ l₂ with h ;
1942
+ by simp [e.symm]; by_cases h : a ∈ t ++ l₂;
1943
1943
[existsi t, existsi a::t]; simp [h];
1944
1944
[apply sublist_cons_of_sublist _ s, apply cons_sublist_cons _ s]
1945
1945
@@ -2036,7 +2036,7 @@ theorem mem_bag_inter {a : α} : ∀ {l₁ l₂ : list α}, a ∈ l₁.bag_inter
2036
2036
| [] l₂ := by simp
2037
2037
| (b::l₁) l₂ := by
2038
2038
by_cases b ∈ l₂; simp [*, and_or_distrib_left];
2039
- by_cases a = b with ba ; simp *
2039
+ by_cases ba : a = b; simp *
2040
2040
2041
2041
theorem bag_inter_sublist_left : ∀ l₁ l₂ : list α, l₁.bag_inter l₂ <+ l₁
2042
2042
| [] l₂ := by simp [nil_sublist]
@@ -2523,7 +2523,7 @@ theorem nodup_concat {a : α} {l : list α} (h : a ∉ l) (h' : nodup l) : nodup
2523
2523
by simp; exact nodup_append_of_nodup h' (nodup_singleton _) (disjoint_singleton.2 h)
2524
2524
2525
2525
theorem nodup_insert [decidable_eq α] {a : α} {l : list α} (h : nodup l) : nodup (insert a l) :=
2526
- by by_cases a ∈ l with h' ; simp [h', h]; apply nodup_cons h' h
2526
+ by by_cases h' : a ∈ l; simp [h', h]; apply nodup_cons h' h
2527
2527
2528
2528
theorem nodup_union [decidable_eq α] (l₁ : list α) {l₂ : list α} (h : nodup l₂) :
2529
2529
nodup (l₁ ∪ l₂) :=
0 commit comments