Zulip Chat Archive

Stream: new members

Topic: confusion in using rw


Chengyan Hu (Jun 02 2025 at 22:40):

I'm trying to prove this example in problem sheet.
I hope to use rw[sym_sup] only on the right hand side of h2, to exchange a\inf b and a, however it really seems what I'm doing is wrong and I have no idea.
image.png

Ruben Van de Velde (Jun 02 2025 at 23:37):

I suggest you share a #mwe

Chengyan Hu (Jun 02 2025 at 23:42):

Sincerely apologize for that! I just hoped to share what lean said as well. Here it is:
import Mathlib.Tactic
variable (L : Type) [Lattice L]

theorem sym_sup (a b:L): a⊔b=b⊔a := by

apply le_antisymm

· exact sup_le le_sup_right le_sup_left

· exact sup_le le_sup_right le_sup_left

theorem sym_inf (a b:L): a⊓b=b⊓a := by

apply le_antisymm

· exact le_inf inf_le_right inf_le_left

· exact le_inf inf_le_right inf_le_left

example (L : Type) [Lattice L] :

(∀ a b c : L, a ⊔ b ⊓ c = (a ⊔ b) ⊓ (a ⊔ c)) ↔ ∀ a b c : L, a ⊓ (b ⊔ c) = a ⊓ b ⊔ a ⊓ c := by

constructor

· rintro h1 a b c

have h2:=h1

specialize h2 (a⊓b) a c

rw [← sym_sup (a⊓b) a] at h2

Chengyan Hu (Jun 02 2025 at 23:47):

import Mathlib.Tactic
variable (L : Type) [Lattice L]

theorem sym_sup (a b:L): ab=ba := by

apply le_antisymm

· exact sup_le le_sup_right le_sup_left

· exact sup_le le_sup_right le_sup_left

theorem sym_inf (a b:L): ab=ba := by

apply le_antisymm

· exact le_inf inf_le_right inf_le_left

· exact le_inf inf_le_right inf_le_left

example (L : Type) [Lattice L] :

( a b c : L, a  b  c = (a  b)  (a  c))   a b c : L, a  (b  c) = a  b  a  c := by

constructor

· rintro h1 a b c

have h2:=h1

specialize h2 (ab) a c

rw [ sym_sup (ab) a] at h2

Bjørn Kjos-Hanssen (Jun 03 2025 at 00:07):

Looks like you have to give L as another input to sym_sup. So like this:

import Mathlib.Tactic
variable (L : Type) [Lattice L]

theorem sym_sup (a b:L): ab=ba := by
  apply le_antisymm
  · exact sup_le le_sup_right le_sup_left
  · exact sup_le le_sup_right le_sup_left

theorem sym_inf (a b:L): ab=ba := by
  apply le_antisymm
  · exact le_inf inf_le_right inf_le_left
  · exact le_inf inf_le_right inf_le_left

example (L : Type) [Lattice L] :
( a b c : L, a  b  c = (a  b)  (a  c))   a b c : L, a  (b  c) = a  b  a  c := by
  constructor
  · rintro h1 a b c
    have h2:=h1
    specialize h2 (ab) a c
    have := sym_sup L (a  b) a
    rw [this] at h2
    sorry

Philippe Duchon (Jun 03 2025 at 05:47):

The standard thing would be to make L an implicit parameter, by having {L : Type} in the Variable declaration; this makes it implicit in sym_sup and sym_inf.

Kevin Buzzard (Jun 03 2025 at 17:30):

@Chengyan Hu check out the part of the course notes about brackets to understand the difference between (L : Type) and {L : Type}. And checkout out #backticks for how to post code on Zulip (but it looks like you already figured it out).

Chengyan Hu (Jun 03 2025 at 17:48):

Ahhh, I see! Thank you so much!


Last updated: Dec 20 2025 at 21:32 UTC