1

I am trying to learn the Isar language (as of Isabelle 2020), and understand the note command. It seems to be a fundamental element of the language since a lot of the "Derived elements" are defined based on it.

I am not sure what it does in terms of the equivalents of English:

  1. When it is necessary to note something? Aren't all the facts and/or assumptions known at this point of time automatically used, or do I have to explicit note certain facts before I can use them? If so, which ones do and do not need to be noted?

  2. What are the things to be noted?

In the documentation Isar-ref.PDF, appendix A1.2 (pp319), under "Primitives", it says:

note a = b reconsider and declare facts

so it seems that an equality is to be noted. Then, in A 1.3 in the same page, it says:

from a ≡ note a then
...
from this ≡ then

Here note doesn't seem to work on an equality. Also, there seems to be a endless loop.

from a = note a then = note a from this = note a note this then ...

(then expands to from and back to then).

then on the same page, there is:

also   ~   note calculation = this

In English, the word "also" (and to some extent "note that") is optional. This is partly why it is so confusing to me here because it seems to be required, and I am not sure what it does. (I can understand other things such as assume as it moves some facts into the context.)

I've seen this and that used in a note command (e.g. in here Why are the following trivial self-equalities needed in the Isabelle/Isar proof?). This confused me a lot.

Is there a dictionary (English dictionary) style explanation somewhere in terms of what note does on the things (this, that, calculation etc.)?

,... and why is note required?

(The above appendix is the closest thing to a specification I could find.)

thor
  • 21,418
  • 31
  • 87
  • 173

2 Answers2

2

No one ever uses that in the way of the question. It hurts to look at that proof. The Isar ref is telling you how things are defined internally, but it is a terrible introduction to Isar. Don't read it. Forget everything you read there. Really.

The right way to start Isar is the prog-prove. Or slides used for teaching.

No facts are used implicitly. Isabelle only uses the facts that you tell it to use. That is why you need using or to pass theorems as argument to tactics.

The usual way to use note is to give a name to something that does not have a name yet, like:

   case Suc
   note meaningfull_name_one = this(1) and meaningfull_name_two = this(2)

or variants of that. This allows you to refer to theorems by name meaningfull_name_one instead of writing down the full expression. It is not necessary, but easier (also maintenance-wise). When you have 10 assumptions, you don't want to use prems(1) or Suc(8) or whatever.

As mentioned @ManuelEberl

note [simp] = ...

is useful to locally declare a theorem as simp.

Short summary:

   this           ::= last fact
   note H = ...   ::= name facts
   that           ::= name of the fact generate by obtain/obtain

Don't ever use calculation directly.

It is possible to abuse note like in question, by not giving a name to things and relying on its side effects. Don't do it.

Mathias Fleury
  • 2,221
  • 5
  • 12
  • I often use it to declare things as e.g. simp rules as well: `note [simp] = my_equation`. Or very occasionally also when I have an already proven equation I want to use in an `also` chain: `have "a = b" by some_method also note ‹b = c› finally have "a = c"` – Manuel Eberl Feb 12 '21 at 09:05
  • Also, while Mathias is quite correct in saying that *Isar* does not use facts implicitly, specific proof methods (like `simp`, `auto`) do use facts implicitly, e.g. those that have been declared `simp` or `intro`. – Manuel Eberl Feb 12 '21 at 09:06
  • Isar also uses e.g. `trans` rules explicitly when you do an `also` chain. – Manuel Eberl Feb 12 '21 at 09:06
  • @ManuelEberl My impression from teaching is that people believe (or expect) that assumptions are used in the later `have`s. But you are obviously right that simp is doing things implicitly. – Mathias Fleury Feb 12 '21 at 09:37
  • While I agree that Isar-ref may not be the best introduction to Isar, `Don't read it. Forget everything you read there. Really.` sounds very excessive for an answer on SO and, overall, in my view, may not be the best advice. From my own experience, while I started learning Isar from the textbooks, without supplementing my learning with Isar-ref, most likely, I would have struggled more than I have. Sorry for being a pain, but I could not resist :-). – user9716869 - supports Ukraine Feb 12 '21 at 15:17
  • It's a valid opinion, but I would tend to agree with Mathias that learning Isar from the reference manual is probably going to be painful and I would not recommend it. – Manuel Eberl Feb 13 '21 at 10:47
  • @Mathias: Yes, I thought as much (that's how e.g. Mizar does it, I think), I just wanted to clarify. – Manuel Eberl Feb 13 '21 at 10:47
1

One reason is that you can create new theorems with low-level operations such as [OF _]. To simplify reusing such a theorem, you can give it a name.

user14704889
  • 116
  • 2