Skip to content

Instantly share code, notes, and snippets.

@cipher1024
Last active April 24, 2018 01:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cipher1024/0d3328135367269cc35f74f43ecbb302 to your computer and use it in GitHub Desktop.
Save cipher1024/0d3328135367269cc35f74f43ecbb302 to your computer and use it in GitHub Desktop.
try to apply a rule that doesn't quite fit the goal and generate equality obligations for the parts where they differ
namespace tactic
namespace interactive
open interactive interactive.types lean.parser
local postfix `?`:9001 := optional
local postfix *:9001 := many
meta def convert (sym : parse (with_desc "←" (tk "<-")?)) (r : parse texpr) (n : parse (tk "using" *> small_nat)?) : tactic unit :=
do v ← mk_mvar,
if sym.is_some
then refine ``(eq.mp %%v %%r)
else refine ``(eq.mpr %%v %%r),
gs ← get_goals,
set_goals [v],
(option.cases_on n congr congr_n : tactic unit),
gs' ← get_goals,
set_goals $ gs' ++ gs
end interactive
end tactic
open set
variables {α β : Type}
@[simp] lemma singleton_inter_singleton_eq_empty {x y : α} :
({x} ∩ {y} = (∅ : set α)) ↔ x ≠ y :=
by simp [singleton_inter_eq_empty]
example {f : β → α} {x y : α} (h : x ≠ y) : f ⁻¹' {x} ∩ f ⁻¹' {y} = ∅ :=
begin
have : {x} ∩ {y} = (∅ : set α) := by simpa using h,
convert preimage_empty,
rw [←preimage_inter,this],
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment