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

Commit 0818bb2

Browse files
ChrisHughes24mergify[bot]
authored andcommitted
feat(data/fin): mem_find_of_unique (#1181)
1 parent 32ce121 commit 0818bb2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/data/fin.lean

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,15 @@ begin
300300
exact fin.eta _ _⟩ } }
301301
end
302302

303+
lemma mem_find_of_unique {p : fin n → Prop} [decidable_pred p]
304+
(h : ∀ i j, p i → p j → i = j) {i : fin n} (hi : p i) : i ∈ fin.find p :=
305+
begin
306+
cases hfp : fin.find p,
307+
{ rw [find_eq_none_iff] at hfp,
308+
exact (hfp _ hi).elim },
309+
{ exact option.some_inj.2 (h _ _ (find_spec _ hfp) hi) }
310+
end
311+
303312
end find
304313

305314
end fin

0 commit comments

Comments
 (0)