Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Perfect-gas normal shock: enthalpy, sound speed, Mach number, Rankine–Hugoniot relations, entropy jump and the shock-ratio functions

Definition
AstrophysicalFluidDynamics_ShockDefs

by Lucas · Oct 4, 2026 · Mathlib 0df444a (Lean v4.33.1)

astrophysicsfluid-dynamicsmathematical-physicsshock-waves

Definitions for a normal, non-magnetic shock in a perfect gas with constant adiabatic exponent γ\gammaγ (Ogilvie 2016, §§2.8, 4.5, 6.3.1–6.3.2, Example A.13). Throughout, ρ\rhoρ is density, ppp pressure and uuu the velocity component normal to the shock, in the rest frame of the shock; subscript 111 denotes the upstream (pre-shock) state and 222 the downstream (post-shock) state.

  1. Specific enthalpy (eq. 6.28): h(p,ρ)=γγ−1 pρh(p,\rho) = \dfrac{\gamma}{\gamma-1}\,\dfrac{p}{\rho}h(p,ρ)=γ−1γ​ρp​.
  2. Adiabatic sound speed (eq. 4.36): vs2=γpρv_s^2 = \dfrac{\gamma p}{\rho}vs2​=ργp​ and vs=(γp/ρ)1/2v_s = (\gamma p/\rho)^{1/2}vs​=(γp/ρ)1/2.
  3. Mach number (eq. 6.29): M=u/vsM = u / v_sM=u/vs​.
  4. Specific internal energy (eq. 2.22): e=p(γ−1)ρe = \dfrac{p}{(\gamma-1)\rho}e=(γ−1)ρp​.
  5. Rankine–Hugoniot relations (eqs. 6.27a–c): the upstream state (ρ1,u1,p1)(\rho_1,u_1,p_1)(ρ1​,u1​,p1​) and downstream state (ρ2,u2,p2)(\rho_2,u_2,p_2)(ρ2​,u2​,p2​) satisfy
[ρu]12=0,[ρu2+p]12=0,[ρu(12u2+h)]12=0,[\rho u]_1^2 = 0,\qquad [\rho u^2 + p]_1^2 = 0,\qquad \Big[\rho u\big(\tfrac12 u^2 + h\big)\Big]_1^2 = 0,[ρu]12​=0,[ρu2+p]12​=0,[ρu(21​u2+h)]12​=0,

where [Q]12=Q2−Q1[Q]_1^2 = Q_2 - Q_1[Q]12​=Q2​−Q1​. 6. Entropy jump (from s=cp(γ−1ln⁡p−ln⁡ρ)+consts = c_p(\gamma^{-1}\ln p - \ln\rho) + \text{const}s=cp​(γ−1lnp−lnρ)+const, §11.6.2, and cp=γcvc_p = \gamma c_vcp​=γcv​): [s]12cv=ln⁡p2p1−γln⁡ρ2ρ1\dfrac{[s]_1^2}{c_v} = \ln\dfrac{p_2}{p_1} - \gamma\ln\dfrac{\rho_2}{\rho_1}cv​[s]12​​=lnp1​p2​​−γlnρ1​ρ2​​. 7. Shock-ratio functions of the upstream Mach number M1M_1M1​ (eqs. 6.30a,b, 6.31):

D(M1)=(γ+1)M12(γ−1)M12+2,P(M1)=2γM12−(γ−1)γ+1,M22(M1)=2+(γ−1)M122γM12−(γ−1).D(M_1) = \frac{(\gamma+1)M_1^2}{(\gamma-1)M_1^2+2},\qquad P(M_1) = \frac{2\gamma M_1^2-(\gamma-1)}{\gamma+1},\qquad M_2^2(M_1) = \frac{2+(\gamma-1)M_1^2}{2\gamma M_1^2-(\gamma-1)}.D(M1​)=(γ−1)M12​+2(γ+1)M12​​,P(M1​)=γ+12γM12​−(γ−1)​,M22​(M1​)=2γM12​−(γ−1)2+(γ−1)M12​​.

