Zulip Chat Archive

Stream: new members

Topic: new to lean


Bill Cochran (Jan 13 2026 at 14:56):

hi! i'm new to lean. i did some rust in a past life, so that's helping a bunch. i'm working on a book, more of a passion project than anything right now. the math is really complex, lots of indices and tags. so i was looking to use lean to make sure i have done it right. i have written my first theorem (!) that appears to compile (!!). i have a repo here: https://github.com/wkcochran123/measurement/tree/development

well, at least i think i have written my first theorem in lean. my experience from rust suggests that it works as implemented. is that all there is?

Vlad (Jan 13 2026 at 15:13):

It may be better to use a class instead of axioms:

class Entropy where
  Instrument : Type u
  Symbol : Instrument  Type v
  symbolFintype : (i : Instrument)  Fintype (Symbol i)
  -- ...

Eric Wieser (Jan 13 2026 at 15:16):

Could you link to the relevant file, and perhaps delete all the "hello world" files?

Bill Cochran (Jan 13 2026 at 15:17):

https://github.com/wkcochran123/measurement/blob/development/lean/Entropy/Chapter2/Propositions.lean

Bill Cochran (Jan 13 2026 at 15:17):

This is the proposition

Bill Cochran (Jan 13 2026 at 15:18):

the thing that needs instantiation is the instrument, not entropy

Bill Cochran (Jan 13 2026 at 15:18):

that's the thing i am leaving out

Bill Cochran (Jan 13 2026 at 15:18):

i want to see if i can instantiate it.

Bill Cochran (Jan 13 2026 at 15:19):

e.g. set of instruments > 0

Bill Cochran (Jan 13 2026 at 15:20):

or, my guess set of instruments > 3

Eric Wieser (Jan 13 2026 at 15:21):

If you want to instantiate, you should replace your axioms with variables

Bill Cochran (Jan 13 2026 at 15:21):

no, i need to specify the interface
not the data.

Bill Cochran (Jan 13 2026 at 15:21):

the data need not be known.

Eric Wieser (Jan 13 2026 at 15:22):

variable means "this is not known right now, but something downstream can specify it"

Bill Cochran (Jan 13 2026 at 15:22):

nothing can specify it

Eric Wieser (Jan 13 2026 at 15:22):

axiom means (among other things) "this can never be known / instantiated"

Bill Cochran (Jan 13 2026 at 15:22):

it need not ever be known

Bill Cochran (Jan 13 2026 at 15:23):

correct

Bill Cochran (Jan 13 2026 at 15:23):

that's the thing i want to instantiate an instrument from

Eric Wieser (Jan 13 2026 at 15:23):

axiom Instrument : Type u prevents you from saying "there are three instruments" by setting Instrument := Fin 3

Bill Cochran (Jan 13 2026 at 15:23):

i know

Eric Wieser (Jan 13 2026 at 15:24):

But is that not exactly what you asked to do?

Bill Cochran (Jan 13 2026 at 15:24):

i have to prove the set of instruments >= k

Bill Cochran (Jan 13 2026 at 15:24):

thats why instrument is an Nat

Bill Cochran (Jan 13 2026 at 15:24):

and is assumed to exist.

Bill Cochran (Jan 13 2026 at 15:25):

this is using a lot of my rust skills to guess at

Bill Cochran (Jan 13 2026 at 15:25):

but the way rust interprets the memory is how the proof works.

Bill Cochran (Jan 13 2026 at 15:25):

so far

Bill Cochran (Jan 13 2026 at 15:26):

so, the theorem is true. if it compiles, correct? these are the unit tests for my book.

Bill Cochran (Jan 13 2026 at 15:26):

but, i want to say i started going down this path the way you suggested.

Bill Cochran (Jan 13 2026 at 15:27):

before i figured out this is rust like and not c++ like

Eric Wieser (Jan 13 2026 at 15:27):

(note that the convention on Zulip tends to be to combine messages into one a bit like you would for an email, rather than a stream of consciousness in the way that discord is used)

Bill Cochran (Jan 13 2026 at 15:28):

my apologies. i do want to say thank you so much for looking!

Bill Cochran (Jan 13 2026 at 15:30):

what i am hearing is that the theorem is rather trivial. that is my hope. this is supposed to be straightforward enough to do in ZFC. it gets a lot harder very soon. as long as it building means it passes and i think i have the interfaces correct, then i am go for more testing! thanks for helping. next time i come back i hope it is a much harder challenge for you.

Eric Wieser (Jan 13 2026 at 15:32):

Your axioms are inconsistent:

example : False :=
  letI : RecordOrder Unit := fun _ _ => True
  letI : EventOrder Unit := fun _ _ => True
  ockham_order_coherence (fun _ _ => ()) (e₁ := ()) (e₂ := ()) trivial () trivial

Eric Wieser (Jan 13 2026 at 15:32):

I strongly recommend not using axiom at all

Bill Cochran (Jan 13 2026 at 15:34):

instantiable instead of pure interface. i think i can refactor back into that now that i have done it on the interface. i was thinking api -> impl -> exec pattern, but i can just do api -> impl. thanks for your help.

Eric Wieser (Jan 13 2026 at 15:35):

The way to write an API (assuming you mean an interface) is to use class, not axiom

Bill Cochran (Jan 13 2026 at 15:36):

i'm talking specifying maps. i need to specify the cardinality of sets in a bunch of different ways.

Bill Cochran (Jan 13 2026 at 15:36):

this is a cardinality comparison proof.

Bill Cochran (Jan 13 2026 at 15:37):

taken a very very very very long way.

Bill Cochran (Jan 13 2026 at 15:37):

turning off now sorry for the spam everyone.

Eric Wieser (Jan 13 2026 at 15:38):

If you haven't already, take a look at #mwe; if you can reduce questions to this format, you will almost certainly get helpful answers from this channel!

sujan (Jan 21 2026 at 14:52):

Hi it feels great to be here. Hope I will be able to learn.

Swapna Iyer (Jan 21 2026 at 15:24):

Hi I am Swapna, building https://app.thelabcompany.co/ so everyone can participate in building cool things with technology. I am new to lean and building with Rust the Agentic AI systems needed for a social network and recommendation systems. With AI in the picture, looking to use proof techniques for verification. If there is any work/libraries used in AI, please do share. Thank you!

Mateo Bartellini Huapalla (Jan 25 2026 at 04:05):

Hi, I am Mateo Bartellini Huapalla, new to lean and slowly getting to know the formal verification/automated reasoning world. Super thankful to Daniel Dia and the team behind Proof101, excited to follow their seminars!

Loren Abdulezer (Jan 26 2026 at 02:46):

Hello all, I am Loren Abdulezer, and am new to Lean. Attending the course Proof 101. I am interested in verification and theorem proving in some areas having some applicability in physics.


Last updated: Feb 28 2026 at 14:05 UTC