-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy path18.lean
32 lines (29 loc) · 956 Bytes
/
18.lean
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/-
Copyright (c) 2022 Asta H. From. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Asta H. From, Jannis Limperg
-/
import Aesop
set_option aesop.check.all true
set_option aesop.smallErrorMessages true
attribute [aesop safe cases (cases_patterns := [List.Mem _ []])] List.Mem
attribute [aesop unsafe 50% cases (cases_patterns := [List.Mem _ (_ :: _)])] List.Mem
/--
error: tactic 'aesop' failed, failed to prove the goal after exhaustive search.
-/
#guard_msgs in
theorem Mem.split [DecidableEq α] (xs : List α) (v : α) (h : v ∈ xs)
: ∃ l r, xs = l ++ v :: r := by
induction xs
case nil =>
aesop
case cons x xs ih =>
have dec : Decidable (x = v) := inferInstance
cases dec
case isFalse no =>
aesop (config := { terminal := true }) (erase Aesop.BuiltinRules.ext)
case isTrue yes =>
apply Exists.intro []
apply Exists.intro xs
rw [yes]
rfl