Skip to content

Commit 651f441

Browse files
committed
test: simplify tests
This is now possible because I unfold the "helper" definitions `all`, `flip`, and `impl`.
1 parent 72bacf5 commit 651f441

File tree

2 files changed

+11
-29
lines changed

2 files changed

+11
-29
lines changed

GrwTest/TestsGrewrite.lean

Lines changed: 11 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,15 @@ section Examples
44

55
set_option trace.Meta.Tactic.grewrite true
66

7-
macro "finish_impl" : tactic =>
8-
`(tactic| simp [impl, imp_self])
9-
107
example : ∀ P Q : Prop , (P ↔ Q) → (Q → P) := by
118
intro P Q h
129
grewrite [h]
13-
finish_impl
10+
simp
1411

1512
example : ∀ P Q : Prop, (P ↔ Q) → (Q → P) ∧ (Q → P) := by
1613
intro P Q h
1714
grewrite [h]
18-
finish_impl
15+
simp
1916

2017
example {r : relation Prop} [hp : Subrel r (flip impl)] : r a b → b → a := by
2118
intro rab hb
@@ -163,7 +160,7 @@ example (h: Rα a a') (finish: Pα a' ∧ Pα a' ∧ Pα a' ∧ Pα a' ∧ Pα a
163160
example : ∀ P Q : Prop, (P ↔ Q) → (Q → P) := by
164161
intros P Q H
165162
grewrite [H]
166-
finish_impl
163+
simp
167164

168165
--Proof: Subrel.subrelation (impl Q) (impl Q) (Subrel.subrelation impl impl Proper.proper Q Q Proper.proper) P Q H
169166

@@ -172,7 +169,6 @@ example : ∀ P Q : Prop, (P ↔ Q) → (Q → P) ∧ (Q → P) := by
172169
intros P Q H
173170
grewrite [H]
174171
simp_all
175-
finish_impl
176172

177173
variable {SET : Type}
178174
variable {eqset : relation SET}
@@ -184,7 +180,7 @@ variable {unionEmpty : ∀ s, eqset (union s empty) s}
184180
variable {unionIdem : ∀ s, eqset (union s s) s}
185181
variable {unionCompat : ∀ s s', eqset s s' → ∀ t t', eqset t t' → eqset (union s t) (union s' t')}
186182

187-
@[grewrite]
183+
@[grw]
188184
instance unionProper : Proper (eqset ⟹ eqset ⟹ eqset) union := ⟨unionCompat⟩
189185

190186
example : ∀ s, eqset (union (union s empty) s) s := by
@@ -272,7 +268,7 @@ Produces:
272268
example : ∀ P Q : Prop, (P ↔ Q) → (Q → P):= by
273269
intros P Q H
274270
grewrite [H]
275-
finish_impl
271+
simp
276272

277273
/- ✓
278274
Produces:
@@ -283,7 +279,7 @@ Produces:
283279
example : ∀ P Q : Prop, (P ↔ Q) → (P → Q) := by
284280
intros P Q H
285281
grewrite [H]
286-
finish_impl
282+
simp
287283

288284
/- ✓
289285
Produces:
@@ -296,7 +292,7 @@ Produces:
296292
example : ∀ P Q : Prop, (P ↔ Q) → (Q → P) → (Q → P) := by
297293
intros P Q H
298294
grewrite [H]
299-
finish_impl
295+
simp
300296

301297
/- ✓
302298
Produces:
@@ -309,7 +305,7 @@ Produces:
309305
example : ∀ P Q : Prop, (P ↔ Q) → (Q → P) ∧ (Q → P) := by
310306
intros P Q H
311307
grewrite [H]
312-
apply And.intro <;> finish_impl
308+
apply And.intro <;> simp
313309

314310
/-
315311
Produces
@@ -322,7 +318,7 @@ Produces
322318
example : ∀ P Q : Prop, (P ↔ Q) → (Q → P) ∧ (Q → Q) := by
323319
intros P Q H
324320
grewrite [H]
325-
apply And.intro <;> finish_impl
321+
apply And.intro <;> simp
326322

327323
/- ✓
328324
Produces
@@ -333,10 +329,10 @@ Produces
333329
example : ∀ P Q : Prop, (P ↔ Q) → (Q → Q) ∧ (Q → P) := by
334330
intros P Q H
335331
grewrite [H]
336-
apply And.intro <;> finish_impl
332+
apply And.intro <;> simp
337333

338334
-- No rewrite possible on first two proofs.
339-
example (r₁ : relation Prop) (r₂ : relation Prop) (s : Subrel r₁ (flip impl)) (h₁ : r₁ P Q) (h₂ : r₂ P Q) (H : Prop) (h₃ : r₁ H P) (finish: P) : H := by
335+
example (r₁ : relation Prop) (r₂ : relation Prop) (s : Subrel r₁ (flip impl)) (h₁ : r₁ P Q) (h₂ : r₂ P Q) (H : Prop) (h₃ : r₁ H P) (finish: Q) : H := by
340336
-- show error only on h₁ and h₂
341337
grewrite [h₁, ← h₂, h₃]
342338
exact finish
@@ -352,17 +348,3 @@ example {r : α → α → Prop} [Equiv r] : r b a → r b c → r a c := by
352348
repeat sorry
353349

354350
end Examples
355-
356-
example : Subrel r (Iff ⟹ rr) := by
357-
constructor
358-
rw [Subrelation]
359-
intros x y hr
360-
rw [respectful]
361-
intros a b iff
362-
sorry
363-
364-
/-
365-
example (h₁ : a + e ≤ b + e) (h₂ : b < c) (h₃ : c ≤ d) : a + e ≤ d + e := by
366-
grewrite [h₂, h₃] at h₁
367-
exact h₁
368-
-/

grw.pdf

393 KB
Binary file not shown.

0 commit comments

Comments
 (0)