Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: port
pi_fin.reflect
instance (#3430)
This was skipped during the initial port of this file. There are some golfing discussions [here on Zulip](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/unquoteExpr.3A.20inst.E2.9C.9D.C2.B2.2E2.20.3A.20Expr/near/349273797) that we could revisit later Co-authored-by: Gabriel Ebner <gebner@gebner.org>
- Loading branch information
1 parent
6d024cd
commit 1ebf4e3
Showing
3 changed files
with
53 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/- | ||
Manually ported from | ||
https://github.com/leanprover-community/mathlib/blob/fee91d74414e681a8b72cb7160e6b5ef0ec2cc0b/test/vec_notation.lean | ||
-/ | ||
import Mathlib.Data.Fin.VecNotation | ||
|
||
/-! These tests are testing `PiFin.toExpr` and fail with | ||
`local attribute [-instance] PiFin.toExpr` -/ | ||
|
||
open Lean | ||
open Lean.Meta | ||
open Qq | ||
|
||
#eval do | ||
let x : Fin 0 → ℕ := ![] | ||
let .true ← isDefEq (toExpr x) q((![] : Fin 0 → ℕ)) | failure | ||
|
||
#eval do | ||
let x := ![1, 2, 3] | ||
let .true ← isDefEq (toExpr x) q(![1, 2, 3]) | failure | ||
|
||
#eval do | ||
let x := ![![1, 2], ![3, 4]] | ||
let .true ← isDefEq (toExpr x) q(![![1, 2], ![3, 4]]) | failure | ||
|
||
/-! These tests are testing `PiFin.repr` -/ | ||
|
||
#eval show MetaM Unit from guard (toString (repr (![] : _ → ℕ)) = "![]") | ||
#eval show MetaM Unit from guard (toString (repr ![1, 2, 3]) = "![1, 2, 3]") | ||
#eval show MetaM Unit from guard (toString (repr ![![1, 2], ![3, 4]]) = "![![1, 2], ![3, 4]]") |