@@ -8,7 +8,7 @@ def test1 : Nat → Nat
8
8
-- set_option pp.match false
9
9
10
10
/--
11
- info: test1.match_1.float .{u, v} {α : Sort u} {β : Sort v} (f : α → β) (x✝ : Nat) (h_1 : Unit → (fun x => α) 0)
11
+ info: test1.match_1.lifter .{u, v} {α : Sort u} {β : Sort v} (f : α → β) (x✝ : Nat) (h_1 : Unit → (fun x => α) 0)
12
12
(h_2 : (n : Nat) → (fun x => α) n.succ) :
13
13
f
14
14
(match x✝ with
@@ -19,15 +19,15 @@ info: test1.match_1.float.{u, v} {α : Sort u} {β : Sort v} (f : α → β) (x
19
19
| n.succ => f (h_2 n)
20
20
-/
21
21
#guard_msgs in
22
- #check test1.match_1.float
22
+ #check test1.match_1.lifter
23
23
24
24
def test2 (α β) : α ∨ β → γ → (β ∨ α) ∧ γ
25
25
| .inl x, y => ⟨.inr x, y⟩
26
26
| .inr x, y => ⟨.inl x, y⟩
27
27
28
28
set_option pp.proofs true in
29
29
/--
30
- info: test2.match_1.float {α β : Prop} (f : α → β) {γ : Prop} (α✝ β✝ : Prop) (x✝ : α✝ ∨ β✝) (x✝¹ : γ)
30
+ info: test2.match_1.lifter {α β : Prop} (f : α → β) {γ : Prop} (α✝ β✝ : Prop) (x✝ : α✝ ∨ β✝) (x✝¹ : γ)
31
31
(h_1 : ∀ (x : α✝) (y : γ), (fun x x => α) (Or.inl x) y) (h_2 : ∀ (x : β✝) (y : γ), (fun x x => α) (Or.inr x) y) :
32
32
f
33
33
(match x✝, x✝¹ with
@@ -38,28 +38,28 @@ info: test2.match_1.float {α β : Prop} (f : α → β) {γ : Prop} (α✝ β
38
38
| Or.inr x, y => f (h_2 x y)
39
39
-/
40
40
#guard_msgs in
41
- #check test2.match_1.float
41
+ #check test2.match_1.lifter
42
42
43
43
-- This fails if there is no splitter theorem for a match
44
44
45
45
/--
46
- error: Failed to realize constant Nat.lt_or_gt_of_ne.match_1.float :
47
- Cannot construct match floating theorem :
46
+ error: Failed to realize constant Nat.lt_or_gt_of_ne.match_1.lifter :
47
+ Cannot construct match lifter :
48
48
Could not construct splitter for Nat.lt_or_gt_of_ne.match_1
49
49
---
50
- error: Failed to realize constant Nat.lt_or_gt_of_ne.match_1.float :
51
- Cannot construct match floating theorem :
50
+ error: Failed to realize constant Nat.lt_or_gt_of_ne.match_1.lifter :
51
+ Cannot construct match lifter :
52
52
Could not construct splitter for Nat.lt_or_gt_of_ne.match_1
53
53
---
54
- error: unknown identifier 'Nat.lt_or_gt_of_ne.match_1.float '
54
+ error: unknown identifier 'Nat.lt_or_gt_of_ne.match_1.lifter '
55
55
-/
56
56
#guard_msgs in
57
- #check Nat.lt_or_gt_of_ne.match_1.float
57
+ #check Nat.lt_or_gt_of_ne.match_1.lifter
58
58
59
59
-- A typical example
60
60
61
61
theorem List.filter_map' (f : β → α) (l : List β) : filter p (map f l) = map f (filter (p ∘ f) l) := by
62
- induction l <;> simp [filter, *, lift_match ]
62
+ induction l <;> simp [filter, *, liftMatch ]
63
63
64
64
-- Using the lift_match conv tactic
65
65
@@ -93,7 +93,7 @@ theorem List.filter_map''' (f : β → α) (l : List β) : filter p (map f l) =
93
93
example (o : Option Bool) :
94
94
(match o with | some b => b | none => false )
95
95
= !(match o with | some b => !b | none => true ) := by
96
- simp [lift_match ]
96
+ simp [liftMatch ]
97
97
98
98
-- Can float out of ite-condition
99
99
/--
@@ -108,13 +108,13 @@ P : Nat → Prop
108
108
#guard_msgs in
109
109
example (o : Option Bool) (P : Nat → Prop ):
110
110
P (if (match o with | some b => b | none => true ) then 1 else 2 ) := by
111
- simp only [lift_match ]
111
+ simp only [liftMatch ]
112
112
fail
113
113
114
- -- Cannot float out of ite-branch
114
+ -- Cannot lift out of ite-branch
115
115
example (b : Bool) (o : Option Bool) (P : Bool → Prop ) (abort : ∀ b, P b):
116
116
P (if b then (match o with | some b => b | none => true ) else b) := by
117
- fail_if_success simp only [lift_match ]
117
+ fail_if_success simp only [liftMatch ]
118
118
apply abort
119
119
120
120
-- Can float out of a match target (aka case-of-case)
@@ -133,43 +133,43 @@ P : Nat → Prop
133
133
#guard_msgs in
134
134
example (o : Option Bool) (P : Nat → Prop ):
135
135
P (match (match o with | some b => b | none => true ) with | true => 1 | false => 2 ) := by
136
- simp only [lift_match ]
136
+ simp only [liftMatch ]
137
137
fail
138
138
139
139
-- Dependent motive; must not rewrite
140
140
141
141
set_option trace.lift_match true in
142
- /-- info: [ lift_match ] Cannot float match: motive depends on targets -/
142
+ /-- info: [ lift_match ] Cannot lift match: motive depends on targets -/
143
143
#guard_msgs in
144
144
example (o : Option Bool) (motive : Bool → Type ) (P : {b : Bool} → motive b → Prop )
145
145
(f : (x : Bool) → motive x) (g : {x : Bool} → motive x → motive x)
146
146
(abort : ∀ b (x : motive b), P x) :
147
147
P (g (match (motive := ∀ b, motive b.isSome) o with | some _ => f true | none => f false )) := by
148
- fail_if_success simp [lift_match ]
148
+ fail_if_success simp [liftMatch ]
149
149
apply abort
150
150
151
151
-- Dependent context; must not rewrite
152
152
153
153
set_option trace.lift_match true in
154
- /-- info: [ lift_match ] Cannot float match: f is dependent -/
154
+ /-- info: [ lift_match ] Cannot lift match: f is dependent -/
155
155
#guard_msgs in
156
156
example (o : Option Bool) (motive : Bool → Type ) (P : {b : Bool} → motive b → Prop )
157
157
(f : (x : Bool) → motive x)
158
158
(abort : ∀ b (x : motive b), P x) :
159
159
P (f (match (motive := ∀ _, Bool) o with | some b => b | none => false )) := by
160
- fail_if_success simp [lift_match ]
160
+ fail_if_success simp [liftMatch ]
161
161
apply abort
162
162
163
163
-- Context depends on the concrete value of the match, must not rewrite
164
164
165
165
set_option trace.lift_match true in
166
- /-- info: [ lift_match ] Cannot float match: context is not type correct -/
166
+ /-- info: [ lift_match ] Cannot lift match: context is not type correct -/
167
167
#guard_msgs in
168
168
example (o : Option Bool)
169
169
(f : (x : Bool) → (h : x = (match o with | some b => b | none => false )) → Bool)
170
170
(abort : ∀ (P : Prop ), P) :
171
171
f (match (motive := ∀ _, Bool) o with | some b => b | none => false ) rfl = true := by
172
- fail_if_success simp [lift_match ]
172
+ fail_if_success simp [liftMatch ]
173
173
apply abort
174
174
175
175
-- Can float out of a let (Only relevant with zeta := false)
@@ -190,7 +190,7 @@ P : Bool → Prop
190
190
#guard_msgs in
191
191
example (o : Option Bool) (P : Bool → Prop ):
192
192
P (let b := match o with | some b => b | none => true ; !b) := by
193
- simp -zeta only [lift_match ]
193
+ simp -zeta only [liftMatch ]
194
194
fail
195
195
196
196
/-
@@ -234,21 +234,21 @@ b : Bool
234
234
#guard_msgs in
235
235
example (P : Nat → Prop ) (f : Nat → Nat) (b : Bool) :
236
236
P (f (if b then 1 else 2 )) := by
237
- simp only [lift_match ]
237
+ simp only [liftMatch ]
238
238
fail
239
239
240
240
-- Dependent f
241
241
242
242
/--
243
243
error: simp made no progress
244
244
---
245
- info: [ lift_match ] Cannot float match: f is dependent
245
+ info: [ lift_match ] Cannot lift match: f is dependent
246
246
-/
247
247
#guard_msgs in
248
248
set_option trace.lift_match true in
249
249
example (P : {n : Nat} → Fin n → Prop ) (f : (n : Nat) → Fin n) (b : Bool) :
250
250
P (f (if b then 1 else 2 )) := by
251
- simp only [lift_match ]
251
+ simp only [liftMatch ]
252
252
fail
253
253
254
254
-- Somewhat dependent f, but abstracting still succeeds
@@ -263,7 +263,7 @@ b : Bool
263
263
#guard_msgs in
264
264
example (P : Nat → Prop ) (f : (n : Nat) → DecidableEq (Fin n) → Nat) (b : Bool) :
265
265
P (f (if b then 1 else 2 ) inferInstance) := by
266
- simp only [lift_match ]
266
+ simp only [liftMatch ]
267
267
fail
268
268
269
269
-- Testing dependent if-then-else
@@ -278,21 +278,21 @@ b : Bool
278
278
#guard_msgs in
279
279
example (P : Nat → Prop ) (f : Nat → Nat) (b : Bool) :
280
280
P (f (if h : b then 1 else 2 )) := by
281
- simp only [lift_match ]
281
+ simp only [liftMatch ]
282
282
fail
283
283
284
284
-- Dependent f
285
285
286
286
/--
287
287
error: simp made no progress
288
288
---
289
- info: [ lift_match ] Cannot float match: f is dependent
289
+ info: [ lift_match ] Cannot lift match: f is dependent
290
290
-/
291
291
#guard_msgs in
292
292
set_option trace.lift_match true in
293
293
example (P : {n : Nat} → Fin n → Prop ) (f : (n : Nat) → Fin n) (b : Bool) :
294
294
P (f (if h : b then 1 else 2 )) := by
295
- simp only [lift_match ]
295
+ simp only [liftMatch ]
296
296
fail
297
297
298
298
-- Somewhat dependent f, but abstracting still succeeds
@@ -307,5 +307,5 @@ b : Bool
307
307
#guard_msgs in
308
308
example (P : Nat → Prop ) (f : (n : Nat) → DecidableEq (Fin n) → Nat) (b : Bool) :
309
309
P (f (if h : b then 1 else 2 ) inferInstance) := by
310
- simp only [lift_match ]
310
+ simp only [liftMatch ]
311
311
fail
0 commit comments