Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using "find_theorems" in Isabelle

Tags:

isabelle

I want to find theorems. I have read the section on find_theorems in the Isabelle/Isar reference manual:

find_theorems criteria

Retrieves facts from the theory or proof context matching all of given search criteria. The criterion name: p selects all theorems whose fully qualified name matches pattern p, which may contain "*" wildcards. The criteria intro, elim, and dest select theorems that match the current goal as introduction, elimination or destruction rules, respectively. The criterion solves returns all rules that would directly solve the current goal. The criterion simp: t selects all rewrite rules whose left-hand side matches the given term. The criterion term t selects all theorems that contain the pattern t -- as usual, patterns may contain occurrences of the dummy "_" , schematic variables, and type constraints.

Criteria can be preceded by "-" to select theorems that do not match. Note that giving the empty list of criteria yields all currently known facts. An optional limit for the number of printed facts may be given; the default is 40. By default, duplicates are removed from the search result. Use with_dups to display duplicates.

As far as I understand, find_theorems is used in the find window of Isabelle/jEdit. The above does not help me finding relevant theorems for the following situation (Lambda is a theory of the Nominal Isabelle extension. The tarball is here):

theory First
imports Lambda

begin

theorem "Lam [x].(Lam [y].(App (Var x)(Var y))) = Lam [y].(Lam [x].(App (Var y)(Var x)))"

When I try the search expression Lam Isabelle/jedit says

Inner syntax error: unexpected end of input
Failed to parse term

How can I make it look for all the theorems that contain the constant Lam?

like image 731
Gergely Avatar asked Jan 21 '14 10:01

Gergely


2 Answers

Since Lam like the ordinary lambda (%) is not a term on its own, you should add the remaining parts to get a proper term, which may contain wildcards. In your example, I would perform

find_theorems "Lam [_]. _"

which gives lots of answers.

like image 114
René Thiemann Avatar answered Oct 24 '22 08:10

René Thiemann


Typically this happens whenever special syntax was defined for some constant. But there is (almost) always an underlying ("raw") constant. To find out which constant provides the Lam [_]. _ syntax. You can Ctrl-click Lam (inside a proper term) within Isabelle/jEdit. This will jump to the definition of the underlying constant.

For Lam there is the additional complication that the binder syntax uses exactly the same string as the underlying constant, namely Lam, as can be seen at the place of definition:

nominal_datatype lam =
  Var "name"
| App "lam" "lam"
| Lam x::"name" l::"lam"  binds x in l ("Lam [_]. _" [100, 100] 100)

In such cases you can use the long name of the constant by prefixing it with the theory name, i.e., Lambda.Lam.

Note: The same works for binders like ALL x. P x (with underlying constant All), but not for the built-in %x. x.

like image 3
chris Avatar answered Oct 24 '22 08:10

chris