Q.ABBREV_TAC : term quotation -> tactic
It is not an error if the expression e does not occur anywhere within the goal. In this situation, the effect of the tactic is simply to add the assumption Abbrev(v = e).
The Abbrev constant is defined in markerTheory to be the identity function over boolean values. It is used solely as a tag, so that abbreviations can be found by other tools, and so that simplification tactics such as RW_TAC will not eliminate them. When it sees them as part of its context, the simplifier treats terms of the form Abbrev(v = e) as assumptions e = v. In this way, the simplifier can use abbreviations to create further sharing, after an abbreviation’s creation.
- Q.ABBREV_TAC `n = 10` ([], ``10 < 9 * 10``); > val it = ([([``Abbrev(n = 10)``], ``n < 9 * n``)], fn) : (term list * term) list * (thm list -> thm)
- Q.ABBREV_TAC `m = n + 2` ([``f (n + 2) < 6``], ``n < 7``); > val it = ([([``Abbrev(m = n + 2)``, ``f m < 6``], ``n < 7``)], fn) : (term list * term) list * (thm list -> thm)
- Q.ABBREV_TAC `u = x ** 32` ([``x ** 32 = f z``], ``g (x ** 32 + 6) - 10 < 65``); > val it = ([([``Abbrev(u = x ** 32)``, ``u = f z``], ``g (u + 6) - 10 < 65``)], fn) : (term list * term) list * (thm list -> thm)
It is possible to abbreviate functions, using quotations such as `f = \n. n + 3`. When this is done ABBREV_TAC will not itself do anything more than replace exact copies of the abstraction, but the simplifier will subsequently see occurrences of the pattern and replace them. Thus:
> (qabbrev_tac `f = \x. x + 1` >> asm_simp_tac bool_ss []) ([], ``3 + 1 = 4 + 1``); val it = ([([``Abbrev (f = (\x. x + 1))``], ``f 3 = f 4``)], fn): goal list * (thm list -> thm)