-
Notifications
You must be signed in to change notification settings - Fork 251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add support for other types in norm_num #8100
base: master
Are you sure you want to change the base?
Conversation
digama0
commented
Nov 1, 2023
@@ -279,6 +281,12 @@ and `q` is the value of `n / d`. -/ | |||
∀ (inst : Q(DivisionRing $α) := by assumption) (q : Rat) (n : Q(ℤ)) (d : Q(ℕ)) | |||
(proof : Q(IsRat $x $n $d)), Result x := Result'.isRat | |||
|
|||
/-- The result is `proof : isRat x n d`, where `n` is either `.ofNat lit` or `.negOfNat lit` | |||
with `lit` a raw nat literal and `d` is a raw nat literal (not 0 or 1), | |||
and `q` is the value of `n / d`. -/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doc comment is a verbatim copy of the Result.isRat
comment. Did you mean to have something different here?
have : $e =Q $e' := ⟨⟩ | ||
return .other e' q(@rfl _ $e') | ||
|
||
/-- The `norm_num` extension which identifies expressions of the form `(a, b)`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(a, b)
-> a::b
@@ -679,3 +679,5 @@ example : (1 : R PUnit.{u+1} PUnit.{v+1}) <= 2 := by | |||
|
|||
-- Check that we avoid deep recursion in evaluating large powers. | |||
example : 10^40000000 = 10^40000000 := by norm_num | |||
|
|||
example : (1 + 1, 2 * 2) = (2, 4) := by norm_num1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to add a similar test for lists.