Zulip Chat Archive
Stream: general
Topic: simp underapplied predicate
Yury G. Kudryashov (Dec 31 2023 at 01:41):
Is it possible to make simp
apply p_iff_q
here?
axiom p : Nat → Prop
axiom q : Nat → Prop
axiom p_iff_q : ∀ n, p n ↔ q n
example : p = q := by simp
Mario Carneiro (Dec 31 2023 at 01:42):
no, you would have to make the underapplied version a simp rule as well if you want this
Yury G. Kudryashov (Dec 31 2023 at 01:42):
#xy: I define an inductive predicate and generate an iff
lemma for it using @[mk_iff]
. Later, I want to generate an instance about the predicate by rewriting using the iff
lemma (I have an instance for the RHS of the iff
).
Yury G. Kudryashov (Dec 31 2023 at 01:43):
I guess, I'll have to read and understand the code of mk_iff
.
Mario Carneiro (Dec 31 2023 at 01:43):
How would mk_iff
generate this kind of thing?
Mario Carneiro (Dec 31 2023 at 01:44):
Normally it won't just be two equal constants unless your predicate is just a newtype wrapper
Yury G. Kudryashov (Dec 31 2023 at 01:45):
In practice, it is
@[mk_iff]
structure IsSubsemigroup {M : Type*} [Mul M] (s : Set M) : Prop where
mul_mem : ∀ x ∈ s, ∀ y ∈ s, x * y ∈ s
instance : SomeClass M IsSubsemigroup :=
Mario Carneiro (Dec 31 2023 at 01:45):
okay, so what's the p = q
here?
Yury G. Kudryashov (Dec 31 2023 at 01:46):
I have a generic instance of SomeClass
that generates an instance for the predicate fun s => ∀ x ∈ s, ∀ y ∈ s, x * y ∈ s
Yury G. Kudryashov (Dec 31 2023 at 01:46):
I want to rewrite using a lemma generated by mk_iff
or something similar, then apply this generic instance.
Yury G. Kudryashov (Dec 31 2023 at 01:47):
It's in branch#YK-bundled-set
Mario Carneiro (Dec 31 2023 at 01:47):
Hm, I would avoid doing this in general, newtype wrappers are generally not equal (as types) to the things they wrap
Yury G. Kudryashov (Dec 31 2023 at 01:48):
This is in Prop
Mario Carneiro (Dec 31 2023 at 01:48):
in this case you can do it, but I'm not sure we want to build much infrastructure for this style of proof
Mario Carneiro (Dec 31 2023 at 01:49):
why not just rw [show IsSubsemigroup = _ by ext x; simp]
?
Yury G. Kudryashov (Dec 31 2023 at 01:50):
I'm using rw [show IsSubsemigroup = _ from funext (fun s ↦ propext (IsSubsemigroup_iff s))]
now
Mario Carneiro (Dec 31 2023 at 01:51):
does simp
not trigger once you have the funext
?
Yury G. Kudryashov (Dec 31 2023 at 01:53):
rw [show IsSubsemigroup = _ from funext fun _ ↦ by simp [IsSubsemigroup_iff]]
doesn't work because it fails to close the goal with a metavariable in the RHS by reflexivity.
Mario Carneiro (Dec 31 2023 at 01:53):
; rfl
?
Yury G. Kudryashov (Dec 31 2023 at 01:54):
Thanks!
Yury G. Kudryashov (Dec 31 2023 at 01:55):
I'll see what's easier to make work semi-automatically.
Yury G. Kudryashov (Dec 31 2023 at 02:02):
I want to have this type of proof as a derive
handler for BundledSet.InterPred
etc from Data/BundledSet/Lattice
in that branch.
Last updated: May 02 2025 at 03:31 UTC