These are the objects in terms of which every statement of the mission is phrased.

Formalization Note All quantities are real numbers and all functions are total: division by zero returns 000, the logarithm satisfies ln⁡0=0\ln 0 = 0ln0=0 and ln⁡x=ln⁡∣x∣\ln x = \ln|x|lnx=ln∣x∣ for x<0x<0x<0, and the square root of a negative number is 000. Every theorem of the mission assumes γ>1\gamma>1γ>1 and positive densities and pressures (and positive normal velocities where relevant), so these junk values never enter the statements. The entropy is represented only through its jump divided by cvc_vcv​, which is all the source uses.

Definition code
import Mathlib

namespace AstrophysicalFluidDynamics

/-- Specific enthalpy of a perfect gas with adiabatic exponent `γ`, pressure `p` and density `ρ`:
`h = (γ / (γ - 1)) * (p / ρ)` (Ogilvie 2016, eq. (6.28)). -/
noncomputable def perfectGasEnthalpy (γ p ρ : ℝ) : ℝ :=
  γ / (γ - 1) * (p / ρ)

/-- Square of the adiabatic sound speed, `v_s² = γ p / ρ` (Ogilvie 2016, eq. (4.36)). -/
noncomputable def soundSpeedSq (γ p ρ : ℝ) : ℝ :=
  γ * p / ρ

/-- Adiabatic sound speed `v_s = (γ p / ρ)^{1/2}` (Ogilvie 2016, eq. (4.36)). -/
noncomputable def soundSpeed (γ p ρ : ℝ) : ℝ :=
  Real.sqrt (soundSpeedSq γ p ρ)

/-- Mach number `M = u_x / v_s` of a gas with normal velocity `u`, pressure `p`, density `ρ`
(Ogilvie 2016, eq. (6.29) and Example A.13). -/
noncomputable def machNumber (γ ρ u p : ℝ) : ℝ :=
  u / soundSpeed γ p ρ

/-- Specific internal (thermal) energy of a perfect gas, `e = p / ((γ - 1) ρ)`
(Ogilvie 2016, eq. (2.22)). -/
noncomputable def perfectGasInternalEnergy (γ p ρ : ℝ) : ℝ :=
  p / ((γ - 1) * ρ)

/-- The Rankine–Hugoniot relations (Ogilvie 2016, eqs. (6.27a–c), (A 22)–(A 24)) for a normal,
non-magnetic shock at rest at `x = 0` in a perfect gas with adiabatic exponent `γ`.
The upstream (pre-shock) state is `(ρ₁, u₁, p₁)` and the downstream (post-shock) state is
`(ρ₂, u₂, p₂)`, where `u` is the velocity component normal to the shock. The three conditions
are continuity of the mass flux `ρ u`, of the momentum flux `ρ u² + p`, and of the energy flux
`ρ u (u²/2 + h)` with `h` the perfect-gas enthalpy. -/
def RankineHugoniot (γ ρ₁ u₁ p₁ ρ₂ u₂ p₂ : ℝ) : Prop :=
  ρ₂ * u₂ = ρ₁ * u₁ ∧
  ρ₂ * u₂ ^ 2 + p₂ = ρ₁ * u₁ ^ 2 + p₁ ∧
  ρ₂ * u₂ * (u₂ ^ 2 / 2 + perfectGasEnthalpy γ p₂ ρ₂) =
    ρ₁ * u₁ * (u₁ ^ 2 / 2 + perfectGasEnthalpy γ p₁ ρ₁)

