REWR_CONV : (thm -> conv)
The first argument to REWR_CONV is expected to be an equational theorem which is to be used as a left-to-right rewrite rule. The general form of this theorem is:
A |- t[x1,...,xn] = u[x1,...,xn]
A |- !x1...xn. t[x1,...,xn] = u[x1,...,xn]
A |- t[x1,...,xn] = u[x1,...,xn,y1,...,ym]
If th is an equational theorem of the kind shown above, then REWR_CONV th returns a conversion that maps terms of the form t[e1,...,en/x1,...,xn], in which the terms e1, ..., en are free for x1, ..., xn in t, to theorems of the form:
A |- t[e1,...,en/x1,...,xn] = u[e1,...,en/x1,...,xn]
If REWR_CONV is given a theorem th:
A |- t[x1,...,xn] = u[x1,...,xn,y1,...,ym]
A |- t[e1,...,en/x1,...,xn] = u[e1,...,en,v1,...,vm/x1,...,xn,y1,...,ym]
In addition to doing substitution for free variables in the supplied equational theorem (or ‘rewrite rule’), REWR_CONV th tm also does type instantiation, if this is necessary in order to match the left-hand side of the given rewrite rule th to the term argument tm. If, for example, th is the theorem:
A |- t[x1,...,xn] = u[x1,...,xn]
tm = t[ty1,...,tyn/vty1,...,vtyn][e1,...,en/x1,...,xn]
A |- (t = u)[ty1,...,tyn/vty1,...,vtyn][e1,...,en/x1,...,xn]
th = A |- !v1....vi. t[x1,...,xn] = u[x1,...,xn,y1,...,yn]
|- !x:'a. !y. (x = y) = (y = x)
- REWR_CONV EQ_SYM_EQ (Term `1 = 2`); > val it = |- (1 = 2) = (2 = 1) : thm - REWR_CONV EQ_SYM_EQ (Term `1 < 2`); ! Uncaught exception: ! HOL_ERR
In the following example, one might expect the result to be the theorem A |- f 2 = 2, where A is the assumption of the supplied rewrite rule:
- REWR_CONV (ASSUME (Term `!x:'a. f x = x`)) (Term `f 2:num`); ! Uncaught exception: ! HOL_ERR
Failure will also occur in situations like:
- REWR_CONV (ASSUME (Term `f (n:num) = n`)) (Term `f 2:num`); ! Uncaught exception: ! HOL_ERR