AdaCore / AdaCore/learn

[Bug] Incorrect online execution result in SPARK tutorial (1/2)

Open
#717 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ada
Stars
117
Forks
49
Avg merge
44m
Merged PRs (30d)
8

Description

In Courses.Intro_To_Spark.Proof_of_Functional_Correctness.Loop_Invariant_4 (the example just above pitfalls):

Adding a Loop_Invariant (L13-L14) seems to have changed nothing:

image

... however everything works quite well locally with the same command:

> gnatprove -P main.gpr --checks-as-errors --level=0 --no-axiom-guard --report=all
Phase 1 of 2: generation of Global contracts ...
Phase 2 of 2: flow analysis and proof ...
show_map.adb:10:18: info: overflow check proved
show_map.adb:10:18: info: index check proved
show_map.adb:13:13: info: loop invariant preservation proved
show_map.adb:13:13: info: loop invariant initialization proved
show_map.adb:14:41: info: overflow check proved
show_map.adb:14:41: info: index check proved
show_map.adb:14:65: info: index check proved
show_map.adb:16:13: info: loop invariant initialization proved
show_map.adb:16:13: info: loop invariant preservation proved
show_map.adb:16:44: info: index check proved
show_map.adb:16:63: info: index check proved
show_map.adb:18:22: info: assertion proved
show_map.adb:19:50: info: overflow check proved
show_map.adb:19:50: info: index check proved
show_map.adb:19:65: info: index check proved
show_map.ads:8:35: info: overflow check proved
Summary logged in Courses.Intro_To_Spark.Proof_of_Functional_Correctness.Loop_Invariant_4/gnatprove/gnatprove.out

> gnatprove --version
SPARK Pro 23.0w (20220412)
Why3 for gnatprove version 1.4.1+git
alt-ergo: Alt-Ergo version 2.4.0
colibri: Colibri 2020.9
cvc4: This is CVC4 version 1.8
z3: Z3 version 4.8.15 - 64 bit

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Courses.Intro_To_Spark.Proof_of_Functional_Correctness.Loop_Invariant_4, the example above pitfalls, and compare the online result with the shown gnatprove -P main.gpr --checks-as-errors --level=0 --no-axiom-guard --report=all output. Check lines 13-14 and the reported SPARK Pro 23.0w environment; done means the online execution reflects the locally proved loop invariants and checks.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.