Zulip Chat Archive

Stream: mathlib4

Topic: Error message at the start of file


Gareth Ma (Jul 31 2024 at 00:02):

Compiling the following code, the error message shows up at the start of the file

import Mathlib.Topology.Order
import Mathlib.Algebra.Module.Zlattice.Basic

structure A where
  S : AddSubgroup 
  S_discrete : DiscreteTopology S := by infer_instance
  S_lattice : IsZlattice  S := by infer_instance

def T := AddSubgroup.zmultiples (1 : )
theorem aux : Submodule.span  (T : Set ) =  := by
  ext x
  simp [T]
  apply Set.mem_of_subset_of_mem (s₁ := Ideal.span ({1} : Set ))
  · apply Ideal.span_mono
    simp
  · simp

def B : A where
  S := T
  S_lattice := by
    -- constructor
    use aux

(verified on the online Lean 4 playground) That seems like a bug to me. constructor correctly(?) errors on the spot

Gareth Ma (Jul 31 2024 at 00:04):

import Mathlib.Topology.Order
import Mathlib.Algebra.Module.Zlattice.Basic

class Inst1
class Inst2 extends Inst1
structure A where
  h1 : Inst1 := by infer_instance
  h2 : Inst2 := by infer_instance

axiom inst2 : Inst2
noncomputable def B : A where
  h2 := inst2

Not sure if this is a proper minimisation but it has the same problem

Gareth Ma (Jul 31 2024 at 00:04):

I don't have permissions to move this across channels but maybe this belongs in #lean4

Damiano Testa (Jul 31 2024 at 06:29):

This one is mathlib-free and slightly shorter: the error appears to be reported starting from the first character of the file.

  -- <-- `failed to synthesize A` here
class A

structure B where
  h1 : A := by infer_instance
-- using `inferInstance` instead of `by infer_instance` reports the
-- `failed to synthesize A` and the diagnostic comment here
-- not on the `example` below

example : B where

Marc Huisinga (Jul 31 2024 at 07:58):

Damiano Testa said:

This one is mathlib-free and slightly shorter: the error appears to be reported starting from the first character of the file.

  -- <-- `failed to synthesize A` here
class A

structure B where
  h1 : A := by infer_instance
-- using `inferInstance` instead of `by infer_instance` reports the
-- `failed to synthesize A` and the diagnostic comment here
-- not on the `example` below

example : B where

Could you report this issue in the Lean 4 repository?

Damiano Testa (Jul 31 2024 at 08:34):

Done #4880


Last updated: May 02 2025 at 03:31 UTC