Skip to content

EVMPR theorem twoState_helmholtzFreeEnergy_eq - #1474

Open
korolrom wants to merge 3 commits into
leanprover-community:masterfrom
korolrom:master
Open

EVMPR theorem twoState_helmholtzFreeEnergy_eq #1474
korolrom wants to merge 3 commits into
leanprover-community:masterfrom
korolrom:master

Conversation

@korolrom

Copy link
Copy Markdown

This is my first contribution to physlib.
The result can be simplified further under hypothesis T \neq 0, but I left it as a more general result including zero temperature.

…ified further if T \neq 0, but I left it as a general result
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for this PR, which will now be reviewed. If submitting to ./Physlib or ./QuantumInfo, please see our review guidelines if you are not familiar with the process. You should expect a back and forth with a reviewer before your PR is merged. See also that link for how to add appropriate labels to your PR. The PR will also go through a number of automated checks. You can learn more about these here, including how to run them locally.

If you are submitting to ./PhyslibAlpha there will be a lighter review process, though your PR must still pass the automated checks.

If you want to bring attention to this PR, please write a message on this thread of the Lean Zulip.

Important: If a reviewer adds an awaiting-author label to your PR, once you have addressed the review comments, please remove that label by adding a comment with -awaiting-author. This helps us keep track of reviews.

@github-actions github-actions Bot added the t-statistical-mechanics Statistical mechanics label Jul 31, 2026

@jstoobysmith jstoobysmith left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @korolrom This is a great first PR. I've added some comments (some of them are a bit pedantic). If you could have a go at addressing them, this would be great.

Let me know if you have any questions :).

Comment on lines +107 to +108
lemma twoState_helmholtzFreeEnergy_eq
(E₀ E₁ : ℝ) (T : Temperature) :

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could probably collapse this to one line.

Comment on lines +120 to +122
rw [helmholtzFreeEnergy, twoState_partitionFunction_apply]
rw [show (T.val : ℝ) = T.toReal by rfl]
rw [hE0, hE1]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May worth be putting this into a single large rw [...]

Comment on lines +132 to +133
rw [Real.log_exp,Temperature.β_toReal]
simp only [div_eq_mul_inv, one_mul, inv_inv]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you combine the things in the rw with the things in the simp so e.g.

simp only [Real.log_exp,Temperature.β_toReal, div_eq_mul_inv, one_mul, inv_inv]

(Will have to check if this actually works).

@jstoobysmith jstoobysmith added the awaiting-author A reviewer has asked the author a question or requested changes label Jul 31, 2026
@jstoobysmith

Copy link
Copy Markdown
Member

Also doing the T \neq 0 case would be a great future PR!

@korolrom

Copy link
Copy Markdown
Author

Thank you for the ultrafast review! @jstoobysmith
I have condensed the lines you suggested as well as 1-2 more.

I am happy to also add the T \neq 0 case. Would that be another lemma? Feels like not "big" enough to warrant its own lemma :)

@jstoobysmith

Copy link
Copy Markdown
Member

This looks much better - and looks almost there! Some of the linters are now failing though. Would you mind fixing these (some instructions to running them locally here, but can also just rely on github workflows. The ones I can see now are about line lengths.

Regarding T \neq 0, if it is a large simplification then it probably does warrant its own lemma, but probably best to keep that to a separate Pull request (PR).

@korolrom

Copy link
Copy Markdown
Author

Ok, I split the line and I tried to run the linter locally but there are a lot of errors and warnings from
lake exe lint all

I ready to create another PR for the T\neq 0 result once this one is merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-author A reviewer has asked the author a question or requested changes t-statistical-mechanics Statistical mechanics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants