0

I was going through chapter 5 (Isar) and I tried doing the structural induction proof for "Σ{0..n::nat} = n*(n+1) div 2" but it fails:

lemma "Σ{0..n::nat} = n*(n+1) div 2" 
proof (induction n)
  show "Σ{0..0::nat} = 0*(0+1) div 2" by simp
next
  fix n 
  assume "Σ {0..n} = n * (n + 1) div 2"
  thus "Σ {0..Suc n} = Suc n * (Suc n + 1) div 2" by simp
qed

it says:

show Σ {0..0} = 0 * (0 + 1) div 2 
Successful attempt to solve goal by exported rule:
  Σ {0..0} = 0 * (0 + 1) div 2 
proof (state)
this:
  Σ {0..0} = 0 * (0 + 1) div 2

goal (1 subgoal):
 1. ⋀n. Σ {0..n} = n * (n + 1) div 2 ⟹ Σ {0..Suc n} = Suc n * (Suc n + 1) div 2 
Failed to finish proof⌂:
goal (1 subgoal):
 1. Σ {0} = 0

I don't know why. Sledgehammer didn't solve it either. I did try blast , auto etc but I knew they'd fail since sledgehammer has suggested those to me before but it was worth the try?

I tried doing the apply style to see what going on:

lemma "Σ{0..n::nat} = n*(n+1) div 2"
  apply (induction n)
   apply simp
apply simp

same error:

proof (prove)
goal (2 subgoals):
 1. Σ {0} = 0
 2. ⋀n. Σ {0..n} = n * (n + 1) div 2 ⟹ Σ {0..Suc n} = Suc n * (Suc n + 1) div 2 
Failed to apply proof method⌂:
goal (2 subgoals):
 1. Σ {0} = 0
 2. ⋀n. Σ {0..n} = n * (n + 1) div 2 ⟹ Σ {0..Suc n} = Suc n * (Suc n + 1) div 2

why is this not working? Is there something wrong with my installation of Isabelle?

I also tried the proof on a file without anything and it also failed so it's not any of my earlier definitions (I assume with high probability).

Charlie Parker
  • 5,884
  • 57
  • 198
  • 323

1 Answers1

0

Seems that going to the bottom right where I can manually insert symbols is a bad idea. It inserted the symbol sigma instead of Sum. I fixed it by doing \<Sum> (in reality I auto completed with tab). Proof works now:

lemma "∑{0..n::nat} = n*(n+1) div 2"
  apply (induction n)
   apply simp
  by simp
Charlie Parker
  • 5,884
  • 57
  • 198
  • 323
  • 1
    The fact that the `Σ` was printed in blue while syntax like `∑` is normally black is a giveaway that `Σ` is interpreted as a free variable here. Also note that quickcheck gives you a counterexample for the original theorem with some function for `Σ`, which again indicates that Isabelle thinks that `Σ` is a free variable. – Manuel Eberl May 19 '20 at 06:27
  • @ManuelEberl yea, realized that after the fact. Unfortunately my brain did not notice or register that it was highlighted in blue. Alas! Thanks though. – Charlie Parker May 19 '20 at 14:48