Zulip Chat Archive

Stream: new members

Topic: Mul of pos is pos


Rida Hamadani (Aug 28 2024 at 04:28):

I'm proving that composition of orientation preserving maps is orientation preserving, and the part I'm having trouble with is, believe it or not, proving that the product of two positives is a positive.

import Mathlib.Geometry.Manifold.SmoothManifoldWithCorners

variable (๐•œ : Type*) [NormedAddCommGroup ๐•œ] [NontriviallyNormedField ๐•œ] [LT ๐•œ] {H : Type*}
  [NormedAddCommGroup H] [NormedSpace ๐•œ H] [Preorder ๐•œ] [PosMulStrictMono ๐•œ]

def OrientationPreserving (f : H โ†’ H) (s : Set H) : Prop :=
  โˆ€ x โˆˆ s, 0 < (fderiv ๐•œ f x).det

lemma orientationPreserving_comp (f g : H โ†’ H) (u v : Set H) (hf : OrientationPreserving ๐•œ f u)
    (hg : OrientationPreserving ๐•œ g v) : OrientationPreserving ๐•œ (g โˆ˜ f) (u โˆฉ f โปยน' v) := by
  dsimp [OrientationPreserving] at *
  intro x โŸจhxu, hxvโŸฉ
  rw [fderiv.comp _ _ _]
  ยท have hโ‚ : 0 < (fderiv ๐•œ f x).det := hf x hxu
    have hโ‚‚ : 0 < (fderiv ๐•œ g (f x)).det := hg (f x) hxv
    unfold ContinuousLinearMap.det ContinuousLinearMap.comp
    rw [(fderiv ๐•œ g (f x)).toLinearMap.det_comp (fderiv ๐•œ f x).toLinearMap]
    exact mul_pos hโ‚‚ hโ‚
  ยท sorry
  ยท sorry

Ignore the last 2 sorries, in the exact mul_pos hโ‚‚ hโ‚ line, I'm running into a problem with a metavariable, although I've added instances to ๐•œ so that I can use mul_pos. How can I fix this?

Daniel Weber (Aug 28 2024 at 04:37):

Using convert instead of exact can often show the problem in these cases. Here, you have a diamond with the LT instance on ๐•œ and the one obtained from the Preorder, which aren't necessarily equal

Daniel Weber (Aug 28 2024 at 04:37):

Removing the LT instance solves this

Rida Hamadani (Aug 28 2024 at 04:39):

I see, thank you!

Daniel Weber (Aug 28 2024 at 04:40):

Note that the NormedAddCommGroup also conflicts with the one derived from NontriviallyNormedField and should be removed

Rida Hamadani (Aug 28 2024 at 04:43):

It never occurred to me that instances can conflict, it makes sense.

Rida Hamadani (Aug 28 2024 at 06:09):

I'm still running into similar problems. Using convert in the code below gives me 4 new goals, does this mean that I have 4 conflicting instances?
In general, how can one make sure to not run into this sort of "inheritance problems"? And how do we figure out how to fix them if they arise?

import Mathlib.Geometry.Manifold.SmoothManifoldWithCorners

variable (๐•œ : Type*) [NontriviallyNormedField ๐•œ] [Preorder ๐•œ] [PosMulStrictMono ๐•œ] {H : Type*}
  [NormedAddCommGroup H] [NormedSpace ๐•œ H]

def OrientationPreserving (f : H โ†’ H) (s : Set H) : Prop :=
  โˆ€ x โˆˆ s,
    DifferentiableAt ๐•œ f x โˆง
    0 < (fderiv ๐•œ f x).det

def orientationPreservingPregroupoid : Pregroupoid H where
  property f s := OrientationPreserving ๐•œ f s
  comp {f g u v} hf hg _ _ _ := by
    intro x โŸจhxu, hxvโŸฉ
    rw [fderiv.comp _ (hg (f x) hxv).1 (hf x hxu).1]
    ยท have hโ‚ : 0 < (fderiv ๐•œ f x).det := (hf x hxu).2
      have hโ‚‚ : 0 < (fderiv ๐•œ g (f x)).det := (hg (f x) hxv).2
      unfold ContinuousLinearMap.det ContinuousLinearMap.comp
      rw [(fderiv ๐•œ g (f x)).toLinearMap.det_comp (fderiv ๐•œ f x).toLinearMap]
      apply And.intro ?_ <| mul_pos hโ‚‚ hโ‚
      apply DifferentiableAt.comp
      ยท exact (hg (f x) hxv).1
      ยท exact (hf x hxu).1
  id_mem := by
    intro x hx
    simp only [Set.mem_univ, differentiableAt_id, fderiv_id, true_and]
    unfold ContinuousLinearMap.id ContinuousLinearMap.det
    rw [LinearMap.det_id]
    convert zero_lt_one

Daniel Weber (Aug 28 2024 at 06:16):

I believe you need to use docs#NormedLinearOrderedField

Heather Macbeth (Aug 28 2024 at 06:30):

Frankly, you can just use โ„ ... this is a case where I don't think extra generality is useful!


Last updated: May 02 2025 at 03:31 UTC