Skip to content

Commit 78c5704

Browse files
committed
chore: update tests accordingly
1 parent 0c6bcfa commit 78c5704

2 files changed

Lines changed: 37 additions & 1 deletion

File tree

MathlibTest/Contrapose.lean

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,43 @@ example (p q : Prop) (h : ¬q → p) : ¬p → q := by
3838
exact h
3939

4040
example (p q : Prop) (h : q → p) : ¬p → ¬q := by
41-
contrapose!
41+
contrapose
4242
guard_target = q → p
4343
exact h
4444

45+
example (p q : Prop) (h : ¬p) (hpq : q → p) : ¬q := by
46+
contrapose h
47+
guard_target = p
48+
exact hpq h
49+
50+
example (p q : Prop) (h : ¬p) (hpq : q → p) : ¬q := by
51+
contrapose h with h'
52+
guard_target = p
53+
exact hpq h'
54+
55+
example (p q : Prop) (h : q → p) : ¬p → ¬q := by
56+
contrapose
57+
guard_target = q → p
58+
exact h
59+
60+
section -- Using contrapose in a superfluous way warns.
61+
62+
/-- warning: `push` made no progress on the goal -/
63+
#guard_msgs in
4564
example (p q : Prop) (h : ¬p) (hpq : q → p) : ¬q := by
4665
contrapose! h
4766
guard_target = p
4867
exact hpq h
4968

69+
/-- warning: `push` made no progress on the goal -/
70+
#guard_msgs in
5071
example (p q : Prop) (h : ¬p) (hpq : q → p) : ¬q := by
5172
contrapose! h with h'
5273
guard_target = p
5374
exact hpq h'
5475

76+
end
77+
5578
example (p q r : Prop) (h : ¬ q ∧ ¬ r → ¬ p) : p → q ∨ r := by
5679
fail_if_success (contrapose; exact h)
5780
contrapose!; exact h

MathlibTest/byContra.lean

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ example (x : α) (f : False) : x ≤ 1 := by
8585

8686
end order
8787

88+
example (n : ℕ) (h : n ≠ 0) : n ≠ 0 := by
89+
by_contra rfl
90+
simp only [Ne, not_true_eq_false] at h
91+
92+
/-- warning: `push` made no progress at h._@.MathlibTest.byContra.2021293407._hygCtx._hyg.18 -/
93+
#guard_msgs in
8894
example (n : ℕ) (h : n ≠ 0) : n ≠ 0 := by
8995
by_contra! rfl
9096
simp only [Ne, not_true_eq_false] at h
@@ -93,6 +99,13 @@ example (p q : Prop) (hnp : ¬ p) : ¬ p ∨ ¬ q := by
9399
by_contra! ⟨hp, _⟩
94100
exact hnp hp
95101

102+
example (p q : Prop) (hnp : ¬ p) (hnq : ¬ q) : ¬ (p ∨ q) := by
103+
by_contra hp | hq
104+
· exact hnp hp
105+
· exact hnq hq
106+
107+
/-- warning: `push` made no progress at h._@.MathlibTest.byContra.2021293410._hygCtx._hyg.25 -/
108+
#guard_msgs in
96109
example (p q : Prop) (hnp : ¬ p) (hnq : ¬ q) : ¬ (p ∨ q) := by
97110
by_contra! hp | hq
98111
· exact hnp hp

0 commit comments

Comments
 (0)