-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathSubst.lean
83 lines (67 loc) · 2.62 KB
/
Subst.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/-
Copyright (c) 2022 Jannis Limperg. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jannis Limperg
-/
import Aesop
set_option aesop.check.all true
set_option aesop.smallErrorMessages true
-- These test cases test the builtin subst tactic.
/--
error: tactic 'aesop' failed, failed to prove the goal after exhaustive search.
-/
#guard_msgs in
example (h₁ : x = 5) (h₂ : y = 5) : x = y := by
aesop (erase Aesop.BuiltinRules.subst)
(config := { useSimpAll := false, terminal := true })
example (h₁ : x = 5) (h₂ : y = 5) : x = y := by
aesop (config := { useSimpAll := false })
variable {α : Type}
/--
error: tactic 'aesop' failed, failed to prove the goal after exhaustive search.
-/
#guard_msgs in
example {x y z : α} (h₁ : x = y) (h₂ : y = z) : x = z := by
aesop (erase Aesop.BuiltinRules.subst)
(config := { useSimpAll := false, terminal := true })
example {x y z : α} (h₁ : x = y) (h₂ : y = z) : x = z := by
aesop (config := { useSimpAll := false })
/--
error: tactic 'aesop' failed, failed to prove the goal after exhaustive search.
-/
#guard_msgs in
example {x y : α }(P : ∀ x y, x = y → Prop) (h₁ : x = y) (h₂ : P x y h₁) :
x = y := by
aesop
(erase Aesop.BuiltinRules.subst, Aesop.BuiltinRules.assumption,
Aesop.BuiltinRules.applyHyps)
(config := { useSimpAll := false, terminal := true })
example {x y : α }(P : ∀ x y, x = y → Prop) (h₁ : x = y) (h₂ : P x y h₁) :
x = y := by
aesop
(erase Aesop.BuiltinRules.assumption,
Aesop.BuiltinRules.applyHyps)
(config := { useSimpAll := false })
-- Subst also works for bi-implications.
/--
error: tactic 'aesop' failed, failed to prove the goal after exhaustive search.
-/
#guard_msgs in
example (h₁ : P ↔ Q) (h₂ : Q ↔ R) (h₃ : P) : R := by
aesop (erase Aesop.BuiltinRules.subst)
(config := { useSimpAll := false, terminal := true })
example (h₁ : P ↔ Q) (h₂ : Q ↔ R) (h₃ : P) : R := by
aesop (config := { useSimpAll := false })
-- Subst also works for morally-homogeneous heterogeneous equalities (using a
-- builtin simp rule which turns these into actual homogeneous equalities).
/--
error: tactic 'aesop' failed, failed to prove the goal after exhaustive search.
-/
#guard_msgs in
example {P : α → Prop} {x y z : α} (h₁ : HEq x y) (h₂ : HEq y z) (h₃ : P x) :
P z := by
aesop (erase Aesop.BuiltinRules.subst)
(config := { useSimpAll := false, terminal := true })
example {P : α → Prop} {x y z : α} (h₁ : HEq x y) (h₂ : HEq y z) (h₃ : P x) :
P z := by
aesop (config := { useSimpAll := false })