Skip to Content.
Sympa Menu

ssreflect - [ssreflect] enumerating matches of a rewrite rule

Subject: Ssreflect Users Discussion List

List archive

[ssreflect] enumerating matches of a rewrite rule


Chronological Thread 
  • From: Daniel Selsam <>
  • To:
  • Subject: [ssreflect] enumerating matches of a rewrite rule
  • Date: Thu, 5 Feb 2015 20:19:31 -0800 (PST)

Hi,

Is there a way to enumerate all matches of a given rewrite rule in the goal,
so that an automated system could try them all?

For example, suppose we have a goal:

<<
m : nat
n : nat
p : nat
============================
m + (n + p) = (n + p) + m
>>

I would like to be able to query

<<
rewrite_matches addnC.
>>

and get the response:

<<
[ (m,n+p,1), (n,p,2), (n+p,m,1) ]
>>

so that:

<<
rewrite (addnC m (n+p))
rewrite {1}(addnC n p)
rewrite {2}(addnC n p)
rewrite (addnC (n+p) m)
>>

are the four possible ways of rewriting left to right with [addnC].

I assume there is a way to write this tactic with only a few lines of OCaml,
but I am not sure how.

Thanks very much,

Daniel




Archive powered by MHonArc 2.6.18.

Top of Page