Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@RyanGlScott
Created November 21, 2022 14:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RyanGlScott/75ea4e7ee32adc9c2b3f60b481d8e654 to your computer and use it in GitHub Desktop.
Save RyanGlScott/75ea4e7ee32adc9c2b3f60b481d8e654 to your computer and use it in GitHub Desktop.
A failing attempt to use https://github.com/coq/coq/pull/16868
From Coq Require Import Program.Basics.
From Coq Require Program.Equality.
From Coq Require Import Vectors.Vector.
From Coq Require Import Logic.Eqdep.
Import VectorNotations.
Require Import Lia.
Require Import ZArith.
Require Import ZifyBool.
Import ZifyClasses.
Definition Vec (n : nat) (a : Type) : Type := VectorDef.t a n.
Notation bitvector n := (Vec n bool).
(* The exact definitions here aren't terribly important, so I've omitted them
here for the sake of making this test case more minimal. *)
Definition bvToInt : forall w, bitvector w -> Z. Admitted.
Definition isBvult : forall w, bitvector w -> bitvector w -> Prop. Admitted.
Definition bvAdd : forall w, bitvector w -> bitvector w -> bitvector w. Admitted.
Global Program Instance Inj_bv_Z w : InjTyp (bitvector w) Z :=
{ inj := bvToInt w
; pred := fun x => Z.le 0 x /\ Z.lt x (Z.pow 2 (Z.of_nat w))
}.
Next Obligation.
Admitted.
Global Program Instance Rel_eq_bv w : BinRel (@eq (bitvector w)) :=
{ TR := @eq Z
}.
Next Obligation.
Admitted.
Section S.
Variable w : nat.
Add Zify InjTyp (Inj_bv_Z w).
Add Zify BinRel (Rel_eq_bv w).
Lemma test_refl : forall (a : bitvector w), a = a.
Proof.
(* Missing injection for type bitvector w *)
Fail lia.
Admitted.
End S.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment