Zulip Chat Archive
Stream: new members
Topic: Set notation with propositions
Gareth Ma (Mar 04 2024 at 02:48):
Is there a better to write the commented line? I want to construct all Thing
s such that .
inductive Thing
| cons (x : ℕ) (h : x ≤ 5)
def S : Set Thing := { Thing.cons x.val (x.prop.trans $ by norm_num) | x : { y // y ≤ 3 } }
/- { Thing.cons x h | x : ℕ s.t. h : x ≤ 3 } -/
Kyle Miller (Mar 04 2024 at 02:52):
I can't parse your question, but is this the answer?
def S : Set Thing := { Thing.cons x (h.trans $ by norm_num) | (x : ℕ) (h : x ≤ 3) }
Gareth Ma (Mar 04 2024 at 02:52):
Yes perfect! Sorry for the unclear question :tear:
Notification Bot (Mar 04 2024 at 02:57):
Gareth Ma has marked this topic as resolved.
Notification Bot (Mar 04 2024 at 03:48):
Gareth Ma has marked this topic as unresolved.
Gareth Ma (Mar 04 2024 at 03:49):
Hope you don't mind me overloading this thread, since I don't want to spam with too many threads. Can you give some hint on how to construct this equivalence?
inductive Point
| none
| some {x y : ℚ} (h : y ^ 2 - x = 0)
def liftX (x₀ : ℚ) : Set Point :=
{ Point.some h | (y : ℚ) (h : y ^ 2 - x₀ = 0) }
theorem aux1 (x₀ : ℚ) :
liftX x₀ ≃ { y | y ^ 2 - x₀ = 0 } := sorry
The annoying thing is that the Point
inductive has none
(which I don't care) and some
, and I can't "extract" the y
easily
Yaël Dillies (Mar 04 2024 at 04:05):
def aux1 (x₀ : ℚ) : liftX x₀ ≃ { y | y ^ 2 - x₀ = 0 } where
toFun z := match z with
| ⟨.none, hz⟩ => by simp [liftX] at hz
| ⟨.some h, hz⟩ => by
simp [liftX] at hz
obtain rfl := hz.1
exact ⟨_, hz.2⟩
invFun y := ⟨.some y.2, _, _, rfl⟩
left_inv z := match z with
| ⟨.none, hz⟩ => by simp [liftX] at hz
| ⟨.some h, hz⟩ => by
simp [liftX] at hz
obtain rfl := hz.1
simp
right_inv y := by simp
Gareth Ma (Mar 04 2024 at 04:13):
Thank you so much!
Gareth Ma (Mar 04 2024 at 04:13):
So this proof uses Classical.choice
(from #print axioms aux1
). Why is noncomputable
not required?
Yaël Dillies (Mar 04 2024 at 04:15):
Are you sure it's not just using choice to prove LEM or something like that?
Gareth Ma (Mar 04 2024 at 04:15):
No I'm not sure. Would that mean noncomputable is not required?
Yaël Dillies (Mar 04 2024 at 04:15):
The data is not constructed using choice, so it is computable
Yaël Dillies (Mar 04 2024 at 04:16):
Try replacing the proof fields by sorry
and I'm sure the definition won't use choice anymore
Gareth Ma (Mar 04 2024 at 04:17):
For proof fields you mean right_inv
and left_inv
?
Yaël Dillies (Mar 04 2024 at 04:17):
Yes, but possibly also the proofs fed to Point.some
Gareth Ma (Mar 04 2024 at 04:20):
Okay now I'm just confused. I extracted the toFun
into a separate definition:
def func (x₀ : ℚ) : liftX x₀ → { y | y ^ 2 - x₀ = 0 } :=
sorry
/- 'func' depends on axioms: [propext, Classical.choice, Quot.sound, sorryAx] -/
#print axioms func
Gareth Ma (Mar 04 2024 at 04:20):
So just the type definition requires choice?
Gareth Ma (Mar 04 2024 at 04:21):
Oh hmm the definition of Point
also requires it
Yaël Dillies (Mar 04 2024 at 04:21):
Okay, that is quite strange
Gareth Ma (Mar 04 2024 at 04:22):
Screenshot-2024-03-04-at-04.22.09.png
Gareth Ma (Mar 04 2024 at 04:22):
Am I doing something stupid lol
Yaël Dillies (Mar 04 2024 at 04:22):
Maybe the y ^ 2
is the one requiring choice
Gareth Ma (Mar 04 2024 at 04:23):
Yes
Yaël Dillies (Mar 04 2024 at 04:23):
Check instances of the form docs#Rat.monoid
Gareth Ma (Mar 04 2024 at 04:36):
It seems the split
here is the source of most choice usage in Rat
. Interesting
Eric Wieser (Mar 04 2024 at 05:35):
Obligatory link to lean4#2414 which would fix that but is controversial
Eric Wieser (Mar 04 2024 at 05:36):
I think a PR to Std to remove that use of split
would probably be accepted by @Mario Carneiro
Mario Carneiro (Mar 04 2024 at 05:37):
I would still prefer that split be fixed, because otherwise working around the tactic will produce much worse results overall
Eric Wieser (Mar 04 2024 at 05:38):
Is this a place where split_ifs would work instead?
Mario Carneiro (Mar 04 2024 at 05:38):
no, because split_ifs isn't in std
Eric Wieser (Mar 04 2024 at 05:39):
Are there plans to upstream it? (Edit: std4#243)
Eric Wieser (Mar 04 2024 at 05:39):
Or is the idea to eliminate it? (Edit: #7891)
Mario Carneiro (Mar 04 2024 at 05:39):
The obvious counterargument is that it overlaps with split
Eric Wieser (Mar 04 2024 at 05:42):
Eric Wieser said:
I think a PR to Std to remove that use of
split
would probably be accepted by Mario Carneiro
I guess I take back this comment with the knowledge about where split_ifs is
Gareth Ma (Mar 04 2024 at 06:30):
Is there any chance that lean4#2414 will ever be accepted :smiling_face_with_tear: it seems to be stalled since August
Mario Carneiro (Mar 04 2024 at 06:31):
I am worried that it fell into a bit of a gap in our processes, there isn't any recourse after something like this
Gareth Ma (Mar 04 2024 at 06:44):
Just to be clear, this is obviously not a thing that affects me practically in any way. I just get confused and slightly annoyed, and I imagine others (say beginners at Lean) might have the same confusion ^_^ hope one day the RFC will be reviewed, even if it’s low priority. I particularly agree with
Just because it's a low priority doesn't mean it should just be closed, that's what you do to things that are unwanted not low priority.
(Applied to the RFC, not the PR)
Last updated: May 02 2025 at 03:31 UTC