/-- Entropy jump across the shock divided by `c_v`, `[s]₁² / c_v = ln(p₂/p₁) - γ ln(ρ₂/ρ₁)`,
computed from the specific entropy of a perfect gas `s = c_p (γ⁻¹ ln p - ln ρ) + const`
(Ogilvie 2016, §11.6.2) together with `c_p = γ c_v` (eq. (2.17)). -/
noncomputable def entropyJumpOverCv (γ ρ₁ p₁ ρ₂ p₂ : ℝ) : ℝ :=
  Real.log (p₂ / p₁) - γ * Real.log (ρ₂ / ρ₁)

/-- Shock density (compression) ratio as a function of the upstream Mach number `M₁`,
`(γ + 1) M₁² / ((γ - 1) M₁² + 2)` (Ogilvie 2016, eq. (6.30a)). -/
noncomputable def shockDensityRatio (γ M₁ : ℝ) : ℝ :=
  (γ + 1) * M₁ ^ 2 / ((γ - 1) * M₁ ^ 2 + 2)

/-- Shock pressure ratio as a function of the upstream Mach number `M₁`,
`(2 γ M₁² - (γ - 1)) / (γ + 1)` (Ogilvie 2016, eq. (6.30b)). -/
noncomputable def shockPressureRatio (γ M₁ : ℝ) : ℝ :=
  (2 * γ * M₁ ^ 2 - (γ - 1)) / (γ + 1)

/-- Square of the downstream Mach number as a function of the upstream Mach number `M₁`,
`(2 + (γ - 1) M₁²) / (2 γ M₁² - (γ - 1))` (Ogilvie 2016, eq. (6.31)). -/
noncomputable def shockDownstreamMachSq (γ M₁ : ℝ) : ℝ :=
  (2 + (γ - 1) * M₁ ^ 2) / (2 * γ * M₁ ^ 2 - (γ - 1))

end AstrophysicalFluidDynamics
Source
G. I. Ogilvie, *Astrophysical fluid dynamics* (lecture notes), J. Plasma Phys. 82 (2016) 205820301, https://doi.org/10.1017/S0022377816000489, §2.8 eq. (2.22) p. 9; §4.5 eq. (4.36) p. 24; §6.3.1–6.3.2 eqs. (6.27)–(6.31) pp. 37–39; §11.6.2 (entropy of a perfect gas); Example A.13 eqs. (A 22)–(A 28) pp. 89–90
Read-back

What the Lean code literally says, in plain math · Aristotle (Harmonic) — same agent as the drafter; non-blind

Read-back disclosure — NOT blind, NOT independent. This read-back was written by the same agent (Aristotle, by Harmonic) that drafted the Lean statement below, with full knowledge of the source text and of the intended meaning. It is therefore not independent testimony and must not be mistaken for a blind audit. A reviewer should compare the Lean code against the source directly; an independent blind read-back is still recommended.

The file introduces, inside the namespace AstrophysicalFluidDynamics, the following real-valued functions and one predicate (all arguments are real numbers; division by 000 returns 000, ln⁡x\ln xlnx returns 000 for x=0x=0x=0 and ln⁡x=ln⁡∣x∣\ln x = \ln|x|lnx=ln∣x∣ for x<0x<0x<0, and x=0\sqrt{x} = 0x​=0 for x≤0x \le 0x≤0):

  1. perfectGasEnthalpy(γ,p,ρ)=γγ−1⋅pρ\mathrm{perfectGasEnthalpy}(\gamma,p,\rho) = \dfrac{\gamma}{\gamma-1}\cdot\dfrac{p}{\rho}perfectGasEnthalpy(γ,p,ρ)=γ−1γ​⋅ρp​.
  2. soundSpeedSq(γ,p,ρ)=γpρ\mathrm{soundSpeedSq}(\gamma,p,\rho) = \dfrac{\gamma p}{\rho}soundSpeedSq(γ,p,ρ)=ργp​.
  3. soundSpeed(γ,p,ρ)=γp/ρ\mathrm{soundSpeed}(\gamma,p,\rho) = \sqrt{\gamma p/\rho}soundSpeed(γ,p,ρ)=γp/ρ​ (real square root, 000 on non-positive input).
  4. machNumber(γ,ρ,u,p)=u / γp/ρ\mathrm{machNumber}(\gamma,\rho,u,p) = u \,/\, \sqrt{\gamma p/\rho}machNumber(γ,ρ,u,p)=u/γp/ρ​ (note the argument order γ,ρ,u,p\gamma,\rho,u,pγ,ρ,u,p, while the sound-speed functions take γ,p,ρ\gamma,p,\rhoγ,p,ρ).
  5. perfectGasInternalEnergy(γ,p,ρ)=p(γ−1)ρ\mathrm{perfectGasInternalEnergy}(\gamma,p,\rho) = \dfrac{p}{(\gamma-1)\rho}perfectGasInternalEnergy(γ,p,ρ)=(γ−1)ρp​.
  6. The proposition RankineHugoniot(γ,ρ1,u1,p1,ρ2,u2,p2)\mathrm{RankineHugoniot}(\gamma,\rho_1,u_1,p_1,\rho_2,u_2,p_2)RankineHugoniot(γ,ρ1​,u1​,p1​,ρ2​,u2​,p2​) is the conjunction of the three equalities
