Skip to content

Conversation

@eric-wieser
Copy link
Member

@eric-wieser eric-wieser commented Oct 8, 2020

This is an attempt at the approach described at https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/Closing.20.60.E2.8A.A2.60.20goals.20in.20.60conv.60.20mode/near/212702071

A contrived example where this applies:

import algebra.ring
variables {α : Type*} [ring α] {a b c : α}

lemma obvious : c = 1 → (a * b) * c = a * b := λ h, by {rw [h, mul_one]}

example (hc : c = 1) (hb : b = 1) : (a * b) * c = a := begin
  conv_lhs {
    rw obvious,  -- this now fails, as it creates goals that can't be closed
    -- TODO: allow a tactic block to be passed as a trailing argument
  },
  rw [hb, mul_one],
end

Comment on lines 149 to +153
meta def rewrite (q : parse rw_rules) (cfg : rewrite_cfg := {}) : conv unit :=
rw_core q.rules cfg
rw_core q.rules cfg skip

meta def rw (q : parse rw_rules) (cfg : rewrite_cfg := {}) : conv unit :=
rw_core q.rules cfg
rw_core q.rules cfg skip
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how to let a tactic block be passed in here

@bryangingechen
Copy link
Collaborator

Could you add some tests showing the desired new behavior?

@eric-wieser
Copy link
Member Author

eric-wieser commented Oct 8, 2020

@eric-wieser
Copy link
Member Author

At any rate, this doesn't work yet, and I need help to make it work.

@bryangingechen
Copy link
Collaborator

There are a few types of tests:

  • Lean files in tests/lean should generate the corresponding .lean.expected.out file.
  • Lean files in tests/lean/run should run without creating any output
  • Lean files in tests/lean/fail should fail

See also doc/fixing_tests.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

WIP Work in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants