scilib documentation

LeanChemicalTheories / thermodynamics.basic

The Thermodynamic System and Models #

We define a thermodynamic system to be over a general field, which we require to be an albelian group for multiplication. This class has five properties to describe the system, pressure, volume, temperature, amount of substance, and energy. Each property is defined as a function from the natural numbers to our field. This function represents the equillibrium states of the system.

We also define six properties of a thermodynamic system: isobaric, isochoric, isothermal, adiabatic, closed system, and isolated system. These take in a thermodynamic system and have the type Prop, so they can be thought of as assertation about the system.

We finally define an ideal gas, which extends the thermodynamic system by providing a model for the systems properties. So far, the ideal gas only defines the unviersal gas constant and the ideal gas law. Then we show how the boyles law follows form the ideal gas law and the assumption of isothermal and a closed system

To Do #

structure thermo_system (α : Type u_1) [nontrivial α] :
Type u_1
  • pressure : α
  • volume : α
  • temperature : α
  • substance_amount : α
  • internal_energy : α
Instances for thermo_system
  • thermo_system.has_sizeof_inst
def isobaric {α : Type u_1} [nontrivial α] (M : thermo_system α) :
Prop
Equations
def isochoric {α : Type u_1} [nontrivial α] (M : thermo_system α) :
Prop
Equations
def isothermal {α : Type u_1} [nontrivial α] (M : thermo_system α) :
Prop
Equations
def adiabatic {α : Type u_1} [nontrivial α] (M : thermo_system α) :
Prop
Equations
def closed_system {α : Type u_1} [nontrivial α] (M : thermo_system α) :
Prop
Equations
def isolated_system {α : Type u_1} [nontrivial α] (M : thermo_system α) :
Prop
Equations

Gas Laws #

def boyles_law {α : Type u_1} [nontrivial α] (M : thermo_system α) :
Prop
Equations
def charles_law {α : Type u_1} [nontrivial α] (M : thermo_system α) :
Prop
Equations
def avogadros_law {α : Type u_1} [nontrivial α] (M : thermo_system α) :
Prop
Equations
theorem boyles_law_relation {α : Type u_1} [nontrivial α] (M : thermo_system α) :
boyles_law M (n m : α), M.pressure n * M.volume n = M.pressure m * M.volume m
theorem boyles_law_relation' {α : Type u_1} [nontrivial α] (M : thermo_system α) :
( (n m : α), M.pressure n * M.volume n = M.pressure m * M.volume m) boyles_law M
theorem charles_law_relation {α : Type u_1} [nontrivial α] (M : thermo_system α) :
charles_law M (n m : α), M.volume n * M.temperature m = M.volume m * M.temperature n
theorem charles_law_relation' {α : Type u_1} [nontrivial α] (M : thermo_system α) (hT : (n : α), M.temperature n 0) :
( (n m : α), M.volume n * M.temperature m = M.volume m * M.temperature n) charles_law M
theorem avogadros_law_relation {α : Type u_1} [nontrivial α] (M : thermo_system α) :
avogadros_law M (n m : α), M.volume n * M.substance_amount m = M.volume m * M.substance_amount n
theorem avogadros_law_relation' {α : Type u_1} [nontrivial α] (M : thermo_system α) (hN : (n : α), M.substance_amount n 0) :
( (n m : α), M.volume n * M.substance_amount m = M.volume m * M.substance_amount n) avogadros_law M

System models #

structure ideal_gas (α : Type u_2) [nontrivial α] :
Type u_2
Instances for ideal_gas
  • ideal_gas.has_sizeof_inst

Properties about the ideal gas law #

theorem boyles_from_ideal_gas {α : Type u_1} [nontrivial α] (M : ideal_gas α) (iso1 : isothermal M.to_thermo_system) (iso2 : closed_system M.to_thermo_system) (hT : (n : α), M.to_thermo_system.temperature n 0) (hn : (n : α), M.to_thermo_system.substance_amount n 0) :
theorem charles_from_ideal_gas {α : Type u_1} [nontrivial α] (M : ideal_gas α) (iso1 : isobaric M.to_thermo_system) (iso2 : closed_system M.to_thermo_system) (hT : (n : α), M.to_thermo_system.temperature n 0) (hn : (n : α), M.to_thermo_system.substance_amount n 0) (hP : (n : α), M.to_thermo_system.pressure n 0) :
theorem avogadros_from_ideal_gas {α : Type u_1} [nontrivial α] (M : ideal_gas α) (iso1 : isothermal M.to_thermo_system) (iso2 : isobaric M.to_thermo_system) (hT : (n : α), M.to_thermo_system.temperature n 0) (hn : (n : α), M.to_thermo_system.substance_amount n 0) (hP : (n : α), M.to_thermo_system.pressure n 0) :

System Energy #

def enthalpy {α : Type u_1} [nontrivial α] (M : thermo_system α) :
α
Equations
def change (f : ) (n : ) :
Equations