Zulip Chat Archive
Stream: new members
Topic: explanation of behavior of existential
Nicolas Rolland (Aug 25 2024 at 10:23):
Why is the the second definition exhibiting a failure ?
I imagine there is a lesson to be taken about existentials from this behavior ..
universe u
variable {B : Type u }
abbrev Simple (B : Type u ) := Σ x : B, Bool
def id' (th : Simple B ) : Simple B := ⟨th.fst, true⟩
def isOK (th : Simple B) : True := by
let th' := id' th
let t' := th'.fst
have : th.fst = t' := rfl
simp
def isKO (th : Simple B) : True := by
let ⟨t', _⟩ := id' th
have : th.fst = t' := rfl
-- type mismatch
-- rfl
-- has type
-- th.fst = th.fst : Prop
-- but is expected to have type
-- th.fst = t' : Prop
simp
Daniel Weber (Aug 25 2024 at 10:26):
The problem is that when using patterns let
doesn't keep the definition
Nicolas Rolland (Aug 25 2024 at 11:37):
So I guess the lesson would be : best to not use pattern let, unless we don't need to reason about its provenance, aka it's for consumption only.
Last updated: May 02 2025 at 03:31 UTC