First law of thermodynamics: processes, adiabatic work, internal energy and heat
DefinitionFirstLawThermo_DefsThis definition file fixes the vocabulary for the mission. Throughout, is the type of states of a closed system.
- Process. A process consists of an initial state , a final state , the net work done by the system on its surroundings (Clausius sign convention), and a proposition " is adiabatic" (the process takes place inside an adiabatic enclosure).
- Composition. For processes , the composite ("first , then ") starts at , ends at , has work , and is adiabatic iff both and are.
- Null process at : start and finish , work , adiabatic.
- Cyclic: . Adynamic: .
- For a set of processes (the realizable ones):
- is closed under composition if and imply ;
- contains the null processes if the null process at every state lies in ;
- adiabatic work is path independent in if any two adiabatic with the same start and the same finish have ;
- adiabatically links every state to if for every there is an adiabatic going from to or from to .
- Internal energy. is an internal energy for if
- Heat (Born's definition, as a residual): for ,
These are the objects in terms of which all theorems of the mission are stated.
Formalization Note Work is work done by the system, so the Clausius form is the one that holds. "Adiabatic" is a primitive proposition attached to each process, and heat is a derived quantity depending on the chosen internal energy .
import Mathlib
namespace FirstLawThermo
/-- A process undergone by a closed system (no transfer of matter) whose states form the type
`σ`. It records the initial state `start`, the final state `finish`, the net work `work` done
*by* the system on its surroundings during the process (Clausius sign convention: work done by
the system is positive), and whether the process is `adiabatic`, i.e. carried out with the
system enclosed by adiabatic walls, so that energy is transferred only as work. -/
structure Process (σ : Type*) where
/-- The initial state of the process. -/
start : σ
/-- The final state of the process. -/
finish : σ
/-- The net work done by the system on its surroundings (Clausius sign convention). -/
work : ℝ
/-- The process takes place inside an adiabatic enclosure. -/
adiabatic : Prop
namespace Process
variable {σ : Type*}
/-- Sequential composition of two stages: first `p`, then `q`. It is intended for
`p.finish = q.start`; the composite starts where `p` starts, ends where `q` ends, the work done
is the sum of the works of the stages, and it is adiabatic exactly when both stages are. -/
def comp (p q : Process σ) : Process σ where
start := p.start
finish := q.finish
work := p.work + q.work
adiabatic := p.adiabatic ∧ q.adiabatic
/-- The null process at the state `A`: the system is left in state `A`, no work is done, and
no energy is exchanged (so it is in particular adiabatic). -/
def null (A : σ) : Process σ where
start := A
finish := A
work := 0
adiabatic := True
/-- A process is cyclic if it returns the system to its initial state. -/
def IsCyclic (p : Process σ) : Prop :=
p.start = p.finish
/-- A process is adynamic if no energy is transferred as work. -/
def IsAdynamic (p : Process σ) : Prop :=
p.work = 0
end Process
variable {σ : Type*}
/-- The set `procs` of physically realizable processes is closed under sequential composition
of consecutive stages. -/
def ClosedUnderComp (procs : Set (Process σ)) : Prop :=
∀ p ∈ procs, ∀ q ∈ procs, p.finish = q.start → p.comp q ∈ procs
/-- Every null process belongs to `procs` (leaving the system alone is realizable). -/
def ContainsNull (procs : Set (Process σ)) : Prop :=
∀ A : σ, Process.null A ∈ procs
/-- Path independence of adiabatic work: any two adiabatic processes in `procs` with the same
initial state and the same final state involve the same net work, however the work is done. -/
def AdiabaticWorkPathIndependent (procs : Set (Process σ)) : Prop :=
∀ p ∈ procs, ∀ q ∈ procs, p.adiabatic → q.adiabatic →
p.start = q.start → p.finish = q.finish → p.work = q.work
/-- Every state `A` is linked to the reference state `O` by an adiabatic process in `procs`,
in at least one of the two directions (from `O` to `A`, or from `A` to `O`). -/
def AdiabaticallyLinkedTo (procs : Set (Process σ)) (O : σ) : Prop :=
∀ A : σ, ∃ p ∈ procs, p.adiabatic ∧
((p.start = O ∧ p.finish = A) ∨ (p.start = A ∧ p.finish = O))
/-- `U : σ → ℝ` is an internal energy function for `procs`: for every adiabatic process in
`procs`, the change of `U` equals minus the work done by the system,
`U(finish) - U(start) = -W`. -/
def IsInternalEnergy (procs : Set (Process σ)) (U : σ → ℝ) : Prop :=
∀ p ∈ procs, p.adiabatic → U p.finish - U p.start = -p.work
/-- The heat supplied to the system in the process `p`, defined (following Born) as the residual
`Q = ΔU + W`: the change of the internal energy `U` not accounted for by the work `W` done by
the system. -/
def heat (U : σ → ℝ) (p : Process σ) : ℝ :=
U p.finish - U p.start + p.work
end FirstLawThermo
Read-back
What the Lean code literally says, in plain math · Aristotle (Harmonic), the drafting agent itself; non-blind read-back
Disclosure: this read-back is NOT blind. It was written by the same agent (Aristotle, by Harmonic) that drafted these Lean statements, with full knowledge of the source text and of the intended meaning. It is therefore not independent testimony and must not be mistaken for an independent audit. Reviewers should check the Lean code against the source themselves.
The file introduces, for an arbitrary type (any universe, possibly empty):
- A structure Process on with four fields: , , a real number , and an arbitrary proposition . Nothing links these fields. Any combination of states, real number and proposition is a process, and the "adiabatic" proposition may be any proposition at all (true, false or undecided).
- comp : the process with start , finish , work , adiabatic proposition " adiabatic and adiabatic". It is defined for all , even when .
- null : start finish , work , adiabatic proposition "True".
- IsCyclic : . IsAdynamic : .
- For a set of processes:
- ClosedUnderComp : for all with , .
- ContainsNull : for every , .
- AdiabaticWorkPathIndependent : for all , if both adiabatic propositions hold, and , then .
- AdiabaticallyLinkedTo (for ): for every there is whose adiabatic proposition holds and with either ( and ) or ( and ).
- IsInternalEnergy (for ): for every whose adiabatic proposition holds,
If no process in is adiabatic (for example ), every qualifies.
- heat , a real number defined for every and every process (adiabatic or not, in or not).
All declarations live in the namespace FirstLawThermo (Process-specific ones in FirstLawThermo.Process).
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.