chars
int64
40
24k
content_type
stringclasses
9 values
id
stringlengths
13
64
source
stringclasses
5 values
subset
stringclasses
31 values
text
stringlengths
40
24k
525
leanexplore_declaration
leanexplore:377596
leanexplore_sqlite
leanexplore_declarations
instance : CommGroup Dimension where mul_assoc a b c := by ext all_goals simp only [length_mul, time_mul, mass_mul, charge_mul, temperature_mul] ring one_mul a := by ext all_goals simp mul_one a := by ext all_goals simp inv d := ⟨-d.length, -d.time, -d.mass, -d.ch...
72
leanexplore_declaration
leanexplore:377597
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma inv_length (d : Dimension) : d⁻¹.length = -d.length := rfl
66
leanexplore_declaration
leanexplore:377598
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma inv_time (d : Dimension) : d⁻¹.time = -d.time := rfl
66
leanexplore_declaration
leanexplore:377599
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma inv_mass (d : Dimension) : d⁻¹.mass = -d.mass := rfl
72
leanexplore_declaration
leanexplore:377600
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma inv_charge (d : Dimension) : d⁻¹.charge = -d.charge := rfl
87
leanexplore_declaration
leanexplore:377601
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma inv_temperature (d : Dimension) : d⁻¹.temperature = -d.temperature := rfl
146
leanexplore_declaration
leanexplore:377602
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma div_length (d1 d2 : Dimension) : (d1 / d2).length = d1.length - d2.length := by rw [div_eq_mul_inv, length_mul, inv_length] ring
134
leanexplore_declaration
leanexplore:377603
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma div_time (d1 d2 : Dimension) : (d1 / d2).time = d1.time - d2.time := by rw [div_eq_mul_inv, time_mul, inv_time] ring
134
leanexplore_declaration
leanexplore:377604
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma div_mass (d1 d2 : Dimension) : (d1 / d2).mass = d1.mass - d2.mass := by rw [div_eq_mul_inv, mass_mul, inv_mass] ring
146
leanexplore_declaration
leanexplore:377605
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma div_charge (d1 d2 : Dimension) : (d1 / d2).charge = d1.charge - d2.charge := by rw [div_eq_mul_inv, charge_mul, inv_charge] ring
180
leanexplore_declaration
leanexplore:377606
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma div_temperature (d1 d2 : Dimension) : (d1 / d2).temperature = d1.temperature - d2.temperature := by rw [div_eq_mul_inv, temperature_mul, inv_temperature] ring
181
leanexplore_declaration
leanexplore:377607
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma npow_length (d : Dimension) (n : ℕ) : (d ^ n).length = n • d.length := by induction n with | zero => simp | succ n ih => rw [@pow_add] simp [ih] ring
175
leanexplore_declaration
leanexplore:377608
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma npow_time (d : Dimension) (n : ℕ) : (d ^ n).time = n • d.time := by induction n with | zero => simp | succ n ih => rw [@pow_add] simp [ih] ring
175
leanexplore_declaration
leanexplore:377609
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma npow_mass (d : Dimension) (n : ℕ) : (d ^ n).mass = n • d.mass := by induction n with | zero => simp | succ n ih => rw [@pow_add] simp [ih] ring
181
leanexplore_declaration
leanexplore:377610
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma npow_charge (d : Dimension) (n : ℕ) : (d ^ n).charge = n • d.charge := by induction n with | zero => simp | succ n ih => rw [@pow_add] simp [ih] ring
196
leanexplore_declaration
leanexplore:377611
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma npow_temperature (d : Dimension) (n : ℕ) : (d ^ n).temperature = n • d.temperature := by induction n with | zero => simp | succ n ih => rw [@pow_add] simp [ih] ring
117
leanexplore_declaration
leanexplore:377612
leanexplore_sqlite
leanexplore_declarations
instance : Pow Dimension ℚ where pow d n := ⟨d.length * n, d.time * n, d.mass * n, d.charge * n, d.temperature * n⟩
83
leanexplore_declaration
leanexplore:377613
leanexplore_sqlite
leanexplore_declarations
/-- The dimension corresponding to length. -/ def L𝓭 : Dimension := ⟨1, 0, 0, 0, 0⟩
49
leanexplore_declaration
leanexplore:377614
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma L𝓭_length : L𝓭.length = 1 := by rfl
45
leanexplore_declaration
leanexplore:377615
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma L𝓭_time : L𝓭.time = 0 := by rfl
45
leanexplore_declaration
leanexplore:377616
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma L𝓭_mass : L𝓭.mass = 0 := by rfl
49
leanexplore_declaration
leanexplore:377617
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma L𝓭_charge : L𝓭.charge = 0 := by rfl
59
leanexplore_declaration
leanexplore:377618
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma L𝓭_temperature : L𝓭.temperature = 0 := by rfl
81
leanexplore_declaration
leanexplore:377619
leanexplore_sqlite
leanexplore_declarations
/-- The dimension corresponding to time. -/ def T𝓭 : Dimension := ⟨0, 1, 0, 0, 0⟩
49
leanexplore_declaration
leanexplore:377620
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma T𝓭_length : T𝓭.length = 0 := by rfl
45
leanexplore_declaration
leanexplore:377621
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma T𝓭_time : T𝓭.time = 1 := by rfl
45
leanexplore_declaration
leanexplore:377622
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma T𝓭_mass : T𝓭.mass = 0 := by rfl
49
leanexplore_declaration
leanexplore:377623
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma T𝓭_charge : T𝓭.charge = 0 := by rfl
59
leanexplore_declaration
leanexplore:377624
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma T𝓭_temperature : T𝓭.temperature = 0 := by rfl
81
leanexplore_declaration
leanexplore:377625
leanexplore_sqlite
leanexplore_declarations
/-- The dimension corresponding to mass. -/ def M𝓭 : Dimension := ⟨0, 0, 1, 0, 0⟩
83
leanexplore_declaration
leanexplore:377626
leanexplore_sqlite
leanexplore_declarations
/-- The dimension corresponding to charge. -/ def C𝓭 : Dimension := ⟨0, 0, 0, 1, 0⟩
88
leanexplore_declaration
leanexplore:377627
leanexplore_sqlite
leanexplore_declarations
/-- The dimension corresponding to temperature. -/ def Θ𝓭 : Dimension := ⟨0, 0, 0, 0, 1⟩
131
leanexplore_declaration
leanexplore:377628
leanexplore_sqlite
leanexplore_declarations
/-- The length corresponding to 400 meters. -/ noncomputable def meters400 : Dimensionful (WithDim L𝓭 ℝ) := toDimensionful SI ⟨400⟩
227
leanexplore_declaration
leanexplore:377629
leanexplore_sqlite
leanexplore_declarations
/-- An example of dimensions corresponding to `E = m c^2` using `WithDim`. -/ def EnergyMassWithDim' (m : WithDim M𝓭 ℝ) (E : WithDim (M𝓭 * L𝓭 * L𝓭 * T𝓭⁻¹ * T𝓭⁻¹) ℝ) (c : WithDim (L𝓭 * T𝓭⁻¹) ℝ) : Prop := E = cast (m * c * c)
139
leanexplore_declaration
leanexplore:377630
leanexplore_sqlite
leanexplore_declarations
lemma energyMassWithDim'_isDimensionallyCorrect : IsDimensionallyCorrect EnergyMassWithDim' := by simp [funext_iff, EnergyMassWithDim']
230
leanexplore_declaration
leanexplore:377631
leanexplore_sqlite
leanexplore_declarations
/-- An example of dimensions corresponding to `F = m a` using `WithDim`. -/ def NewtonsSecondWithDim' (m : WithDim M𝓭 ℝ) (F : WithDim (M𝓭 * L𝓭 * T𝓭⁻¹ * T𝓭⁻¹) ℝ) (a : WithDim (L𝓭 * T𝓭⁻¹ * T𝓭⁻¹) ℝ) : Prop := F = cast (m * a)
148
leanexplore_declaration
leanexplore:377632
leanexplore_sqlite
leanexplore_declarations
lemma newtonsSecondWithDim'_isDimensionallyCorrect : IsDimensionallyCorrect NewtonsSecondWithDim' := by simp [funext_iff, NewtonsSecondWithDim']
182
leanexplore_declaration
leanexplore:377633
leanexplore_sqlite
leanexplore_declarations
/-- An example of dimensions corresponding to `s = d/t` using `WithDim`. -/ def SpeedEq (s : WithDim (L𝓭 * T𝓭⁻¹) ℝ) (d : WithDim L𝓭 ℝ) (t : WithDim T𝓭 ℝ) : Prop := s = cast (d / t)
104
leanexplore_declaration
leanexplore:377634
leanexplore_sqlite
leanexplore_declarations
lemma speedEq_isDimensionallyCorrect : IsDimensionallyCorrect SpeedEq := by simp [funext_iff, SpeedEq]
288
leanexplore_declaration
leanexplore:377635
leanexplore_sqlite
leanexplore_declarations
/-- An example with complicated dimensions. -/ def OddDimensions (m1 m2 : WithDim (M𝓭) ℝ) (θ : WithDim Θ𝓭 ℝ) (I1 I2 : WithDim (C𝓭/T𝓭) ℝ) (d : WithDim L𝓭 ℝ) (t : WithDim T𝓭 ℝ) (X : WithDim (L𝓭 * T𝓭⁻¹ ^ 3 * Θ𝓭⁻¹ * C𝓭 ^2) ℝ) : Prop := X = cast (m1 * (d / t) / (m2 * θ) * I2 * I1)
122
leanexplore_declaration
leanexplore:377636
leanexplore_sqlite
leanexplore_declarations
lemma oddDimensions_isDimensionallyCorrect : IsDimensionallyCorrect OddDimensions := by simp [funext_iff, OddDimensions]
239
leanexplore_declaration
leanexplore:377637
leanexplore_sqlite
leanexplore_declarations
/-- An example of dimensions corresponding to `E = m c^2` using `WithDim` with `.val`. -/ def EnergyMassWithDim (m : WithDim M𝓭 ℝ) (E : WithDim (M𝓭 * L𝓭 * L𝓭 * T𝓭⁻¹ * T𝓭⁻¹) ℝ) (c : WithDim (L𝓭 * T𝓭⁻¹) ℝ) : Prop := E.1 = m.1 * c.1 ^ 2
199
leanexplore_declaration
leanexplore:377638
leanexplore_sqlite
leanexplore_declarations
lemma energyMassWithDim_isDimensionallyCorrect : IsDimensionallyCorrect EnergyMassWithDim := by simp [funext_iff, EnergyMassWithDim] intros rw [WithDim.scaleUnit_val_eq_scaleUnit_val_of_dim_eq]
238
leanexplore_declaration
leanexplore:377639
leanexplore_sqlite
leanexplore_declarations
/-- An example of dimensions corresponding to `F = m a` using `WithDim` with `.val`. -/ def NewtonsSecondWithDim (m : WithDim M𝓭 ℝ) (F : WithDim (M𝓭 * L𝓭 * T𝓭⁻¹ * T𝓭⁻¹) ℝ) (a : WithDim (L𝓭 * T𝓭⁻¹ * T𝓭⁻¹) ℝ) : Prop := F.1 = m.1 * a.1
212
leanexplore_declaration
leanexplore:377640
leanexplore_sqlite
leanexplore_declarations
lemma newtonsSecondWithDim_isDimensionallyCorrect : IsDimensionallyCorrect NewtonsSecondWithDim := by simp [funext_iff, NewtonsSecondWithDim] intros rw [WithDim.scaleUnit_val_eq_scaleUnit_val_of_dim_eq]
274
leanexplore_declaration
leanexplore:377641
leanexplore_sqlite
leanexplore_declarations
/-- An example of dimensions corresponding to `E = m c` using `WithDim` with `.val`, which is not dimensionally correct. -/ def EnergyMassWithDimNot (m : WithDim M𝓭 ℝ) (E : WithDim (M𝓭 * L𝓭 * L𝓭 * T𝓭⁻¹ * T𝓭⁻¹) ℝ) (c : WithDim (L𝓭 * T𝓭⁻¹) ℝ) : Prop := E.1 = m.1 * c.1
491
leanexplore_declaration
leanexplore:377642
leanexplore_sqlite
leanexplore_declarations
lemma energyMassWithDimNot_not_isDimensionallyCorrect : ¬ IsDimensionallyCorrect EnergyMassWithDimNot := by simp only [isDimensionallyCorrect_fun_iff, not_forall, funext_iff, scaleUnit_apply_fun] /- We show that `EnergyMassWithDimNot` is not dimensionally correct by changing from `SI` to `SIPrimed` with val...
312
leanexplore_declaration
leanexplore:377643
leanexplore_sqlite
leanexplore_declarations
/-- The equation `E = m c^2`, in this equation we `E` and `m` are implicitly in the units `u`, while the speed of light is explicitly written in those units. -/ def EnergyMass (m : WithDim M𝓭 ℝ) (E : WithDim (M𝓭 * L𝓭 * L𝓭 * T𝓭⁻¹ * T𝓭⁻¹) ℝ) (u : UnitChoices) : Prop := E.1 = m.1 * (speedOfLight u).1 ^ 2
311
leanexplore_declaration
leanexplore:377644
leanexplore_sqlite
leanexplore_declarations
/-- The equation `E = m c^2`, in this version everything is written explicitly in terms of a choice of units. -/ def EnergyMass' (m : Dimensionful (WithDim M𝓭 ℝ)) (E : Dimensionful (WithDim (M𝓭 * L𝓭 * L𝓭 * T𝓭⁻¹ * T𝓭⁻¹) ℝ)) (u : UnitChoices) : Prop := (E.1 u).1 = (m.1 u).1 * (speedOfLight u).1 ^ 2
1,837
leanexplore_declaration
leanexplore:377645
leanexplore_sqlite
leanexplore_declarations
/-- The lemma that the proposition `EnergyMass` is dimensionally correct-/ lemma energyMass_isDimensionallyCorrect : IsDimensionallyCorrect EnergyMass := by /- Scale such that the unit u1 is taken to u2. -/ intro u1 u2 /- Let `m` be the mass, `E` be the energy and `u` be the actual units we start with. -/ f...
216
leanexplore_declaration
leanexplore:377646
leanexplore_sqlite
leanexplore_declarations
lemma example1_energyMass : EnergyMass ⟨2⟩ ⟨2 * 299792458 ^ 2⟩ SI := by simp only [EnergyMass, mul_eq_mul_left_iff, OfNat.ofNat_ne_zero, or_false] simp [speedOfLight, toDimensionful_apply_apply, dimScale, SI]
502
leanexplore_declaration
leanexplore:377647
leanexplore_sqlite
leanexplore_declarations
lemma example2_energyMass (u : UnitChoices) : EnergyMass (scaleUnit SI u ⟨2⟩) (scaleUnit SI u ⟨2 * 299792458 ^ 2⟩) u := by conv_rhs => rw [← UnitChoices.scaleUnit_apply_fst SI u] have h1 := congrFun (congrFun (congrFun (energyMass_isDimensionallyCorrect SI u) (scaleUnit SI u ⟨2⟩)) (scaleUnit SI u ⟨2 * 2...
164
leanexplore_declaration
leanexplore:377648
leanexplore_sqlite
leanexplore_declarations
/-- An example of a dimensionally correct result using functions. -/ def CosDim (t : WithDim T𝓭 ℝ) (ω : WithDim T𝓭⁻¹ ℝ) (a : ℝ) : Prop := Real.cos (ω.1 * t.1) = a
101
leanexplore_declaration
leanexplore:377649
leanexplore_sqlite
leanexplore_declarations
lemma cosDim_isDimensionallyCorrect : IsDimensionallyCorrect CosDim := by simp [funext_iff, CosDim]
520
leanexplore_declaration
leanexplore:377650
leanexplore_sqlite
leanexplore_declarations
lemma fderiv_apply_scaleUnit (u1 u2 : UnitChoices) (x dm : M1) (f : M1 → M2) (hf : IsDimensionallyCorrect f) (f_diff : Differentiable ℝ f) : fderiv ℝ f (scaleUnit u2 u1 x) dm = u2.dimScale u1 (dim M2) • u1.dimScale u2 (dim M1) • fderiv ℝ f x dm := by conv_lhs => rw [← hf u2 u1] change (fderiv ℝ ((u2.dim...
483
leanexplore_declaration
leanexplore:377651
leanexplore_sqlite
leanexplore_declarations
/-- If a function is dimensionally valid then so is it's derivative. -/ lemma fderiv_isDimensionallyCorrect (f : M1 → M2) (hf : IsDimensionallyCorrect f) (f_diff : Differentiable ℝ f) : IsDimensionallyCorrect (fderiv ℝ f) := by simp only [isDimensionallyCorrect_fun_iff] intro u1 u2 m ext m' simp only [C...
767
leanexplore_declaration
leanexplore:377652
leanexplore_sqlite
leanexplore_declarations
/-- The expression `fderiv ℝ f x dm = v.1` for a fixed `dm` and for `v` with dimension `d M2 * (d M1)⁻¹` is dimensionally correct. This is the ordinary manifestation of dimensions of a derivative, usually `dm` is taken as e.g. `1`. This result also shows that dimensional correctness does depend on what quantit...
929
leanexplore_declaration
leanexplore:377653
leanexplore_sqlite
leanexplore_declarations
noncomputable instance (M : Type) [NormedAddCommGroup M] [NormedSpace ℝ M] [HasDim M] [MeasurableSpace M] [self : MeasurableConstSMul ℝ M] : MulUnitDependent (MeasureTheory.Measure M) where scaleUnit u1 u2 μ := μ.map (fun m => scaleUnit u1 u2 m) scaleUnit_trans u1 u2 u3 μ := by rw [Measure.map_map...
146
leanexplore_declaration
leanexplore:377654
leanexplore_sqlite
leanexplore_declarations
lemma scaleUnit_measure (u1 u2 : UnitChoices) (μ : MeasureTheory.Measure M) : scaleUnit u1 u2 μ = μ.map (fun m => scaleUnit u1 u2 m) := by rfl
2,621
leanexplore_declaration
leanexplore:377655
leanexplore_sqlite
leanexplore_declarations
/-- The statement that for a measure `μ` of dimension `d`, and a function `f : M → G` of dimension `(CarriesDimension.d G * d⁻¹)` (where `CarriesDimension.d G` is the dimension associated with terms of type `G`), then `∫ x, f x ∂μ ` has the correct dimension, namely `CarriesDimension.d G`. In other words, th...
904
leanexplore_declaration
leanexplore:377656
leanexplore_sqlite
leanexplore_declarations
/-- A type carries the instance `UnitDependent M` if it depends on a choice of units. This dependence is manifested in `scaleUnit u1 u2` which describes how elements of `M` change under a scaling of units which would take `u1` to `u2`. This type is used for functions, and propositions etc. -/ class UnitDependent...
322
leanexplore_declaration
leanexplore:377657
leanexplore_sqlite
leanexplore_declarations
/-- A type `M` with an instance of `UnitDependent M` such that `scaleUnit u1 u2` is compatible with the `MulAction ℝ≥0 M` instance on `M`. -/ class MulUnitDependent (M : Type) [MulAction ℝ≥0 M] extends UnitDependent M where scaleUnit_mul : ∀ u1 u2 (r : ℝ≥0) m, scaleUnit u1 u2 (r • m) = r • scaleUnit u1 u2...
433
leanexplore_declaration
leanexplore:377658
leanexplore_sqlite
leanexplore_declarations
/-- A type `M` with an instance of `UnitDependent M` such that `scaleUnit u1 u2` is compatible with the `Module ℝ M` instance on `M`. -/ class LinearUnitDependent (M : Type) [AddCommMonoid M] [Module ℝ M] extends UnitDependent M where scaleUnit_add : ∀ u1 u2 m1 m2, scaleUnit u1 u2 (m1 + m2) = scaleUnit u1 u2 ...
355
leanexplore_declaration
leanexplore:377659
leanexplore_sqlite
leanexplore_declarations
/-- A type `M` with an instance of `UnitDependent M` such that `scaleUnit u1 u2` is compatible with the `Module ℝ M` instance on `M`, and is continuous. -/ class ContinuousLinearUnitDependent (M : Type) [AddCommMonoid M] [Module ℝ M] [TopologicalSpace M] extends LinearUnitDependent M where scaleUnit_cont : ∀ ...
200
leanexplore_declaration
leanexplore:377660
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma UnitDependent.scaleUnit_symm_apply {M : Type} [UnitDependent M] (u1 u2 : UnitChoices) (m : M) : scaleUnit u2 u1 (scaleUnit u1 u2 m) = m := by rw [scaleUnit_trans, scaleUnit_id]
366
leanexplore_declaration
leanexplore:377661
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma UnitDependent.scaleUnit_injective {M : Type} [UnitDependent M] (u1 u2 : UnitChoices) (m1 m2 : M) : scaleUnit u1 u2 m1 = scaleUnit u1 u2 m2 ↔ m1 = m2 := by constructor · intro h1 have h2 : scaleUnit u2 u1 (scaleUnit u1 u2 m1) = scaleUnit u2 u1 (scaleUnit u1 u2 m2) := by rw [h1] ...
307
leanexplore_declaration
leanexplore:377662
leanexplore_sqlite
leanexplore_declarations
/-- For an `M` with an instance of `UnitDependent M`, `scaleUnit u1 u2` as an equivalence. -/ def UnitDependent.scaleUnitEquiv {M : Type} [UnitDependent M] (u1 u2 : UnitChoices) : M ≃ M where toFun m := scaleUnit u1 u2 m invFun m := scaleUnit u2 u1 m right_inv m := by simp left_inv m := by simp
417
leanexplore_declaration
leanexplore:377663
leanexplore_sqlite
leanexplore_declarations
/-- For an `M` with an instance of `LinearUnitDependent M`, `scaleUnit u1 u2` as a linear map. -/ def LinearUnitDependent.scaleUnitLinear {M : Type} [AddCommMonoid M] [Module ℝ M] [LinearUnitDependent M] (u1 u2 : UnitChoices) : M →ₗ[ℝ] M where toFun m := scaleUnit u1 u2 m map_add' m1 m2 := by simp [Li...
414
leanexplore_declaration
leanexplore:377664
leanexplore_sqlite
leanexplore_declarations
/-- For an `M` with an instance of `LinearUnitDependent M`, `scaleUnit u1 u2` as a linear equivalence. -/ def LinearUnitDependent.scaleUnitLinearEquiv {M : Type} [AddCommMonoid M] [Module ℝ M] [LinearUnitDependent M] (u1 u2 : UnitChoices) : M ≃ₗ[ℝ] M := LinearEquiv.ofLinear (scaleUnitLinear u1 u2) (scaleU...
439
leanexplore_declaration
leanexplore:377665
leanexplore_sqlite
leanexplore_declarations
/-- For an `M` with an instance of `ContinuousLinearUnitDependent M`, `scaleUnit u1 u2` as a continuous linear map. -/ def ContinuousLinearUnitDependent.scaleUnitContLinear {M : Type} [AddCommMonoid M] [Module ℝ M] [TopologicalSpace M] [ContinuousLinearUnitDependent M] (u1 u2 : UnitChoices) : M →L[ℝ] M where ...
521
leanexplore_declaration
leanexplore:377666
leanexplore_sqlite
leanexplore_declarations
/-- For an `M` with an instance of `ContinuousLinearUnitDependent M`, `scaleUnit u1 u2` as a continuous linear equivalence. -/ def ContinuousLinearUnitDependent.scaleUnitContLinearEquiv {M : Type} [AddCommMonoid M] [Module ℝ M] [TopologicalSpace M] [ContinuousLinearUnitDependent M] (u1 u2 : UnitChoices) : M ≃...
316
leanexplore_declaration
leanexplore:377667
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma ContinuousLinearUnitDependent.scaleUnitContLinearEquiv_apply {M : Type} [AddCommGroup M] [Module ℝ M] [TopologicalSpace M] [ContinuousLinearUnitDependent M] (u1 u2 : UnitChoices) (m : M) : (ContinuousLinearUnitDependent.scaleUnitContLinearEquiv u1 u2) m = scaleUnit u1 u2 m := rfl
330
leanexplore_declaration
leanexplore:377668
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma ContinuousLinearUnitDependent.scaleUnitContLinearEquiv_symm_apply {M : Type} [AddCommGroup M] [Module ℝ M] [TopologicalSpace M] [ContinuousLinearUnitDependent M] (u1 u2 : UnitChoices) (m : M) : (ContinuousLinearUnitDependent.scaleUnitContLinearEquiv u1 u2).symm m = scaleUnit u2 u1 m ...
721
leanexplore_declaration
leanexplore:377669
leanexplore_sqlite
leanexplore_declarations
noncomputable instance : UnitDependent UnitChoices where scaleUnit u1 u2 u := ⟨ LengthUnit.scale (u2.length/u1.length) u.length (by simp), TimeUnit.scale (u2.time/u1.time) u.time (by simp), MassUnit.scale (u2.mass/u1.mass) u.mass (by simp), ChargeUnit.scale (u2.charge/u1.charge) u.charge (by s...
405
leanexplore_declaration
leanexplore:377670
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma UnitChoices.scaleUnit_apply_fst (u1 u2 : UnitChoices) : (scaleUnit u1 u2 u1) = u2 := by simp [scaleUnit] apply UnitChoices.ext · simp [LengthUnit.scale, LengthUnit.div_eq_val] · simp [TimeUnit.scale, TimeUnit.div_eq_val] · simp [MassUnit.scale, MassUnit.div_eq_val] · simp [ChargeUnit.scale...
537
leanexplore_declaration
leanexplore:377671
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma UnitChoices.dimScale_scaleUnit {u1 u2 u : UnitChoices} (d : Dimension) : u.dimScale (scaleUnit u1 u2 u) d = u1.dimScale u2 d := by simp [dimScale] congr 1 congr 1 congr 1 congr 1 · congr 1 simp [scaleUnit] simp [LengthUnit.div_eq_val] · congr 1 simp [scaleUnit] simp [Time...
237
leanexplore_declaration
leanexplore:377672
leanexplore_sqlite
leanexplore_declarations
lemma Dimensionful.of_scaleUnit {M : Type} [CarriesDimension M] {u1 u2 u : UnitChoices} (c : Dimensionful M) : c.1 (scaleUnit u1 u2 u) = u1.dimScale u2 (dim M) • c.1 (u) := by rw [c.2 u (scaleUnit u1 u2 u)] congr 1 simp
549
leanexplore_declaration
leanexplore:377673
leanexplore_sqlite
leanexplore_declarations
noncomputable instance {M1 : Type} [CarriesDimension M1] : MulUnitDependent M1 where scaleUnit u1 u2 m := (toDimensionful u1 m).1 u2 scaleUnit_trans u1 u2 u3 m := by simp [toDimensionful] rw [smul_smul, mul_comm, UnitChoices.dimScale_transitive] scaleUnit_trans' u1 u2 u3 m := by simp [toDimensionful, ...
202
leanexplore_declaration
leanexplore:377674
leanexplore_sqlite
leanexplore_declarations
lemma HasDim.scaleUnit_apply {M : Type} [CarriesDimension M] (u1 u2 : UnitChoices) (m : M) : scaleUnit u1 u2 m = (u1.dimScale u2 (dim M)) • m := by simp [scaleUnit, toDimensionful_apply_apply]
390
leanexplore_declaration
leanexplore:377675
leanexplore_sqlite
leanexplore_declarations
noncomputable instance {M : Type} [AddCommMonoid M] [Module ℝ M] [HasDim M] : LinearUnitDependent M where scaleUnit_add u1 u2 m1 m2 := by change (toDimensionful u1 (m1 + m2)).1 u2 = _ rw [toDimensionful_apply_apply] simp rfl scaleUnit_smul u1 u2 r m := by change (toDimensionful u1 (r • m)).1...
445
leanexplore_declaration
leanexplore:377676
leanexplore_sqlite
leanexplore_declarations
noncomputable instance {M : Type} [AddCommMonoid M] [Module ℝ M] [HasDim M] [TopologicalSpace M] [ContinuousConstSMul ℝ M] : ContinuousLinearUnitDependent M where scaleUnit_cont u1 u2 := by change Continuous fun m => (toDimensionful u1 m).1 u2 conv => enter [1, m] rw [toDimensionful_apply_...
403
leanexplore_declaration
leanexplore:377677
leanexplore_sqlite
leanexplore_declarations
noncomputable instance {M1 M2 : Type} [UnitDependent M2] : UnitDependent (M1 → M2) where scaleUnit u1 u2 f := fun m1 => scaleUnit u1 u2 (f m1) scaleUnit_trans u1 u2 u3 f := by funext m1 exact scaleUnit_trans u1 u2 u3 (f m1) scaleUnit_trans' u1 u2 u3 f := by funext m1 exact scaleUnit_trans' u1 ...
196
leanexplore_declaration
leanexplore:377678
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma UnitDependent.scaleUnit_apply_fun_right {M1 M2 : Type} [UnitDependent M2] (u1 u2 : UnitChoices) (f : M1 → M2) (m1 : M1) : scaleUnit u1 u2 f m1 = scaleUnit u1 u2 (f m1) := rfl
721
leanexplore_declaration
leanexplore:377679
leanexplore_sqlite
leanexplore_declarations
noncomputable instance {M1 M2 : Type} [AddCommMonoid M1] [Module ℝ M1] [AddCommMonoid M2] [Module ℝ M2] [LinearUnitDependent M2] : LinearUnitDependent (M1 →ₗ[ℝ] M2) where scaleUnit u1 u2 f := { toFun m1 := scaleUnit u1 u2 (f m1) map_add' m1 m2 := by simp [scaleUnit_add] map_smul' := by simp ...
908
leanexplore_declaration
leanexplore:377680
leanexplore_sqlite
leanexplore_declarations
noncomputable instance {M1 M2 : Type} [AddCommGroup M1] [Module ℝ M1] [TopologicalSpace M1] [AddCommGroup M2] [Module ℝ M2] [TopologicalSpace M2] [ContinuousConstSMul ℝ M2] [IsTopologicalAddGroup M2] [ContinuousLinearUnitDependent M2] : ContinuousLinearUnitDependent (M1 →L[ℝ] M2) where scaleUnit u...
365
leanexplore_declaration
leanexplore:377681
leanexplore_sqlite
leanexplore_declarations
noncomputable instance {M1 M2 : Type} [UnitDependent M1] : UnitDependent (M1 → M2) where scaleUnit u1 u2 f := fun m1 => f (scaleUnit u2 u1 m1) scaleUnit_trans u1 u2 u3 f := by funext m1 simp [scaleUnit_trans] scaleUnit_trans' u1 u2 u3 f := by funext m1 simp [scaleUnit_trans'] scaleUnit_id u ...
195
leanexplore_declaration
leanexplore:377682
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma UnitDependent.scaleUnit_apply_fun_left {M1 M2 : Type} [UnitDependent M1] (u1 u2 : UnitChoices) (f : M1 → M2) (m1 : M1) : scaleUnit u1 u2 f m1 = f (scaleUnit u2 u1 m1) := rfl
432
leanexplore_declaration
leanexplore:377683
leanexplore_sqlite
leanexplore_declarations
noncomputable instance instUnitDependentTwoSided {M1 M2 : Type} [UnitDependent M1] [UnitDependent M2] : UnitDependent (M1 → M2) where scaleUnit u1 u2 f := fun m1 => scaleUnit u1 u2 (f (scaleUnit u2 u1 m1)) scaleUnit_trans u1 u2 u3 f := by funext m1 simp [scaleUnit_trans] scaleUnit_trans' u1 u2 u3 ...
227
leanexplore_declaration
leanexplore:377684
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma UnitDependent.scaleUnit_apply_fun {M1 M2 : Type} [UnitDependent M1] [UnitDependent M2] (u1 u2 : UnitChoices) (f : M1 → M2) (m1 : M1) : scaleUnit u1 u2 f m1 = scaleUnit u1 u2 (f (scaleUnit u2 u1 m1)) := rfl
548
leanexplore_declaration
leanexplore:377685
leanexplore_sqlite
leanexplore_declarations
noncomputable instance instUnitDependentTwoSidedMul {M1 M2 : Type} [UnitDependent M1] [MulAction ℝ≥0 M2] [MulUnitDependent M2] : MulUnitDependent (M1 → M2) where scaleUnit u1 u2 f := fun m1 => scaleUnit u1 u2 (f (scaleUnit u2 u1 m1)) scaleUnit_trans u1 u2 u3 f := by funext m1 simp [scaleUnit_trans] ...
945
leanexplore_declaration
leanexplore:377686
leanexplore_sqlite
leanexplore_declarations
noncomputable instance instContinuousLinearUnitDependentMap {M1 M2 : Type} [AddCommGroup M1] [Module ℝ M1] [TopologicalSpace M1] [ContinuousLinearUnitDependent M1] [AddCommGroup M2] [Module ℝ M2] [TopologicalSpace M2] [ContinuousConstSMul ℝ M2] [IsTopologicalAddGroup M2] [ContinuousLinearUnitDepende...
467
leanexplore_declaration
leanexplore:377687
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma ContinuousLinearUnitDependent.scaleUnit_apply_fun {M1 M2 : Type} [AddCommGroup M1] [Module ℝ M1] [TopologicalSpace M1] [ContinuousLinearUnitDependent M1] [AddCommGroup M2] [Module ℝ M2] [TopologicalSpace M2] [ContinuousConstSMul ℝ M2] [IsTopologicalAddGroup M2] [ContinuousLinearUnitDep...
634
leanexplore_declaration
leanexplore:377688
leanexplore_sqlite
leanexplore_declarations
/-- A term of type `M` carrying an instance of `UnitDependent M` is said to be dimensionally correct if under a change of units it remains the same. More colloquially, something is dimensionally correct if it (e.g. it's value or its truth for a proposition) does not depend on the units it is written in. For t...
163
leanexplore_declaration
leanexplore:377689
leanexplore_sqlite
leanexplore_declarations
lemma isDimensionallyCorrect_iff {M : Type} [UnitDependent M] (m : M) : IsDimensionallyCorrect m ↔ ∀ u1 u2 : UnitChoices, scaleUnit u1 u2 m = m := by rfl
374
leanexplore_declaration
leanexplore:377690
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma isDimensionallyCorrect_fun_iff {M1 M2 : Type} [UnitDependent M1] [UnitDependent M2] {f : M1 → M2} : IsDimensionallyCorrect f ↔ ∀ u1 u2 : UnitChoices, ∀ m, scaleUnit u1 u2 (f (scaleUnit u2 u1 m)) = f m := by constructor · intro h u1 u2 m have h1 := h u1 u2 conv_rhs => rw [← h1] ...
340
leanexplore_declaration
leanexplore:377691
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma isDimensionallyCorrect_fun_left {M1 M2 : Type} [UnitDependent M1] {f : M1 → M2} : IsDimensionallyCorrect f ↔ ∀ u1 u2 : UnitChoices, ∀ m, (f (scaleUnit u2 u1 m)) = f m := by constructor · intro h u1 u2 m have h1 := h u1 u2 conv_rhs => rw [← h1] rfl · intro h u1 u2 funext m...
343
leanexplore_declaration
leanexplore:377692
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma isDimensionallyCorrect_fun_right {M1 M2 : Type} [UnitDependent M2] {f : M1 → M2} : IsDimensionallyCorrect f ↔ ∀ u1 u2 : UnitChoices, ∀ m, scaleUnit u1 u2 (f m) = f m := by constructor · intro h u1 u2 m have h1 := h u1 u2 conv_rhs => rw [← h1] rfl · intro h u1 u2 funext m ...
383
leanexplore_declaration
leanexplore:377693
leanexplore_sqlite
leanexplore_declarations
/-- The multiplication of an element of `M1` with an element of `M2` to get an element of `M3` in such a way that dimensions are preserved. -/ class DMul (M1 M2 M3 : Type) [CarriesDimension M1] [CarriesDimension M2] [CarriesDimension M3] extends HMul M1 M2 M3 where mul_dim : ∀ (m1 : Dimensionful M1) (m2 : Dimen...
483
leanexplore_declaration
leanexplore:377694
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma DMul.hMul_scaleUnit {M1 M2 M3 : Type} [CarriesDimension M1] [CarriesDimension M2] [CarriesDimension M3] [DMul M1 M2 M3] (m1 : M1) (m2 : M2) (u1 u2 : UnitChoices) : (scaleUnit u1 u2 m1) * (scaleUnit u1 u2 m2) = scaleUnit u1 u2 (m1 * m2) := by simp [scaleUnit, toDimensionful] have h1 := ...
349
leanexplore_declaration
leanexplore:377695
leanexplore_sqlite
leanexplore_declarations
/-- Given a type `M` that depends on units, e.g. the function type `M1 → M2` between two types carrying a dimension, the subtype of `M` which scales according to the dimension `d`. -/ def DimSet (M : Type) [MulAction ℝ≥0 M] [MulUnitDependent M] (d : Dimension) : Set M := {m : M | ∀ u1 u2, scaleUnit u1 u2 m = (UnitC...