Dataset Viewer
Auto-converted to Parquet Duplicate
statement
stringlengths
3
223
proof
stringlengths
0
1.31k
type
stringclasses
10 values
symbolic_name
stringlengths
1
36
library
stringclasses
1 value
filename
stringclasses
5 values
imports
listlengths
5
19
deps
listlengths
0
14
docstring
stringclasses
60 values
source_url
stringclasses
1 value
commit
stringclasses
1 value
sigma
:= PositiveMap.t.
Definition
sigma
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
sigma_get A (null : A) (map : sigma A) (n : positive) : A
:= match PositiveMap.find n map with | None => null | Some x => x end.
Definition
sigma_get
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "null", "sigma" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
sigma_add
:= @PositiveMap.add.
Definition
sigma_add
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
sigma_empty
:= @PositiveMap.empty.
Definition
sigma_empty
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
Associative (X : Type) (R : relation X) (dot : X -> X -> X)
:= law_assoc : forall x y z, R (dot x (dot y z)) (dot (dot x y) z).
Class
Associative
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[]
** Classes for properties of operators
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
Commutative (X : Type) (R : relation X) (plus : X -> X -> X)
:= law_comm: forall x y, R (plus x y) (plus y x).
Class
Commutative
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
Idempotent (X : Type) (R : relation X) (plus : X -> X -> X)
:= law_idem: forall x, R (plus x x) x.
Class
Idempotent
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
Unit (X : Type) (R : relation X) (op : X -> X -> X) (unit : X)
:= { law_neutral_left: forall x, R (op unit x) x; law_neutral_right: forall x, R (op x unit) x }.
Class
Unit
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
AAC_lift (X : Type) (R : relation X) (E : relation X)
:= { aac_lift_equivalence : Equivalence E; aac_list_proper : Proper (E ==> E ==> iff) R }.
Class
AAC_lift
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[]
Class used to find the equivalence relation on which operations are A or AC, starting from the relation appearing in the goal
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
aac_lift_subrelation {X} {R} {E} {HE: Equivalence E} {HR: @Transitive X R} {HER: subrelation E R} : AAC_lift R E | 3.
Proof. constructor; trivial. intros ? ? H ? ? H'. split; intro G. rewrite <- H, G. apply HER, H'. rewrite H, G. apply HER. symmetry. apply H'. Qed.
Instance
aac_lift_subrelation
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "AAC_lift", "H'" ]
Simple instances for when we have a subrelation or an equivalence
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
aac_lift_proper {X} {R : relation X} {E} {HE: Equivalence E} {HR: Proper (E==>E==>iff) R} : AAC_lift R E | 4
:= {}.
Instance
aac_lift_proper
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "AAC_lift" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
copy' n x
:= match n with | xH => x | xI n => let xn := copy' n x in plus (plus xn xn) x | xO n => let xn := copy' n x in (plus xn xn) end.
Fixpoint
copy'
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[]
<<copy n x = x+...+x>> (<<n>> times)
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
copy n x
:= Prect (fun _ => X) x (fun _ xn => plus x xn) n.
Definition
copy
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
copy_plus : forall n m x, R (copy (n+m) x) (plus (copy n x) (copy m x)).
Proof. unfold copy. induction n using Pind; intros m x. rewrite Prect_base. rewrite <- Pplus_one_succ_l. rewrite Prect_succ. reflexivity. rewrite Pplus_succ_permute_l. rewrite 2Prect_succ. rewrite IHn. apply op. Qed.
Lemma
copy_plus
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "copy" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
copy_xH : forall x, R (copy 1 x) x.
Proof. intros; unfold copy; rewrite Prect_base. reflexivity. Qed.
Lemma
copy_xH
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "copy" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
copy_Psucc : forall n x, R (copy (Pos.succ n) x) (plus x (copy n x)).
Proof. intros; unfold copy; rewrite Prect_succ. reflexivity. Qed.
Lemma
copy_Psucc
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "copy" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
copy_compat n : Proper (R ==> R) (copy n).
Proof. unfold copy. induction n using Pind; intros x y H. rewrite 2Prect_base. assumption. rewrite 2Prect_succ. apply po; auto. Qed.
Instance
copy_compat
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "copy" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
type_of (n: nat)
:= match n with | O => X | S n => X -> type_of n end.
Fixpoint
type_of
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[]
Type of an arity
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
rel_of n : relation (type_of n)
:= match n with | O => R | S n => respectful R (rel_of n) end.
Fixpoint
rel_of
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "type_of" ]
Relation to be preserved at an arity
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
pack : Type
:= mkPack { ar : nat; value :> type_of ar; morph : Proper (rel_of ar) value }.
Record
pack
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "rel_of", "type_of" ]
A symbol package contains: - an arity, - a value of the corresponding type, and - a proof that the value is a proper morphism
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
null: pack
:= mkPack 1 (fun x => x) (fun _ _ H => H).
Definition
null
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "pack" ]
Helper to build default values, when filling reification environments
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
pack
:= mk_pack { value:> X -> X -> X; compat: Proper (R ==> R ==> R) value; assoc: Associative R value; comm: option (Commutative R value); idem: option (Idempotent R value) }.
Record
pack
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "Associative", "Commutative", "Idempotent", "assoc", "comm", "idem" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
unit_of u
:= mk_unit_for { uf_idx: idx; uf_desc: Unit R (Bin.value (e_bin uf_idx)) u }.
Record
unit_of
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "Unit", "idx" ]
Packaging units (depends on [e_bin])
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
unit_pack
:= mk_unit_pack { u_value:> X; u_desc: list (unit_of u_value) }.
Record
unit_pack
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "unit_of" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
T: Type
:= | sum: idx -> mset T -> T | prd: idx -> nelist T -> T | sym: forall i, vT (Sym.ar (e_sym i)) -> T | unit : idx -> T with vT: nat -> Type := | vnil: vT O | vcons: forall n, T -> vT n -> vT (S n).
Inductive
T
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "idx", "mset", "nelist" ]
*** Almost normalised syntax A term in [T] is in normal form if: - sums do not contain sums - products do not contain products - there are no unary sums or products - lists and msets are lexicographically sorted according to the order we define below [vT n] denotes the set of term vector...
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
compare (u v: T)
:= match u,v with | sum i l, sum j vs => lex (Pos.compare i j) (mset_compare compare l vs) | prd i l, prd j vs => lex (Pos.compare i j) (list_compare compare l vs) | sym i l, sym j vs => lex (Pos.compare i j) (vcompare l vs) | unit i , unit j => Pos.compare i j | unit _ , _ => L...
Fixpoint
compare
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "lex", "list_compare", "mset_compare" ]
Lexicographic rpo over the normalised syntax
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
eval u: X
:= match u with | sum i l => let o := Bin.value (e_bin i) in fold_map (fun un => let '(u,n):=un in @copy _ o n (eval u)) o l | prd i l => fold_map eval (Bin.value (e_bin i)) l | sym i v => eval_aux v (Sym.value (e_sym i)) | unit i => e_unit i end with eval_aux i (v: vT i): Sym...
Fixpoint
eval
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "copy", "fold_map", "type_of" ]
*** Evaluation from syntax to the abstract domain
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
tcompare_weak_spec u : forall (v : T), compare_weak_spec u v (compare u v) with vcompare_reflect_eqdep i us : forall j vs (H: i=j), vcompare us vs = Eq -> cast vT H us = vs.
Proof. induction u. - destruct v; simpl; try constructor. case (pos_compare_weak_spec p p0); intros; try constructor. case (mset_compare_weak_spec compare tcompare_weak_spec m m0); intros; try constructor. - destruct v; simpl; try constructor. case (pos_compare_weak_spec p p0); intros; try...
Fixpoint
tcompare_weak_spec
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "cast", "cast_eq", "compare", "compare_weak_spec", "list_compare_weak_spec", "mset_compare_weak_spec", "pos_compare_reflect_eq", "pos_compare_weak_spec" ]
We need to show that [compare] reflects equality (this is because we work with msets rather than with lists with arities)
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
eval_aux_compat i (l: vT i): Proper (@Sym.rel_of X R i ==> R) (eval_aux l).
Proof. induction l; simpl; repeat intro. assumption. apply IHl, H. reflexivity. Qed.
Instance
eval_aux_compat
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "rel_of" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
is_unit_of j i
:= List.existsb (fun p => eq_idx_bool j (uf_idx p)) (u_desc (e_unit i)).
Definition
is_unit_of
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "eq_idx_bool" ]
Is <<i>> a unit for <<j>>?
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
is_commutative i
:= match Bin.comm (e_bin i) with Some _ => true | None => false end.
Definition
is_commutative
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "comm" ]
Is <<i>> commutative?
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
is_idempotent i
:= match Bin.idem (e_bin i) with Some _ => true | None => false end.
Definition
is_idempotent
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "idem" ]
Is <<i>> idempotent?
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
discr {A} : Type
:= | Is_op : A -> discr | Is_unit : idx -> discr | Is_nothing : discr.
Inductive
discr
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "idx" ]
*** Normalisation
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
m {A} {B}
:= | left : A -> m | right : B -> m.
Inductive
m
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[]
This is called [Datatypes.sum] in the stdlib
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
comp A B (merge : B -> B -> B) (l : B) (l' : @m A B) : @m A B
:= match l' with | left _ => right l | right l' => right (merge l l') end.
Definition
comp
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
sum' (u: mset T): T
:= match u with | nil (u,xH) => u | _ => sum i u end.
Definition
sum'
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "mset" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
is_sum (u: T) : @discr (mset T)
:= match u with | sum j l => if eq_idx_bool j i then Is_op l else Is_nothing | unit j => if is_unit j then Is_unit j else Is_nothing | _ => Is_nothing end.
Definition
is_sum
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "discr", "eq_idx_bool", "mset" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
copy_mset n (l: mset T): mset T
:= match n with | xH => l | _ => nelist_map (fun vm => let '(v,m):=vm in (v,Pmult n m)) l end.
Definition
copy_mset
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "mset", "nelist_map" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
return_sum u n
:= match is_sum u with | Is_nothing => right (nil (u,n)) | Is_op l' => right (copy_mset n l') | Is_unit j => left j end.
Definition
return_sum
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "copy_mset", "is_sum" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
add_to_sum u n (l : @m idx (mset T))
:= match is_sum u with | Is_nothing => comp (merge_msets compare) (nil (u,n)) l | Is_op l' => comp (merge_msets compare) (copy_mset n l') l | Is_unit _ => l end.
Definition
add_to_sum
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "comp", "compare", "copy_mset", "idx", "is_sum", "merge_msets", "mset" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
norm_msets_ norm (l: mset T)
:= fold_map' (fun un => let '(u,n) := un in return_sum (norm u) n) (fun un l => let '(u,n) := un in add_to_sum (norm u) n l) l.
Definition
norm_msets_
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "add_to_sum", "fold_map'", "mset", "norm", "return_sum" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
prd' (u: nelist T): T
:= match u with | nil u => u | _ => prd i u end.
Definition
prd'
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "nelist" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
is_prd (u: T) : @discr (nelist T)
:= match u with | prd j l => if eq_idx_bool j i then Is_op l else Is_nothing | unit j => if is_unit j then Is_unit j else Is_nothing | _ => Is_nothing end.
Definition
is_prd
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "discr", "eq_idx_bool", "nelist" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
return_prd u
:= match is_prd u with | Is_nothing => right (nil (u)) | Is_op l' => right (l') | Is_unit j => left j end.
Definition
return_prd
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "is_prd" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
add_to_prd u (l : @m idx (nelist T))
:= match is_prd u with | Is_nothing => comp (@appne T) (nil (u)) l | Is_op l' => comp (@appne T) (l') l | Is_unit _ => l end.
Definition
add_to_prd
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "appne", "comp", "idx", "is_prd", "nelist" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
norm_lists_ norm (l : nelist T)
:= fold_map' (fun u => return_prd (norm u)) (fun u l => add_to_prd (norm u) l) l.
Definition
norm_lists_
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "add_to_prd", "fold_map'", "nelist", "norm", "return_prd" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
run_list x
:= match x with | left n => nil (unit n) | right l => l end.
Definition
run_list
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
norm_lists norm i l
:= let is_unit := is_unit_of i in run_list (norm_lists_ i is_unit norm l).
Definition
norm_lists
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "is_unit_of", "norm", "norm_lists_", "run_list" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
run_msets x
:= match x with | left n => nil (unit n, xH) | right l => l end.
Definition
run_msets
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
norm_msets norm i l
:= let is_unit := is_unit_of i in run_msets (norm_msets_ i is_unit norm l).
Definition
norm_msets
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "is_unit_of", "norm", "norm_msets_", "run_msets" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
norm u {struct u}
:= match u with | sum i l => if is_commutative i then if is_idempotent i then sum' i (reduce_mset (norm_msets norm i l)) else sum' i (norm_msets norm i l) else u | prd i l => prd' i (norm_lists norm i l) | sym i l...
Fixpoint
norm
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "is_commutative", "is_idempotent", "norm_lists", "norm_msets", "prd'", "reduce_mset", "sum'" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
is_unit_of_Unit : forall i j : idx, is_unit_of i j = true -> Unit R (Bin.value (e_bin i)) (eval (unit j)).
Proof. intros. unfold is_unit_of in H. rewrite existsb_exists in H. destruct H as [x [H H']]. revert H' ; case (eq_idx_spec); [intros H' _ ; subst| intros _ H'; discriminate]. simpl. destruct x. simpl. auto. Qed.
Lemma
is_unit_of_Unit
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "H'", "Unit", "eq_idx_spec", "eval", "idx", "is_unit_of" ]
*** Correctness
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
Binvalue_Commutative i (H : is_commutative i = true) : Commutative R (@Bin.value _ _ (e_bin i) ).
Proof. unfold is_commutative in H. destruct (Bin.comm (e_bin i)); auto. discriminate. Qed.
Instance
Binvalue_Commutative
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "Commutative", "comm", "is_commutative" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
Binvalue_Idempotent i (H : is_idempotent i = true) : Idempotent R (@Bin.value _ _ (e_bin i)).
Proof. unfold is_idempotent in H. destruct (Bin.idem (e_bin i)); auto. discriminate. Qed.
Instance
Binvalue_Idempotent
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "Idempotent", "idem", "is_idempotent" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
Binvalue_Associative i : Associative R (@Bin.value _ _ (e_bin i)).
Proof. destruct ((e_bin i)); auto. Qed.
Instance
Binvalue_Associative
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "Associative" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
Binvalue_Proper i : Proper (R ==> R ==> R) (@Bin.value _ _ (e_bin i) ).
Proof. destruct ((e_bin i)); auto. Qed.
Instance
Binvalue_Proper
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
is_unit_sum_Unit : forall j, is_unit j = true -> @Unit X R (Bin.value (e_bin i)) (eval (unit j)).
Hypothesis
is_unit_sum_Unit
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "Unit", "eval" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
is_sum_spec_ind : T -> @discr (mset T) -> Prop
:= | is_sum_spec_op : forall j l, j = i -> is_sum_spec_ind (sum j l) (Is_op l) | is_sum_spec_unit : forall j, is_unit j = true -> is_sum_spec_ind (unit j) (Is_unit j) | is_sum_spec_nothing : forall u, is_sum_spec_ind u (Is_nothing).
Inductive
is_sum_spec_ind
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "discr", "mset" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
is_sum_spec u : is_sum_spec_ind u (is_sum i is_unit u).
Proof. unfold is_sum; case u; intros; try constructor. case_eq (eq_idx_bool p i); intros; subst; try constructor; auto. revert H. case eq_idx_spec; try discriminate. auto. case_eq (is_unit p); intros; try constructor. auto. Qed.
Lemma
is_sum_spec
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "eq_idx_bool", "eq_idx_spec", "is_sum", "is_sum_spec_ind" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
assoc : @Associative X R (Bin.value (e_bin i)).
Proof. destruct (e_bin i). simpl. assumption. Qed.
Instance
assoc
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "Associative" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
proper : Proper (R ==> R ==> R)(Bin.value (e_bin i)).
Proof. destruct (e_bin i). simpl. assumption. Qed.
Instance
proper
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
comm : @Commutative X R (Bin.value (e_bin i)).
Hypothesis
comm
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "Commutative" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
sum'_sum : forall (l: mset T), eval (sum' i l) == eval (sum i l).
Proof. intros [[a n] | [a n] l]; destruct n; simpl; reflexivity. Qed.
Lemma
sum'_sum
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "eval", "mset", "sum'" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
eval_sum_nil x : eval (sum i (nil (x,xH))) == (eval x).
Proof. rewrite <- sum'_sum. reflexivity. Qed.
Lemma
eval_sum_nil
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "eval", "sum'_sum" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
eval_sum_cons : forall n a (l: mset T), (eval (sum i ((a,n)::l))) == (@Bin.value _ _ (e_bin i) (@copy _ (@Bin.value _ _ (e_bin i)) n (eval a)) (eval (sum i l))).
Proof. intros n a [[? ? ]|[b m] l]; simpl; reflexivity. Qed.
Lemma
eval_sum_cons
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "copy", "eval", "mset" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
compat_sum_unit : @m idx (mset T) -> Prop
:= | csu_left : forall x, is_unit x = true-> compat_sum_unit (left x) | csu_right : forall m, compat_sum_unit (right m).
Inductive
compat_sum_unit
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "idx", "mset" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
compat_sum_unit_return x n : compat_sum_unit (return_sum i is_unit x n).
Proof. unfold return_sum. case is_sum_spec; intros; try constructor; auto. Qed.
Lemma
compat_sum_unit_return
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "compat_sum_unit", "is_sum_spec", "return_sum" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
compat_sum_unit_add : forall x n h, compat_sum_unit h -> compat_sum_unit (add_to_sum i (is_unit_of i) x n h).
Proof. unfold add_to_sum;intros; inversion H; case_eq (is_sum i (is_unit_of i) x); intros; simpl; try constructor || eauto. apply H0. Qed.
Lemma
compat_sum_unit_add
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "H0", "add_to_sum", "compat_sum_unit", "is_sum", "is_unit_of" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
eval_merge_bin : forall (h k: mset T), eval (sum i (merge_msets compare h k)) == @Bin.value _ _ (e_bin i) (eval (sum i h)) (eval (sum i k)).
Proof. induction h as [[a n]|[a n] h IHh]; intro k. - simpl; induction k as [[b m]|[b m] k IHk]; simpl. * destruct (tcompare_weak_spec a b) as [a|a b|a b]; simpl; auto. apply copy_plus; auto. * destruct (tcompare_weak_spec a b) as [a|a b|a b]; simpl; auto. rewrite copy_pl...
Lemma
eval_merge_bin
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "compare", "copy", "copy_plus", "eval", "merge_msets", "mset", "proper", "tcompare_weak_spec" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
copy_mset' n (l: mset T) : copy_mset n l = nelist_map (fun vm => let '(v,m):=vm in (v,Pmult n m)) l.
Proof. unfold copy_mset. destruct n; try reflexivity. simpl. induction l as [|[a l] IHl]; simpl; try congruence. destruct a; reflexivity. Qed.
Lemma
copy_mset'
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "copy_mset", "mset", "nelist_map" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
copy_mset_succ n (l: mset T) : eval (sum i (copy_mset (Pos.succ n) l)) == @Bin.value _ _ (e_bin i) (eval (sum i l)) (eval (sum i (copy_mset n l))).
Proof. rewrite 2 copy_mset'. induction l as [[a m]|[a m] l IHl]. simpl eval. rewrite <- copy_plus; auto. rewrite Pmult_Sn_m. reflexivity. simpl nelist_map. rewrite ! eval_sum_cons. rewrite IHl. clear IHl. rewrite Pmult_Sn_m. rewrite copy_plus; auto. rewrite <- !law_asso...
Lemma
copy_mset_succ
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "Binvalue_Proper", "copy_mset", "copy_mset'", "copy_plus", "eval", "eval_sum_cons", "mset", "nelist_map", "proper" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
copy_mset_copy : forall n (m : mset T), eval (sum i (copy_mset n m)) == @copy _ (@Bin.value _ _ (e_bin i)) n (eval (sum i m)).
Proof. induction n using Pind; intros. - unfold copy_mset. rewrite copy_xH. reflexivity. - rewrite copy_mset_succ. rewrite copy_Psucc. rewrite IHn. reflexivity. Qed.
Lemma
copy_mset_copy
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "copy", "copy_Psucc", "copy_mset", "copy_mset_succ", "copy_xH", "eval", "mset" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
compat_sum_unit_Unit : forall p, compat_sum_unit (left p) -> @Unit X R (Bin.value (e_bin i)) (eval (unit p)).
Proof. intros; inversion H; subst; auto. Qed.
Instance
compat_sum_unit_Unit
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "Unit", "compat_sum_unit", "eval" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
copy_n_unit : forall j n, is_unit j = true -> eval (unit j) == @copy _ (Bin.value (e_bin i)) n (eval (unit j)).
Proof. intros; induction n using Prect. rewrite copy_xH. reflexivity. rewrite copy_Psucc. rewrite <- IHn. apply is_unit_sum_Unit in H. rewrite law_neutral_left. reflexivity. Qed.
Lemma
copy_n_unit
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "copy", "copy_Psucc", "copy_xH", "eval", "is_unit_sum_Unit" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
z0 l r (H : compat_sum_unit r) : eval (sum i (run_msets (comp (merge_msets compare) l r))) == eval (sum i ((merge_msets compare) (l) (run_msets r))).
Proof. unfold comp. unfold run_msets. case_eq r; intros; subst; [|reflexivity]. rewrite eval_merge_bin; auto. rewrite eval_sum_nil. apply compat_sum_unit_Unit in H. rewrite law_neutral_right. reflexivity. Qed.
Lemma
z0
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "comp", "compare", "compat_sum_unit", "compat_sum_unit_Unit", "eval", "eval_merge_bin", "eval_sum_nil", "merge_msets", "run_msets" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
z1 : forall n x, eval (sum i (run_msets (return_sum i (is_unit) x n ))) == @copy _ (@Bin.value _ _ (e_bin i)) n (eval x).
Proof. intros; unfold return_sum, run_msets. case (is_sum_spec); intros; subst. - rewrite copy_mset_copy; reflexivity. - rewrite eval_sum_nil. apply copy_n_unit. auto. - reflexivity. Qed.
Lemma
z1
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "copy", "copy_mset_copy", "copy_n_unit", "eval", "eval_sum_nil", "is_sum_spec", "return_sum", "run_msets" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
z2 : forall u n x, compat_sum_unit x -> eval (sum i (run_msets (add_to_sum i (is_unit) u n x))) == @Bin.value _ _ (e_bin i) (@copy _ (@Bin.value _ _ (e_bin i)) n (eval u)) (eval (sum i (run_msets x))).
Proof. intros u n x Hix. unfold add_to_sum. case is_sum_spec; intros; subst. - rewrite z0 by auto. rewrite eval_merge_bin, copy_mset_copy. reflexivity. - rewrite <- copy_n_unit by assumption. apply is_unit_sum_Unit in H. rewrite law_neutral_left. reflexivity. - rewrite z0 by ...
Lemma
z2
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "add_to_sum", "compat_sum_unit", "copy", "copy_mset_copy", "copy_n_unit", "eval", "eval_merge_bin", "is_sum_spec", "is_unit_sum_Unit", "run_msets", "z0" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
eval_norm_msets i norm (Comm : Commutative R (Bin.value (e_bin i))) (Hnorm: forall u, eval (norm u) == eval u) : forall h, eval (sum i (norm_msets norm i h)) == eval (sum i h).
Proof. unfold norm_msets. assert (H : forall h : mset T, eval (sum i (run_msets (norm_msets_ i (is_unit_of i) norm h))) == eval (sum i h) /\ compat_sum_unit (is_unit_of i) (norm_msets_ i (is_unit_of i) norm h)). induction h as [[a n] | [a n] h [IHh IHh']]; simpl norm_msets_; split. - rewrite ...
Lemma
eval_norm_msets
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "Commutative", "compat_sum_unit", "compat_sum_unit_add", "compat_sum_unit_return", "eval", "eval_sum_cons", "is_unit_of", "mset", "norm", "norm_msets", "norm_msets_", "run_msets", "z1", "z2" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
copy_idem i (Idem : Idempotent R (Bin.value (e_bin i))) n x : copy (plus:=(Bin.value (e_bin i))) n x == x.
Proof. induction n using Pos.peano_ind; simpl. - apply copy_xH. - rewrite copy_Psucc, IHn; apply law_idem. Qed.
Lemma
copy_idem
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "Idempotent", "copy", "copy_Psucc", "copy_xH" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
eval_reduce_msets i (Idem : Idempotent R (Bin.value (e_bin i))) m : eval (sum i (reduce_mset m)) == eval (sum i m).
Proof. induction m as [[a n]|[a n] m IH]. - simpl. now rewrite 2copy_idem. - simpl. rewrite IH. now rewrite 2copy_idem. Qed.
Lemma
eval_reduce_msets
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "Idempotent", "copy_idem", "eval", "reduce_mset" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
is_unit_prd_Unit : forall j, is_unit j = true -> @Unit X R (Bin.value (e_bin i)) (eval (unit j)).
Hypothesis
is_unit_prd_Unit
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "Unit", "eval" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
is_prd_spec_ind : T -> @discr (nelist T) -> Prop
:= | is_prd_spec_op : forall j l, j = i -> is_prd_spec_ind (prd j l) (Is_op l) | is_prd_spec_unit : forall j, is_unit j = true -> is_prd_spec_ind (unit j) (Is_unit j) | is_prd_spec_nothing : forall u, is_prd_spec_ind u (Is_nothing).
Inductive
is_prd_spec_ind
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "discr", "nelist" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
is_prd_spec u : is_prd_spec_ind u (is_prd i is_unit u).
Proof. unfold is_prd; case u; intros; try constructor. case (eq_idx_spec); intros; subst; try constructor; auto. case_eq (is_unit p); intros; try constructor; auto. Qed.
Lemma
is_prd_spec
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "eq_idx_spec", "is_prd", "is_prd_spec_ind" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
prd'_prd : forall (l: nelist T), eval (prd' i l) == eval (prd i l).
Proof. intros [?|? [|? ?]]; simpl; reflexivity. Qed.
Lemma
prd'_prd
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "eval", "nelist", "prd'" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
eval_prd_nil x: eval (prd i (nil x)) == eval x.
Proof. rewrite <- prd'_prd. simpl. reflexivity. Qed.
Lemma
eval_prd_nil
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "eval", "prd'_prd" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
eval_prd_cons a : forall (l: nelist T), eval (prd i (a::l)) == @Bin.value _ _ (e_bin i) (eval a) (eval (prd i l)).
Proof. intros [|b l]; simpl; reflexivity. Qed.
Lemma
eval_prd_cons
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "eval", "nelist" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
eval_prd_app : forall (h k: nelist T), eval (prd i (h++k)) == @Bin.value _ _ (e_bin i) (eval (prd i h)) (eval (prd i k)).
Proof. induction h; intro k. simpl; try reflexivity. simpl appne. rewrite 2 eval_prd_cons, IHh, law_assoc. reflexivity. Qed.
Lemma
eval_prd_app
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "appne", "eval", "eval_prd_cons", "nelist" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
compat_prd_unit : @m idx (nelist T) -> Prop
:= | cpu_left : forall x, is_unit x = true -> compat_prd_unit (left x) | cpu_right : forall m, compat_prd_unit (right m).
Inductive
compat_prd_unit
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "idx", "nelist" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
compat_prd_unit_return x : compat_prd_unit (return_prd i is_unit x).
Proof. unfold return_prd. case (is_prd_spec); intros; try constructor; auto. Qed.
Lemma
compat_prd_unit_return
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "compat_prd_unit", "is_prd_spec", "return_prd" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
compat_prd_unit_add : forall x h, compat_prd_unit h -> compat_prd_unit (add_to_prd i is_unit x h).
Proof. intros; unfold add_to_prd, comp. case (is_prd_spec); intros; try constructor; auto. - unfold comp; case h; try constructor. - unfold comp; case h; try constructor. Qed.
Lemma
compat_prd_unit_add
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "add_to_prd", "comp", "compat_prd_unit", "is_prd_spec" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
compat_prd_Unit : forall p, compat_prd_unit (left p) -> @Unit X R (Bin.value (e_bin i)) (eval (unit p)).
Proof. intros. inversion H; subst. apply is_unit_prd_Unit. assumption. Qed.
Instance
compat_prd_Unit
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "Unit", "compat_prd_unit", "eval", "is_unit_prd_Unit" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
z0' : forall l (r: @m idx (nelist T)), compat_prd_unit r -> eval (prd i (run_list (comp (@appne T) l r))) == eval (prd i ((appne (l) (run_list r)))).
Proof. intros. unfold comp. unfold run_list. case_eq r; intros; auto; subst. rewrite eval_prd_app. rewrite eval_prd_nil. apply compat_prd_Unit in H. rewrite law_neutral_right. reflexivity. reflexivity. Qed.
Lemma
z0'
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "appne", "comp", "compat_prd_Unit", "compat_prd_unit", "eval", "eval_prd_app", "eval_prd_nil", "idx", "nelist", "run_list" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
z1' a : eval (prd i (run_list (return_prd i is_unit a))) == eval (prd i (nil a)).
Proof. intros. unfold return_prd. unfold run_list. case (is_prd_spec); intros; subst; reflexivity. Qed.
Lemma
z1'
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "eval", "is_prd_spec", "return_prd", "run_list" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
z2' : forall u x, compat_prd_unit x -> eval (prd i (run_list (add_to_prd i is_unit u x))) == @Bin.value _ _ (e_bin i) (eval u) (eval (prd i (run_list x))).
Proof. intros u x Hix. unfold add_to_prd. case (is_prd_spec); intros; subst. rewrite z0' by auto. rewrite eval_prd_app. reflexivity. apply is_unit_prd_Unit in H. rewrite law_neutral_left. reflexivity. rewrite z0' by auto. rewrite eval_prd_app. reflexivity. Qed.
Lemma
z2'
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "add_to_prd", "compat_prd_unit", "eval", "eval_prd_app", "is_prd_spec", "is_unit_prd_Unit", "run_list", "z0'" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
eval_norm_lists i (Hnorm: forall u, eval (norm u) == eval u) : forall h, eval (prd i (norm_lists norm i h)) == eval (prd i h).
Proof. unfold norm_lists. assert (H : forall h : nelist T, eval (prd i (run_list (norm_lists_ i (is_unit_of i) norm h))) == eval (prd i h) /\ compat_prd_unit (is_unit_of i) (norm_lists_ i (is_unit_of i) norm h)). { induction h as [a | a h [IHh IHh']]; simpl norm_lists_; split. ...
Lemma
eval_norm_lists
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "compat_prd_unit", "compat_prd_unit_add", "compat_prd_unit_return", "eval", "eval_prd_cons", "is_unit_of", "is_unit_of_Unit", "nelist", "norm", "norm_lists", "norm_lists_", "run_list", "z1'", "z2'" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
eval_norm u: eval (norm u) == eval u with eval_norm_aux i l : forall (f: Sym.type_of i), Proper (@Sym.rel_of X R i) f -> eval_aux (vnorm l) f == eval_aux l f.
Proof. induction u as [ p m | p l | ? | ?]; simpl norm. - case_eq (is_commutative p); intros. case_eq (is_idempotent p); intros. rewrite sum'_sum. rewrite eval_reduce_msets. 2: eauto with typeclass_instances. apply eval_norm_msets; auto. rewrite sum'_sum. apply eval_norm_mse...
Fixpoint
eval_norm
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "Hf", "eval", "eval_norm_lists", "eval_norm_msets", "eval_reduce_msets", "is_commutative", "is_idempotent", "norm", "prd'_prd", "rel_of", "sum'_sum", "type_of" ]
Correctness of the normalisation function
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
normalise : forall (u v: T), eval (norm u) == eval (norm v) -> eval u == eval v.
Proof. intros u v. rewrite 2 eval_norm. trivial. Qed.
Lemma
normalise
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "eval", "eval_norm", "norm" ]
Corollaries, for goal normalisation or decision
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
compare_reflect_eq: forall u v, compare u v = Eq -> eval u == eval v.
Proof. intros u v. case (tcompare_weak_spec u v); intros; try congruence. reflexivity. Qed.
Lemma
compare_reflect_eq
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "compare", "eval", "tcompare_weak_spec" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
decide: forall (u v: T), compare (norm u) (norm v) = Eq -> eval u == eval v.
Proof. intros u v H. apply normalise. apply compare_reflect_eq. apply H. Qed.
Lemma
decide
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "compare", "compare_reflect_eq", "eval", "norm", "normalise" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
lift_normalise {S} {H : AAC_lift S R} : forall (u v: T), (let x := norm u in let y := norm v in S (eval x) (eval y)) -> S (eval u) (eval v).
Proof. destruct H. intros u v; simpl; rewrite 2 eval_norm. trivial. Qed.
Lemma
lift_normalise
Root
theories/AAC.v
[ "Stdlib", "Arith", "NArith", "List", "FMapPositive", "Relations", "RelationClasses", "Morphisms", "AAC_tactics", "Utils", "Constants" ]
[ "AAC_lift", "eval", "eval_norm", "norm" ]
https://github.com/coq-community/aac-tactics
09523f9910891dcc2072f2b87fee658a62feb484
End of preview. Expand in Data Studio

Coq-AACTactics

Structured dataset from AAC Tactics — Rewriting modulo associativity and commutativity.

Source

Schema

Column Type Description
statement string Declaration signature/claim with the leading keyword removed (verbatim slice); the full declaration minus its proof
proof string Verbatim proof/body, empty if the declaration has none
type string Declaration keyword
symbolic_name string Declaration identifier
library string Sub-library
filename string Repository-relative source path
imports list[string] File-level Require/Import modules
deps list[string] Intra-corpus identifiers referenced
docstring string Preceding documentation comment, empty if absent
source_url string Upstream repository
commit string Upstream commit extracted

Statistics

  • Entries: 326
  • With proof: 292 (89.6%)
  • With docstring: 60 (18.4%)
  • Libraries: 1

By type

Type Count
Instance 152
Lemma 55
Definition 35
Hypothesis 34
Fixpoint 16
Notation 13
Inductive 10
Class 5
Record 4
Ltac 2

Example

sigma_get A (null : A) (map : sigma A) (n : positive) : A
:=
    match PositiveMap.find n map with
      | None => null
      | Some x => x
    end.
  • type: Definition | symbolic_name: sigma_get | theories/AAC.v

Use

Each declaration is split into a statement (signature/claim) and a proof (body) that are disjoint and together form the complete declaration, for proof modeling, autoformalization, retrieval, and dependency analysis via deps.

Citation

@misc{coq_aactactics_dataset,
  title  = {Coq-AACTactics},
  author = {Norton, Charles},
  year   = {2026},
  note   = {Extracted from https://github.com/coq-community/aac-tactics, commit 09523f991089},
  url    = {https://huggingface.co/datasets/phanerozoic/Coq-AACTactics}
}
Downloads last month
62

Collection including phanerozoic/Coq-AACTactics