Skip to content

[Lean] Implemented items that use other associated items produce invalid Lean #1904

@JuanCoRo

Description

@JuanCoRo

Consider the following Rust where implemented items of Foo make use of other implemented items:

pub trait Foo { 
    const F: u32;
    fn a() -> u32;
    fn b();
    fn c();
}

pub struct Bar;

impl Foo for Bar {
    const F: u32 = 1;
    fn a() -> u32 {
        Self::F
    }
    fn b() {}
    fn c() {
        Self::b()
    }
}

Which, after fixing F for #1903, produces the following Lean instance:

instance Playground.Impl : Playground.Foo Playground.Bar where
  F := 1
  a := fun (_ : Rust_primitives.Hax.Tuple0) => do
    (Playground.Foo.F Playground.Bar)
  b := fun (_ : Rust_primitives.Hax.Tuple0) => do
    (pure Rust_primitives.Hax.Tuple0.mk)
  c := fun (_ : Rust_primitives.Hax.Tuple0) => do
    (Playground.Foo.b Playground.Bar Rust_primitives.Hax.Tuple0.mk)

Here, Lean complains about using Playground.Foo.F Playground.Bar and Playground.Foo.b Playground.Bar during the instance declaration. What should be the correct generation for this instance?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions