fact
stringlengths
16
1.35k
type
stringclasses
10 values
library
stringclasses
1 value
imports
listlengths
1
4
filename
stringclasses
5 values
symbolic_name
stringlengths
1
23
docstring
stringclasses
1 value
inv_unique : forall x y y', x*y == 1 -> y'*x == 1 -> y==y'. Proof. intros x y y' Hxy Hy'x. aac_instances <- Hy'x [dot]. aac_rewrite <- Hy'x at 1 [dot]. aac_rewrite Hxy. aac_reflexivity. Qed.
Lemma
theories
[ "From Stdlib Require NArith PeanoNat.", "From AAC_tactics Require Import AAC.", "From AAC_tactics Require Instances." ]
theories/Caveats.v
inv_unique
eq_subr {X} {R} `{@Reflexive X R} : subrelation eq R. Proof. intros x y ->. reflexivity. Qed.
Lemma
theories
[ "From Stdlib Require PeanoNat ZArith Zminmax NArith List Permutation.", "From Stdlib Require QArith Qminmax Relations.", "From AAC_tactics Require Export AAC." ]
theories/Instances.v
eq_subr
Obligation . unfold iff; split; intros; tauto. Qed. Solve All Obligations with firstorder. #[export] Instance aac_Prop_impl_iff_lift : AAC_lift Basics.impl iff := Build_AAC_lift _ _.
Next
theories
[ "From Stdlib Require PeanoNat ZArith Zminmax NArith List Permutation.", "From Stdlib Require QArith Qminmax Relations.", "From AAC_tactics Require Export AAC." ]
theories/Instances.v
Obligation
inter : relation T := fun x y => R x y /\ S x y.
Definition
theories
[ "From Stdlib Require PeanoNat ZArith Zminmax NArith List Permutation.", "From Stdlib Require QArith Qminmax Relations.", "From AAC_tactics Require Export AAC." ]
theories/Instances.v
inter
compo : relation T := fun x y => exists z : T, R x z /\ S z y.
Definition
theories
[ "From Stdlib Require PeanoNat ZArith Zminmax NArith List Permutation.", "From Stdlib Require QArith Qminmax Relations.", "From AAC_tactics Require Export AAC." ]
theories/Instances.v
compo
negr : relation T := fun x y => ~ R x y. (** union and converse are already defined in the standard library *)
Definition
theories
[ "From Stdlib Require PeanoNat ZArith Zminmax NArith List Permutation.", "From Stdlib Require QArith Qminmax Relations.", "From AAC_tactics Require Export AAC." ]
theories/Instances.v
negr
bot : relation T := fun _ _ => False.
Definition
theories
[ "From Stdlib Require PeanoNat ZArith Zminmax NArith List Permutation.", "From Stdlib Require QArith Qminmax Relations.", "From AAC_tactics Require Export AAC." ]
theories/Instances.v
bot
top : relation T := fun _ _ => True.
Definition
theories
[ "From Stdlib Require PeanoNat ZArith Zminmax NArith List Permutation.", "From Stdlib Require QArith Qminmax Relations.", "From AAC_tactics Require Export AAC." ]
theories/Instances.v
top
Obligation . firstorder. Qed.
Next
theories
[ "From Stdlib Require PeanoNat ZArith Zminmax NArith List Permutation.", "From Stdlib Require QArith Qminmax Relations.", "From AAC_tactics Require Export AAC." ]
theories/Instances.v
Obligation
Z_abs_triangle : forall x y, Z.abs (x + y) <= Z.abs x + Z.abs y. Proof Z.abs_triangle.
Lemma
theories
[ "From Stdlib Require PeanoNat ZArith List Permutation Lia.", "From AAC_tactics Require Import AAC.", "From AAC_tactics Require Instances." ]
theories/Tutorial.v
Z_abs_triangle
Z_add_opp_diag_r : forall x, x + -x = 0. Proof Z.add_opp_diag_r. (** The following morphisms are required to perform the required rewrites: *) #[local] Instance Z_opp_ge_le_compat : Proper (Z.ge ==> Z.le) Z.opp. Proof. intros x y. lia. Qed. #[local] Instance Z_add_le_compat : Proper (Z.le ==> Z.le ==> Z.le) Z.add. Proo...
Lemma
theories
[ "From Stdlib Require PeanoNat ZArith List Permutation Lia.", "From AAC_tactics Require Import AAC.", "From AAC_tactics Require Instances." ]
theories/Tutorial.v
Z_add_opp_diag_r
Hbin1 : forall x y, (x+y)^2 = x^2 + y^2 + 2⋅x*y. Proof. intros; ring. Qed.
Lemma
theories
[ "From Stdlib Require PeanoNat ZArith List Permutation Lia.", "From AAC_tactics Require Import AAC.", "From AAC_tactics Require Instances." ]
theories/Tutorial.v
Hbin1
Hbin2 : forall x y, x^2 + y^2 = (x+y)^2 + -(2⋅x*y). Proof. intros; ring. Qed.
Lemma
theories
[ "From Stdlib Require PeanoNat ZArith List Permutation Lia.", "From AAC_tactics Require Import AAC.", "From AAC_tactics Require Instances." ]
theories/Tutorial.v
Hbin2
Hopp : forall x, x + -x = 0. Proof. apply Zplus_opp_r. Qed. Variables a b c : Z. Hypothesis H : c^2 + 2⋅(a+1)*b = (a+1+b)^2. Goal a^2 + b^2 + 2⋅a + 1 = c^2. aacu_rewrite <- Hbin1. rewrite Hbin2. aac_rewrite <- H. aac_rewrite Hopp. aac_reflexivity. Qed. (** Note: after the [aac_rewrite <- H], one could use [ring] to clo...
Lemma
theories
[ "From Stdlib Require PeanoNat ZArith List Permutation Lia.", "From AAC_tactics Require Import AAC.", "From AAC_tactics Require Instances." ]
theories/Tutorial.v
Hopp
idx := positive.
Notation
theories
[ "From Stdlib Require Import Arith NArith List RelationClasses." ]
theories/Utils.v
idx
eq_idx_bool i j := match i,j with | xH, xH => true | xO i, xO j => eq_idx_bool i j | xI i, xI j => eq_idx_bool i j | _, _ => false end. (** Specification predicate for boolean binary functions *)
Fixpoint
theories
[ "From Stdlib Require Import Arith NArith List RelationClasses." ]
theories/Utils.v
eq_idx_bool
decide_spec {A} {B} (R : A -> B -> Prop) (x : A) (y : B) : bool -> Prop := | decide_true : R x y -> decide_spec R x y true | decide_false : ~(R x y) -> decide_spec R x y false.
Inductive
theories
[ "From Stdlib Require Import Arith NArith List RelationClasses." ]
theories/Utils.v
decide_spec
eq_idx_spec : forall i j, decide_spec (@eq _) i j (eq_idx_bool i j). Proof. induction i; destruct j; simpl; try (constructor; congruence). case (IHi j); constructor; congruence. case (IHi j); constructor; congruence. Qed. (** Weak specification predicate for comparison functions: only the [Eq] case is specified *)
Lemma
theories
[ "From Stdlib Require Import Arith NArith List RelationClasses." ]
theories/Utils.v
eq_idx_spec
compare_weak_spec A: A -> A -> comparison -> Prop := | pcws_eq: forall i, compare_weak_spec i i Eq | pcws_lt: forall i j, compare_weak_spec i j Lt | pcws_gt: forall i j, compare_weak_spec i j Gt.
Inductive
theories
[ "From Stdlib Require Import Arith NArith List RelationClasses." ]
theories/Utils.v
compare_weak_spec
pos_compare_weak_spec : forall i j, compare_weak_spec i j (Pos.compare i j). Proof. intros. case Pos.compare_spec; try constructor. intros <-; constructor. Qed.
Lemma
theories
[ "From Stdlib Require Import Arith NArith List RelationClasses." ]
theories/Utils.v
pos_compare_weak_spec
pos_compare_reflect_eq : forall i j, Pos.compare i j = Eq -> i=j. Proof. intros ??. case pos_compare_weak_spec; intros; congruence. Qed. (** ** Dependent types utilities *)
Lemma
theories
[ "From Stdlib Require Import Arith NArith List RelationClasses." ]
theories/Utils.v
pos_compare_reflect_eq
cast T H u := (eq_rect _ T u _ H).
Notation
theories
[ "From Stdlib Require Import Arith NArith List RelationClasses." ]
theories/Utils.v
cast
cast_eq : (forall u v: U, {u=v}+{u<>v}) -> forall A (H: A=A) (u: T A), cast T H u = u. Proof. intros. rewrite <- Eqdep_dec.eq_rect_eq_dec; trivial. Qed. Variable f: forall A B, T A -> T B -> comparison.
Lemma
theories
[ "From Stdlib Require Import Arith NArith List RelationClasses." ]
theories/Utils.v
cast_eq
reflect_eqdep := forall A u B v (H: A=B), @f A B u v = Eq -> cast T H u = v. (** These lemmas have to remain transparent to get structural recursion in the lemma [tcompare_weak_spec] below *)
Definition
theories
[ "From Stdlib Require Import Arith NArith List RelationClasses." ]
theories/Utils.v
reflect_eqdep
reflect_eqdep_eq : reflect_eqdep -> forall A u v, @f A A u v = Eq -> u = v. Proof. intros H A u v He. apply (H _ _ _ _ eq_refl He). Defined.
Lemma
theories
[ "From Stdlib Require Import Arith NArith List RelationClasses." ]
theories/Utils.v
reflect_eqdep_eq
reflect_eqdep_weak_spec : reflect_eqdep -> forall A u v, compare_weak_spec u v (@f A A u v). Proof. intros. case_eq (f u v); try constructor. intro H'. apply reflect_eqdep_eq in H'. subst. constructor. assumption. Defined.
Lemma
theories
[ "From Stdlib Require Import Arith NArith List RelationClasses." ]
theories/Utils.v
reflect_eqdep_weak_spec
nelist (A : Type) : Type := | nil : A -> nelist A | cons : A -> nelist A -> nelist A. Register nil as aac_tactics.nelist.nil. Register cons as aac_tactics.nelist.cons.
Inductive
theories
[ "From Stdlib Require Import Arith NArith List RelationClasses." ]
theories/Utils.v
nelist
nelist_map (A B: Type) (f: A -> B) l := match l with | nil x => nil ( f x) | cons x l => cons ( f x) (nelist_map f l) end.
Fixpoint
theories
[ "From Stdlib Require Import Arith NArith List RelationClasses." ]
theories/Utils.v
nelist_map
appne A l l' : nelist A := match l with nil x => cons x l' | cons t q => cons t (appne A q l') end.
Fixpoint
theories
[ "From Stdlib Require Import Arith NArith List RelationClasses." ]
theories/Utils.v
appne
mset A := nelist (A*positive). (** Lexicographic composition of comparisons (this is a notation to keep it lazy) *)
Definition
theories
[ "From Stdlib Require Import Arith NArith List RelationClasses." ]
theories/Utils.v
mset
lex e f := (match e with Eq => f | _ => e end).
Notation
theories
[ "From Stdlib Require Import Arith NArith List RelationClasses." ]
theories/Utils.v
lex
list_compare h k := match h,k with | nil x, nil y => compare x y | nil x, _ => Lt | _, nil x => Gt | u::h, v::k => lex (compare u v) (list_compare h k) end.
Fixpoint
theories
[ "From Stdlib Require Import Arith NArith List RelationClasses." ]
theories/Utils.v
list_compare
mset_compare A B compare: mset A -> mset B -> comparison := list_compare (fun un vm => let '(u,n) := un in let '(v,m) := vm in lex (compare u v) (Pos.compare n m)).
Definition
theories
[ "From Stdlib Require Import Arith NArith List RelationClasses." ]
theories/Utils.v
mset_compare
list_compare_weak_spec : forall h k, compare_weak_spec h k (list_compare compare h k). Proof. induction h as [|u h IHh]; destruct k as [|v k]; simpl; try constructor. case (Hcompare a a0 ); try constructor. case (Hcompare u v ); try constructor. case (IHh k); intros; constructor. Defined.
Lemma
theories
[ "From Stdlib Require Import Arith NArith List RelationClasses." ]
theories/Utils.v
list_compare_weak_spec
mset_compare_weak_spec : forall h k, compare_weak_spec h k (mset_compare compare h k). Proof. apply list_compare_weak_spec. intros [u n] [v m]. case (Hcompare u v); try constructor. case (pos_compare_weak_spec n m); try constructor. Defined.
Lemma
theories
[ "From Stdlib Require Import Arith NArith List RelationClasses." ]
theories/Utils.v
mset_compare_weak_spec
insert n1 h1 := let fix insert_aux l2 := match l2 with | nil (h2,n2) => match compare h1 h2 with | Eq => nil (h1,Pplus n1 n2) | Lt => (h1,n1):: nil (h2,n2) | Gt => (h2,n2):: nil (h1,n1) end | (h2,n2)::t2 => match compare h1 h2 with | Eq => (h1,Pplus n1 n2):: t2 | Lt => (h1,n1)::l2 | Gt => (h2,n2)::insert_aux t2 end end...
Definition
theories
[ "From Stdlib Require Import Arith NArith List RelationClasses." ]
theories/Utils.v
insert
merge_msets l1 := match l1 with | nil (h1,n1) => fun l2 => insert n1 h1 l2 | (h1,n1)::t1 => let fix merge_aux l2 := match l2 with | nil (h2,n2) => match compare h1 h2 with | Eq => (h1,Pplus n1 n2) :: t1 | Lt => (h1,n1):: merge_msets t1 l2 | Gt => (h2,n2):: l1 end | (h2,n2)::t2 => match compare h1 h2 with | Eq => (h1,Pp...
Fixpoint
theories
[ "From Stdlib Require Import Arith NArith List RelationClasses." ]
theories/Utils.v
merge_msets
reduce_mset : mset A -> mset A := nelist_map (fun x => (fst x,xH)). (** Interpretation of a list with a constant and a binary operation *) Variable B: Type. Variable map: A -> B. Variable b2: B -> B -> B.
Definition
theories
[ "From Stdlib Require Import Arith NArith List RelationClasses." ]
theories/Utils.v
reduce_mset
fold_map l := match l with | nil x => map x | u::l => b2 (map u) (fold_map l) end. (** Mapping and merging *) Variable merge: A -> nelist B -> nelist B.
Fixpoint
theories
[ "From Stdlib Require Import Arith NArith List RelationClasses." ]
theories/Utils.v
fold_map
merge_map (l: nelist A): nelist B := match l with | nil x => nil (map x) | u::l => merge u (merge_map l) end. Variable ret : A -> B. Variable bind : A -> B -> B.
Fixpoint
theories
[ "From Stdlib Require Import Arith NArith List RelationClasses." ]
theories/Utils.v
merge_map
fold_map' (l : nelist A) : B := match l with | nil x => ret x | u::l => bind u (fold_map' l) end.
Fixpoint
theories
[ "From Stdlib Require Import Arith NArith List RelationClasses." ]
theories/Utils.v
fold_map'