Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create boyles_law.lean #50

Merged
merged 1 commit into from
Mar 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions src/thermodynamics/boyles_law.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import data.real.basic
import data.real.nnreal

/-!
# Boyle's Law
This section defines Boyle's Law which states that absolute pressure of an ideal gas is inversely proportional
to the volume it occupies at constant temperature in a closed thermodynamic system. <br>
$$
P ∝ \frac{1}{V}
$$
or
$$
P V = k
$$

where:
- `P` is pressure
- `V` is volume
- `k` is a constant for a given sample of gas and depends only on the mass of the gas and the temperature

### Assumption
The model assumes:
- ideal gas law for state 1 and state 2 (`PV = nRT`)
- equal temperature (`T1 = T2`)
- equal number of moles (`n1 = n2`)

#### A better proof for Boyle's law, following from the properties of a thermodynamic system, is shown [here](./basic.html).
-/

-- Variables
lemma Boyle (P1 P2 V1 V2 T1 T2 n1 n2 R : ℝ )
-- Assumptions
(a1: P1*V1=n1*R*T1)
(a2: P2*V2=n2*R*T2)
(a3: T1=T2)
(a4: n1=n2)
:
-- Conjecture
(P1*V1=P2*V2)
:=
begin
rw a3 at a1,
rw a4 at a1,
exact (rfl.congr (eq.symm a2)).mp a1,
end
Loading