Useful imandra tips

Working notes for implementing and verifying a piece of software in Imandra (e.g. Marabou-Imandra interfacing).

Syntax

Constructor with multiple parameters: the parameters are a tuple, so to call the constructor we need to put the parameters in a tuple with parenthesis.

type t = | Foo of int * int | Bar

let x : t = Foo (1, 2) (* Correct *)

let y : t = Foo 1 2 (* Wrong *)

If the wrong syntax is used within parenthesis, the parser will throw an error about a missing parenthis.

Interactive Proof Interface

Use [@@disable] to tell Imandra to not try recursion on the functions that don’t make sense.

Instead of immediatly applying admitted lemmas as rewrite rules (using [@@rewrite]), first try to apply them explicitly: for a lemma lemma foo x y = ..., use [@@apply foo a b] where a and b are variables used in the current verification goal.

Proving program termination

To specify which set of variable to use as a decreasing measure to prove program termination, use the [@@adm] annotation:

let rec ack m n =
  if m <= 0 then n + 1
  else if n <= 0 then ack (m-1) 1
  else ack (m-1) (ack m (n-1))
  [@@adm m,n]

Notes mentioning this note

There are no papers linking to this note.


Here are all the notes in this garden, along with their links, visualized as a graph.

Adversarial perturbation to...Can we (and should we)...Certified compilers and proof...Constructive logicCurry Howard correspondenceDuelling banjos drama in the...Equivalence checkingExporting ocaml from imandraHalf marathon afterthoughtsHow to set up a plausible...How to make a sunrise alarm...How to make a sunrise alarm...How to make a sunrise alarm...Jupyter notebook launch...Lairg to john'o'groats bike...Marabou Imandra interfacingMarkov process modelMethodologyMonte carlo processNeural network verification ...Ocaml decoder libraryProof production for neural...Reading listType theory with agdaUbuntu housekeepingUseful imandra tipsUseful git commandsUseful vim tips and tricksUsefull miscellaneous snippetsVerifying an algorithm with...On the Dangers of Stochastic...Intuitionistic Type TheorySpinoza on ModalityAttention is All you NeedFormal Monotony Analysis...