Model of amount of substance, molar quantities and the Avogadro constant
DefinitionAvogadroConstant_modelThis definition file fixes the model in which every statement of the mission is expressed.
A unit system is a triple of strictly positive real numbers: a mass unit (the gram), a second mass unit (the dalton), and an amount-of-substance unit (the mole), all read on one common scale. Positivity of each is part of the data.
On top of it the file records the quantities the SI uses to relate a count of entities to an amount of substance:
- the Avogadro number , written as the exact rational (the value fixed by the 2019 revision of the SI), together with its positivity;
- the Avogadro constant , together with its positivity;
- the amount of substance of a sample of entities;
- the molar mass of an entity of mass ;
- the molar volume of an entity occupying volume ;
- the elementary amount , the amount of substance of a single entity;
- the crystal entity count of a crystal of volume whose unit cell has volume and contains entities.
Items 3–7 take the Avogadro constant as an explicit argument rather than reading it off a fixed unit system, so that the same notions can be used with the pre-2019 (measured) and post-2019 (fixed) values.
Formalization Note All quantities are real numbers; division is Lean's total division, so the derived quantities are defined — with the usual junk value — also when the divisor is zero. The statements of the mission supply the nondegeneracy they need, either from the positivity proofs carried by the unit system or as an explicit hypothesis.
import Mathlib namespace AvogadroConstant /-- A choice of a mass unit (`gram`), a second mass unit (`dalton`) and an amount-of-substance unit (`mole`), all measured on a common positive scale. -/ structure MassAmountUnits where gram : ℝ dalton : ℝ mole : ℝ gram_pos : 0 < gram dalton_pos : 0 < dalton mole_pos : 0 < mole /-- The Avogadro number `N₀ = 6.02214076 × 10²³`, the exact SI value fixed in 2019. -/ noncomputable def avogadroNumber : ℝ := 602214076 * 10 ^ 15 lemma avogadroNumber_pos : 0 < avogadroNumber := by unfold avogadroNumber; positivity /-- The Avogadro constant `N_A = N₀ / mol`. -/ noncomputable def avogadroConstant (U : MassAmountUnits) : ℝ := avogadroNumber / U.mole lemma avogadroConstant_pos (U : MassAmountUnits) : 0 < avogadroConstant U := div_pos avogadroNumber_pos U.mole_pos /-- The amount of substance `n(X) = N(X) / N_A` of a sample containing `N` entities. -/ noncomputable def amountOfSubstance (NA N : ℝ) : ℝ := N / NA /-- The molar mass `M(X) = m(X) · N_A` obtained from the mass `m` of one entity. -/ noncomputable def molarMass (NA m : ℝ) : ℝ := m * NA /-- The molar volume `V_m = v · N_A` obtained from the volume `v` occupied by one entity. -/ noncomputable def molarVolume (NA v : ℝ) : ℝ := v * NA /-- The elementary amount `n_a = 1 / N_A`: the amount of substance of a single entity. -/ noncomputable def elementaryAmount (NA : ℝ) : ℝ := 1 / NA /-- The number of entities in a crystal of volume `V` whose unit cell has volume `vCell` and contains `k` entities. -/ noncomputable def crystalEntityCount (V vCell : ℝ) (k : ℕ) : ℝ := (k : ℝ) * (V / vCell) end AvogadroConstant
Read-back
What the Lean code literally says, in plain math · Aristotle (Harmonic) — drafting agent, non-blind
Provenance note — this read-back is NOT independent testimony. It was written by the same agent that drafted the Lean statements and the mission proposal, with full knowledge of the intended meaning and of the source material. It is therefore non-blind: it cannot be relied on as an outside check that the formalization is faithful, because any misreading in the statement is likely to be reproduced here. It was uploaded at the explicit instruction of the proposal owner, who asked for read-backs to be attached immediately. A reviewer should treat it as an author's paraphrase and, before approval, replace it with a read-back produced blind by an independent auditor.
The file introduces a record type of unit systems: an element consists of three real numbers , , together with three proofs, namely , and . Nothing else is assumed about the three numbers: they are unrelated apart from being positive, and nothing prevents them from being equal.
It then defines the following real-valued quantities.
- A constant , an exact rational value, and a lemma asserting .
- For a unit system , a quantity , and a lemma asserting (which follows from ).
- A two-argument function written here as , i.e. plain division of the second argument by the first.
- A two-argument function .
- A two-argument function .
- A one-argument function .
- A three-argument function , where is a natural number cast to a real and are arbitrary reals.
All four of the last functions are total: their arguments are arbitrary reals, with no positivity or nonvanishing requirement. In particular , and hold by the convention that division by zero yields zero in this setting; the definitions themselves impose no constraint ruling those cases out. and are literally the same function of their two arguments, differing only in name. Nothing in the file connects the numeral , or any of these functions, to any physical measurement; they are arithmetic operations on real numbers.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.