Zulip Chat Archive

Stream: new members

Topic: Using let to define structures locally


VayusElytra (Sep 04 2024 at 17:18):

Hello, I am curious how one can write local definitions of structures into a proof.
Here's an instance of my problem:

structure dummyStructure where
  val1 : 
  val2 : 

lemma dummyLemma : Prop :=
  let a : dummyStructure where
    val1 := 1
    val2 := 2
  sorry

This gives the error that the token where is unexpected. Why does let not work here and what should I be using to define a structure locally in the middle of a proof then?

I think just writing

  let a : dummyStructure := 1, 2

works, but if I have anything more complicated than natural numbers in my structure this'll be very annoying to use...

Ruben Van de Velde (Sep 04 2024 at 17:48):

let a := { val1 := 1, val2 := 2 }

VayusElytra (Sep 04 2024 at 18:12):

thank you!

VayusElytra (Sep 04 2024 at 18:13):

i am a little curious why where does not work here while it is fine to use in a def for instance...


Last updated: May 02 2025 at 03:31 UTC