Zulip Chat Archive

Stream: mathlib4

Topic: pseudo_metric_space.edist_dist_tac


Yury G. Kudryashov (Mar 03 2023 at 18:08):

Could someone port this tactic, please? Topology.MetricSpace.Basic is already in master.

Adam Topaz (Mar 03 2023 at 18:09):

docs#pseudo_metric_space.edist_dist_tac

Adam Topaz (Mar 03 2023 at 18:10):

do we have control_laws_tac yet? That's been on the todo list for a while.

Yury G. Kudryashov (Mar 03 2023 at 18:10):

Here is the source:

protected meta def pseudo_metric_space.edist_dist_tac : tactic unit :=
tactic.intros >> `[exact (ennreal.of_real_eq_coe_nnreal _).symm <|> control_laws_tac]

Yury G. Kudryashov (Mar 03 2023 at 18:10):

control_laws_tac is just intro; rfl (at least in this case)

Adam Topaz (Mar 03 2023 at 18:13):

Oh, so it should be very easy to make this using just a macro

Adam Topaz (Mar 03 2023 at 18:14):

unfortunately I'm stuck compiling forever right now :sad:

Adam Topaz (Mar 03 2023 at 18:23):

A first approximation:

import Mathlib.Data.Real.ENNReal

syntax "edist_dist_tac" : tactic

open Lean.Elab.Tactic in
elab_rules : tactic
| `(tactic|edist_dist_tac) => do
      evalTactic <|  `(tactic|intros)
      evalTactic <|  `(tactic|first | exact (ENNReal.ofReal_eq_coe_nnreal _).symm | rfl)

Adam Topaz (Mar 03 2023 at 18:25):

I'm not a tactic programmer so someone else should verify and/or fix :)

Yury G. Kudryashov (Mar 03 2023 at 18:33):

Can a macro be used in := by _?

Adam Topaz (Mar 03 2023 at 18:34):

A macro that expands to a tactic, yes. But the way I wrote it above it's not technically a macro.

Yury G. Kudryashov (Mar 03 2023 at 18:35):

The goal is to get rid of all the edist_dist fields in MetricSpace.Basic.

Yury G. Kudryashov (Mar 03 2023 at 18:35):

I'll test it tonight.


Last updated: Dec 20 2023 at 11:08 UTC