Skip to content

Commit

Permalink
fix one test, comment part of another
Browse files Browse the repository at this point in the history
  • Loading branch information
collares committed Oct 23, 2023
1 parent 7d5634a commit 4d64bfc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
6 changes: 4 additions & 2 deletions Mathlib/Tactic/ComputeDegree.lean
Original file line number Diff line number Diff line change
Expand Up @@ -448,12 +448,14 @@ elab_rules : tactic | `(tactic| compute_degree $[!%$bang]?) => focus <| withMain
-- simplify the left-hand sides, since this is where the degree computations leave
-- expressions such as `max (0 * 1) (max (1 + 0 + 3 * 4) (7 * 0))`
evalTactic
(← `(tactic| try any_goals conv_lhs => (simp only [Nat.cast_withBot]; norm_num)))
(← `(tactic| try any_goals conv_lhs =>
(simp (config := {decide := true}) only [Nat.cast_withBot]; norm_num)))
if bang.isSome then
let mut false_goals : Array MVarId := #[]
let mut new_goals : Array MVarId := #[]
for g in ← getGoals do
let gs' ← run g do evalTactic (← `(tactic| try (any_goals norm_num <;> try assumption)))
let gs' ← run g do evalTactic (←
`(tactic| try (any_goals norm_num <;> norm_cast <;> try assumption)))
new_goals := new_goals ++ gs'.toArray
if ← gs'.anyM fun g' => g'.withContext do return (← g'.getType'').isConstOf ``False then
false_goals := false_goals.push g
Expand Down
10 changes: 7 additions & 3 deletions test/norm_num_ext.lean
Original file line number Diff line number Diff line change
Expand Up @@ -335,18 +335,22 @@ variable {α : Type _} [CommRing α]
open BigOperators

-- Lists:
/-
example : ([1, 2, 1, 3]).sum = 7 := by norm_num only
-- example : (([1, 2, 1, 3] : List ℚ).map (fun i => i^2)).sum = 15 := by norm_num [-List.map] --TODO
example : (([1, 2, 1, 3] : List ℚ).map (fun i => i^2)).sum = 15 := by norm_num [-List.map]
example : (List.range 10).sum = 45 := by norm_num only
example : (List.finRange 10).sum = 45 := by norm_num only
-/

-- Multisets:
/-
example : (1 ::ₘ 2 ::ₘ 1 ::ₘ 3 ::ₘ {}).sum = 7 := by norm_num only
example : ((1 ::ₘ 2 ::ₘ 1 ::ₘ 3 ::ₘ {}).map (fun i => i^2)).sum = 15 := by norm_num only
-- example : (({1, 2, 1, 3} : Multiset ℚ).map (fun i => i^2)).sum = 15 := by -- TODO
-- norm_num [-Multiset.map_cons]
example : (({1, 2, 1, 3} : Multiset ℚ).map (fun i => i^2)).sum = 15 := by
norm_num [-Multiset.map_cons]
example : (Multiset.range 10).sum = 45 := by norm_num only
example : (↑[1, 2, 1, 3] : Multiset ℕ).sum = 7 := by norm_num only
-/

-- Finsets:
example : Finset.prod (Finset.cons 2 ∅ (Finset.not_mem_empty _)) (λ x => x) = 2 := by norm_num1
Expand Down

0 comments on commit 4d64bfc

Please sign in to comment.