Coder Social home page Coder Social logo

imandra-docs's People

Contributors

actionshrimp avatar bronsa avatar c-cube avatar elijahkagan avatar ewenmaclean avatar grantpassmore avatar hesterjeng avatar ignaden avatar imandraci avatar kkostya avatar lrhammond avatar mattjbray avatar wintersteiger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

imandra-docs's Issues

How to express forall_exists in Imandra

Imandra's logic is purely computational, without existential quantifiers.
In order to prove forall x exists y s.t. phi(x,y), you define a computable witnessing Skolem function f(x) and use Imandra to prove forall x (phi(x, f(x)))

Induction in the presence of mutually recursive functions

Imandra cannot generally synthesize induction schemes for mutually recursive functions, a lot of of the times in the presence of mutually recursive functions, induction would just never work.

Users can provide induction schemes manually (using a custom functional induction scheme), but usually it's much better (if possible) to write in a style that doesn't require mutual recursion (especially in higher order position)

Update DiscoverBalancedTrees notebook

The DiscoverBalancedTrees notebook is no longer compatible with the new version of Imandra. @Bronsa suspects it might have something to do with recent changes to the Gen_rand module.

I've reverted the Imandra version upgrade commit in the short term as we want to release something else, but this will be re-applied on the next imandra-dist release.

What is/how powerful is the logic used by Imandra

From a proof-theoretic perspective, Imandra's logic is effectively a typed version of PRA (Skolem's Primitive Recursive Arithmetic) extended with Transfinite Induction up to the ordinal epsilon_0.
It's a multisorted first-order logic, but Imandra has various niceties that allow it to handle a 'specializable' fragment of Higher-Order Logic

Since in Imandra everything is a program, all judgments are computational and because we live in a quantifier-free world of discrete combinatorial structures, we can admit classical logic and still obtain results that are constructively valid

In Imandra's logic all functions must be total and terminating, extension to the logic are accepted via defining new types or functions validated by Imandra's definitional principle, which analyses definitions to ensure they are admissible, to ensure that any extension by definitions is a conservative extension.

For exception-raising functions like List.hd, List.tl and /, Imandra has a semantics that under-specifies them, allowing them to take on any value in their 'exceptional' cases

Interaction between clausal simplifier and spurious hypothesis

Whenever you have an explicit equality hypothesis between a variable and a non-variable term that doesn't contain it, that leads to an 'explicit substitution' that eliminates the variable - that's so that we have minimal hypotheses before an induction.
In certain cases, this can lead to Imandra removing "manual" destructor elimination, and thus failing to automatically prove a goal by induction.

A key takeaway is, if you have a goal that is going to be proved by induction, always try to make it as strong as possible. As much as possible, you never want to have spurious hypotheses in something you're proving by induction, because then your inductive hypotheses are weaker.

document FC role in unrolling, validate_induct

e.g. given

type t = { x : unit list; y : unit list }
let length a = List.length a.x + List.length a.y
let rec g xs =
  match xs.x, xs.y with
  | _::x, y when List.length xs.x > List.length xs.y ->
    Some {x;y}
  | x,_::y ->
    g {x;y}
  | _ -> None

we can do

lemma g_len xs =
  match g xs with
  | None -> true
  | Some xs' ->
    length xs' < length xs
[@@fc] [@@auto]
let rec f xs =
  match g xs with
  | None -> ()
  | Some xs ->
    f xs
[@@measure Ordinal.of_int (length xs)]
[@@disable length]

or

let rec f xs =
  match g xs with
  | None -> ()
  | Some xs ->
    f xs
[@@measure Ordinal.of_int (length xs)]
[@@validate_induct]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.