Zulip Chat Archive

Stream: general

Topic: How to better use "let"?


Jiatong Yang (Aug 30 2022 at 11:34):

import tactic
axiom Set : Type
axiom mem : Set  Set  Prop -- flipped ∈
axiom describe (p : Set  Prop) :  s, p = mem s
theorem contra : false := begin
  let p := λ x, ¬ mem x x,
  cases describe p with s h,
  have T : p s = mem s s := by rw h,
  have K : (λ x, ¬ mem x x) s = mem s s := T,
  finish,
end

I think 8th & 9th lines are tediously long. How to improve that?

Alex J. Best (Aug 30 2022 at 14:05):

You can zip the whole thing down to:

import tactic
axiom Set : Type
axiom mem : Set  Set  Prop -- flipped ∈
axiom describe (p : Set  Prop) :  s, p = mem s
theorem contra : false := begin
  cases describe (λ x, ¬ mem x x) with s h,
  simpa using congr_fun h s,
end

Last updated: Dec 20 2023 at 11:08 UTC