diff options
author | Son Ho | 2023-08-04 18:19:37 +0200 |
---|---|---|
committer | Son Ho | 2023-08-04 18:19:37 +0200 |
commit | f7c09787c4a7457568d3d79d38b45caac4af8772 (patch) | |
tree | edac38167e05e76e7e38798e89dadc672df06f3b /backends/lean/Base/Primitives/Scalar.lean | |
parent | 931fabe3e8590815548d606b33fc8db31e9f6010 (diff) |
Start adding support for Arrays/Slices in the Lean library
Diffstat (limited to '')
-rw-r--r-- | backends/lean/Base/Primitives/Scalar.lean | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/backends/lean/Base/Primitives/Scalar.lean b/backends/lean/Base/Primitives/Scalar.lean index 2e5be8bf..ffc969f3 100644 --- a/backends/lean/Base/Primitives/Scalar.lean +++ b/backends/lean/Base/Primitives/Scalar.lean @@ -787,15 +787,8 @@ instance (ty : ScalarTy) : DecidableEq (Scalar ty) := | isTrue h => isTrue (Scalar.eq_of_val_eq h) | isFalse h => isFalse (Scalar.ne_of_val_ne h) -/- Remark: we can't write the following instance because of restrictions about - the type class parameters (`ty` doesn't appear in the return type, which is - forbidden): - - ``` - instance Scalar.cast (ty : ScalarTy) : Coe (Scalar ty) Int where coe := λ v => v.val - ``` - -/ -def Scalar.toInt {ty} (n : Scalar ty) : Int := n.val +instance (ty : ScalarTy) : CoeOut (Scalar ty) Int where + coe := λ v => v.val -- -- We now define a type class that subsumes the various machine integer types, so -- -- as to write a concise definition for scalar_cast, rather than exhaustively |