Skip to content

Commit

Permalink
two more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
llllvvuu committed Jan 16, 2025
1 parent 1b4ac01 commit d39c120
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/Init/Data/Nat/Lemmas.lean
Original file line number Diff line number Diff line change
Expand Up @@ -1057,11 +1057,10 @@ instance decidableBallLE (n : Nat) (P : ∀ k, k ≤ n → Prop) [∀ n h, Decid
decidable_of_iff (∀ (k) (h : k < succ n), P k (le_of_lt_succ h))
fun m k h => m k (lt_succ_of_le h), fun m k _ => m k _⟩

instance decidableExistsLT [DecidablePred p] :
DecidablePred fun n => ∃ m : Nat, m < n ∧ p m :=
fun n => match Nat.decidableBallLT n (fun (m : Nat) (_ : m < n) => ¬p m) with
| isTrue h => isFalse (by simpa using h)
| isFalse h => isTrue (by simpa using h)
instance decidableExistsLT [DecidablePred p] : DecidablePred fun n => ∃ m : Nat, m < n ∧ p m
| n => match Nat.decidableBallLT n (fun (m : Nat) (_ : m < n) => ¬p m) with
| isTrue h => isFalse (by simpa using h)
| isFalse h => isTrue (by simpa using h)

instance decidableExistsLE [DecidablePred p] : DecidablePred fun n => ∃ m : Nat, m ≤ n ∧ p m :=
fun n => decidable_of_iff (∃ m, m < n + 1 ∧ p m)
Expand Down
2 changes: 2 additions & 0 deletions tests/lean/run/natDecidableBallLT.lean
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ example : ∀ a ≤ 600, a ^ 2 ≠ 7 := by decide
example : ∀ a : Fin 600, (a : Nat) ^ 27 := by decide
example : ∃ a < 600, a^2 = 90000 := by decide
example : ∃ a ≤ 600, a^2 = 90000 := by decide
example : ∃ a, ∃ h : a < 599, (⟨a, h⟩ : Fin 599) * 2 = 1 := by decide
example : ∃ a, ∃ h : a ≤ 600, (⟨a, Nat.lt_add_one_of_le h⟩ : Fin 601) * 2 = 1 := by decide

0 comments on commit d39c120

Please sign in to comment.