2

I'm confused about the all introduction meta rule in Isabelle. The papers say it should be:

From P deduce ⋀ x. P whenever x is not a free variables in the asumptions.

This is confusing to me. I understand better wikipedia's one:

From (P y) deduce ⋀ x. P x whenever y is not free in the (implicit) assumptions and x is not free in P.

How is the meta-forall rule encoded in Isabelle? Here is the source code:

(*Forall introduction.  The Free or Var x must not be free in the hypotheses.
    [x]
     :
     A
  ------
  ⋀x. A
*)
fun forall_intr
    (ct as Cterm {maxidx = maxidx1, t = x, T, sorts, ...})
    (th as Thm (der, {maxidx = maxidx2, shyps, hyps, tpairs, prop, ...})) =
  let
    fun result a =
      Thm (deriv_rule1 (Proofterm.forall_intr_proof x a) der,
       {cert = join_certificate1 (ct, th),
        tags = [],
        maxidx = Int.max (maxidx1, maxidx2),
        shyps = Sorts.union sorts shyps,
        hyps = hyps,
        tpairs = tpairs,
        prop = Logic.all_const T $ Abs (a, T, abstract_over (x, prop))});
    fun check_occs a x ts =
      if exists (fn t => Logic.occs (x, t)) ts then
        raise THM ("forall_intr: variable " ^ quote a ^ " free in assumptions", 0, [th])
      else ();
  in
    (case x of
      Free (a, _) => (check_occs a x hyps; check_occs a x (terms_of_tpairs tpairs); result a)
    | Var ((a, _), _) => (check_occs a x (terms_of_tpairs tpairs); result a)
    | _ => raise THM ("forall_intr: not a variable", 0, [th]))
  end;

Suppose I am a mathematician with only some notions of programming. How would you convince me the piece of code below implements the meta-forall rule in a sensible manner?.

user1868607
  • 2,558
  • 1
  • 17
  • 38
  • Can you give the name of the Isabelle lemma you are referring to? – Mathias Fleury Sep 09 '20 at 15:36
  • @MathiasFleury It's the meta-all introduction as described in page 6 of this document: https://arxiv.org/pdf/cs/9301105.pdf I could not find it in the source code – user1868607 Sep 09 '20 at 16:11
  • `thm triv_forall_equality` states the equivalence `P == ⋀x. P` directly. In the wikipedia rule are you sure it is `⋀ x. P x` and not `⋀ x. P y`? – Mathias Fleury Sep 09 '20 at 16:23
  • To me, the two descriptions in your answer are equivalent. The second one just includes a renaming of the variable. – Peter Zeller Sep 10 '20 at 08:22
  • @PeterZeller how do you see the condition y not free in the assumptions in the first formulation? – user1868607 Sep 10 '20 at 11:19
  • @MathiasFleury I'm reading in the link I added to the question. It reads ⋀ x. P x – user1868607 Sep 10 '20 at 11:21
  • 2
    @Rodrigo The `⋀`-introduction rule is a primitive inference rule of Isabelle/Pure and is implemented directly in ML (function `forall_intr` in the `Pure/thm.ML` source file). See "The Isabelle/Isar Implementation", section 2.3.1 for more information. – Javier Díaz Sep 10 '20 at 16:07
  • 1
    @Rodrigo Your last question is a very good one. Isabelle follows the LCF-style of having a small trusted kernel on top of which other components are built. The following answer greatly elaborates on that topic: https://stackoverflow.com/a/15145620/12984990 – Javier Díaz Sep 10 '20 at 19:30
  • @JavierDíaz thanks a lot for your comments. I'm actually quite familiar with LCF. My question is rather a small description of the above code. I might do it myself but leave it open for discussion in the mean time – user1868607 Sep 10 '20 at 20:58
  • 2
    I think this is just notational confusion. In Isabelle, when you write a binder expression such as `⋀x. P`, the expression `P` cannot depend on `x` by convention. In logic, however, when you look at the naked terms and write something like `⋀x. P`, the possibility of `x` occurring in `P` is usually not excluded a priori. They often write ‘and `x` does not occur in `P`’ when that is what they mean. – Manuel Eberl Sep 11 '20 at 10:42

0 Answers0