Skip to content

Commit f905b76

Browse files
committed
Update test
1 parent 62ae4ea commit f905b76

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

tests/lean/run/lift_match.lean

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def test1 : Nat → Nat
88
-- set_option pp.match false
99

1010
/--
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)
1212
(h_2 : (n : Nat) → (fun x => α) n.succ) :
1313
f
1414
(match x✝ with
@@ -19,15 +19,15 @@ info: test1.match_1.float.{u, v} {α : Sort u} {β : Sort v} (f : α → β) (x
1919
| n.succ => f (h_2 n)
2020
-/
2121
#guard_msgs in
22-
#check test1.match_1.float
22+
#check test1.match_1.lifter
2323

2424
def test2 (α β) : α ∨ β → γ → (β ∨ α) ∧ γ
2525
| .inl x, y => ⟨.inr x, y⟩
2626
| .inr x, y => ⟨.inl x, y⟩
2727

2828
set_option pp.proofs true in
2929
/--
30-
info: test2.match_1.float {α β : Prop} (f : α → β) {γ : Prop} (α✝ β✝ : Prop) (x✝ : α✝ ∨ β✝) (x✝¹ : γ)
30+
info: test2.match_1.lifter {α β : Prop} (f : α → β) {γ : Prop} (α✝ β✝ : Prop) (x✝ : α✝ ∨ β✝) (x✝¹ : γ)
3131
(h_1 : ∀ (x : α✝) (y : γ), (fun x x => α) (Or.inl x) y) (h_2 : ∀ (x : β✝) (y : γ), (fun x x => α) (Or.inr x) y) :
3232
f
3333
(match x✝, x✝¹ with
@@ -38,28 +38,28 @@ info: test2.match_1.float {α β : Prop} (f : α → β) {γ : Prop} (α✝ β
3838
| Or.inr x, y => f (h_2 x y)
3939
-/
4040
#guard_msgs in
41-
#check test2.match_1.float
41+
#check test2.match_1.lifter
4242

4343
-- This fails if there is no splitter theorem for a match
4444

4545
/--
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:
4848
Could not construct splitter for Nat.lt_or_gt_of_ne.match_1
4949
---
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:
5252
Could not construct splitter for Nat.lt_or_gt_of_ne.match_1
5353
---
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'
5555
-/
5656
#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
5858

5959
-- A typical example
6060

6161
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]
6363

6464
-- Using the lift_match conv tactic
6565

@@ -93,7 +93,7 @@ theorem List.filter_map''' (f : β → α) (l : List β) : filter p (map f l) =
9393
example (o : Option Bool) :
9494
(match o with | some b => b | none => false)
9595
= !(match o with | some b => !b | none => true) := by
96-
simp [lift_match]
96+
simp [liftMatch]
9797

9898
-- Can float out of ite-condition
9999
/--
@@ -108,13 +108,13 @@ P : Nat → Prop
108108
#guard_msgs in
109109
example (o : Option Bool) (P : Nat → Prop):
110110
P (if (match o with | some b => b | none => true) then 1 else 2) := by
111-
simp only [lift_match]
111+
simp only [liftMatch]
112112
fail
113113

114-
-- Cannot float out of ite-branch
114+
-- Cannot lift out of ite-branch
115115
example (b : Bool) (o : Option Bool) (P : Bool → Prop) (abort : ∀ b, P b):
116116
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]
118118
apply abort
119119

120120
-- Can float out of a match target (aka case-of-case)
@@ -133,43 +133,43 @@ P : Nat → Prop
133133
#guard_msgs in
134134
example (o : Option Bool) (P : Nat → Prop):
135135
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]
137137
fail
138138

139139
-- Dependent motive; must not rewrite
140140

141141
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 -/
143143
#guard_msgs in
144144
example (o : Option Bool) (motive : Bool → Type) (P : {b : Bool} → motive b → Prop)
145145
(f : (x : Bool) → motive x) (g : {x : Bool} → motive x → motive x)
146146
(abort : ∀ b (x : motive b), P x) :
147147
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]
149149
apply abort
150150

151151
-- Dependent context; must not rewrite
152152

153153
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 -/
155155
#guard_msgs in
156156
example (o : Option Bool) (motive : Bool → Type) (P : {b : Bool} → motive b → Prop)
157157
(f : (x : Bool) → motive x)
158158
(abort : ∀ b (x : motive b), P x) :
159159
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]
161161
apply abort
162162

163163
-- Context depends on the concrete value of the match, must not rewrite
164164

165165
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 -/
167167
#guard_msgs in
168168
example (o : Option Bool)
169169
(f : (x : Bool) → (h : x = (match o with | some b => b | none => false)) → Bool)
170170
(abort : ∀ (P : Prop), P) :
171171
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]
173173
apply abort
174174

175175
-- Can float out of a let (Only relevant with zeta := false)
@@ -190,7 +190,7 @@ P : Bool → Prop
190190
#guard_msgs in
191191
example (o : Option Bool) (P : Bool → Prop):
192192
P (let b := match o with | some b => b | none => true; !b) := by
193-
simp -zeta only [lift_match]
193+
simp -zeta only [liftMatch]
194194
fail
195195

196196
/-
@@ -234,21 +234,21 @@ b : Bool
234234
#guard_msgs in
235235
example (P : Nat → Prop) (f : Nat → Nat) (b : Bool) :
236236
P (f (if b then 1 else 2)) := by
237-
simp only [lift_match]
237+
simp only [liftMatch]
238238
fail
239239

240240
-- Dependent f
241241

242242
/--
243243
error: simp made no progress
244244
---
245-
info: [lift_match] Cannot float match: f is dependent
245+
info: [lift_match] Cannot lift match: f is dependent
246246
-/
247247
#guard_msgs in
248248
set_option trace.lift_match true in
249249
example (P : {n : Nat} → Fin n → Prop) (f : (n : Nat) → Fin n) (b : Bool) :
250250
P (f (if b then 1 else 2)) := by
251-
simp only [lift_match]
251+
simp only [liftMatch]
252252
fail
253253

254254
-- Somewhat dependent f, but abstracting still succeeds
@@ -263,7 +263,7 @@ b : Bool
263263
#guard_msgs in
264264
example (P : Nat → Prop) (f : (n : Nat) → DecidableEq (Fin n) → Nat) (b : Bool) :
265265
P (f (if b then 1 else 2) inferInstance) := by
266-
simp only [lift_match]
266+
simp only [liftMatch]
267267
fail
268268

269269
-- Testing dependent if-then-else
@@ -278,21 +278,21 @@ b : Bool
278278
#guard_msgs in
279279
example (P : Nat → Prop) (f : Nat → Nat) (b : Bool) :
280280
P (f (if h : b then 1 else 2)) := by
281-
simp only [lift_match]
281+
simp only [liftMatch]
282282
fail
283283

284284
-- Dependent f
285285

286286
/--
287287
error: simp made no progress
288288
---
289-
info: [lift_match] Cannot float match: f is dependent
289+
info: [lift_match] Cannot lift match: f is dependent
290290
-/
291291
#guard_msgs in
292292
set_option trace.lift_match true in
293293
example (P : {n : Nat} → Fin n → Prop) (f : (n : Nat) → Fin n) (b : Bool) :
294294
P (f (if h : b then 1 else 2)) := by
295-
simp only [lift_match]
295+
simp only [liftMatch]
296296
fail
297297

298298
-- Somewhat dependent f, but abstracting still succeeds
@@ -307,5 +307,5 @@ b : Bool
307307
#guard_msgs in
308308
example (P : Nat → Prop) (f : (n : Nat) → DecidableEq (Fin n) → Nat) (b : Bool) :
309309
P (f (if h : b then 1 else 2) inferInstance) := by
310-
simp only [lift_match]
310+
simp only [liftMatch]
311311
fail

0 commit comments

Comments
 (0)