Skip to content
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

Pow type coercion broken #4696

Open
3 tasks done
alexkireeff opened this issue Jul 8, 2024 · 0 comments
Open
3 tasks done

Pow type coercion broken #4696

alexkireeff opened this issue Jul 8, 2024 · 0 comments
Labels
bug Something isn't working P-medium We may work on this issue if we find the time

Comments

@alexkireeff
Copy link

alexkireeff commented Jul 8, 2024

Prerequisites

Please put an X between the brackets as you perform the following steps:

Description

Pow doesn't do type coercion whereas Sub does.

Context

Could be related to this pull request: #2778

Steps to Reproduce

inductive TestType
  | a (value : Float)
  deriving Repr

instance : Coe Float TestType where
  coe x := TestType.a x

instance : Coe TestType Float where
  coe x := 
    let (TestType.a value) := x
    value

instance : HomogeneousPow TestType where
  pow :=
      let pow x y := 
      let (TestType.a value1) := x
      let (TestType.a value2) := y
      TestType.a (value1 ^ value2)
    pow

#eval ((2. : Float) : TestType) ^ ((2. : Float) : TestType) -- `TestType.a 4.000000`
#eval ((2. : Float) : TestType) ^ ((2. : Float)) -- failed to synthesize HPow TestType Float
#eval ((2. : Float)) ^ ((2. : Float) : TestType) -- failed to synthesize HPow TestType Float

Expected behavior:

#eval ((2. : Float) : TestType) ^ ((2. : Float)) -- should return `TestType.a 4.000000`

Actual behavior:

#eval ((2. : Float) : TestType) ^ ((2. : Float)) -- failed to synthesize HPow TestType Float

Versions

using live.lean-lang.org, lean version 4.10.0-rc1

Additional Information

None

Impact

Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.

@alexkireeff alexkireeff added the bug Something isn't working label Jul 8, 2024
@alexkireeff alexkireeff changed the title Pow type coercion Pow type coercion broken Jul 8, 2024
@leanprover-bot leanprover-bot added the P-medium We may work on this issue if we find the time label Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P-medium We may work on this issue if we find the time
Projects
None yet
Development

No branches or pull requests

2 participants