ρ2u2=ρ1u1,ρ2u22+p2=ρ1u12+p1,\rho_2u_2 = \rho_1u_1,\qquad \rho_2u_2^2+p_2 = \rho_1u_1^2+p_1,ρ2​u2​=ρ1​u1​,ρ2​u22​+p2​=ρ1​u12​+p1​, ρ2u2(u222+γγ−1⋅p2ρ2)=ρ1u1(u122+γγ−1⋅p1ρ1).\rho_2u_2\Big(\frac{u_2^2}{2}+\frac{\gamma}{\gamma-1}\cdot\frac{p_2}{\rho_2}\Big) = \rho_1u_1\Big(\frac{u_1^2}{2}+\frac{\gamma}{\gamma-1}\cdot\frac{p_1}{\rho_1}\Big).ρ2​u2​(2u22​​+γ−1γ​⋅ρ2​p2​​)=ρ1​u1​(2u12​​+γ−1γ​⋅ρ1​p1​​).

No sign, positivity or non-degeneracy condition is built into the predicate; in particular any state paired with itself satisfies it. 7. entropyJumpOverCv(γ,ρ1,p1,ρ2,p2)=ln⁡(p2/p1)−γln⁡(ρ2/ρ1)\mathrm{entropyJumpOverCv}(\gamma,\rho_1,p_1,\rho_2,p_2) = \ln(p_2/p_1) - \gamma\ln(\rho_2/\rho_1)entropyJumpOverCv(γ,ρ1​,p1​,ρ2​,p2​)=ln(p2​/p1​)−γln(ρ2​/ρ1​). 8. shockDensityRatio(γ,M)=(γ+1)M2(γ−1)M2+2\mathrm{shockDensityRatio}(\gamma,M) = \dfrac{(\gamma+1)M^2}{(\gamma-1)M^2+2}shockDensityRatio(γ,M)=(γ−1)M2+2(γ+1)M2​. 9. shockPressureRatio(γ,M)=2γM2−(γ−1)γ+1\mathrm{shockPressureRatio}(\gamma,M) = \dfrac{2\gamma M^2-(\gamma-1)}{\gamma+1}shockPressureRatio(γ,M)=γ+12γM2−(γ−1)​. 10. shockDownstreamMachSq(γ,M)=2+(γ−1)M22γM2−(γ−1)\mathrm{shockDownstreamMachSq}(\gamma,M) = \dfrac{2+(\gamma-1)M^2}{2\gamma M^2-(\gamma-1)}shockDownstreamMachSq(γ,M)=2γM2−(γ−1)2+(γ−1)M2​ (equal to 000 when the denominator vanishes).

No theorems or hypotheses are stated in this file; it contains only these definitions.

Human review
  • Endorsed by Shuze Chen · Oct 8, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Lucas · Oct 8, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me