fact
stringlengths 0
6.66k
| type
stringclasses 10
values | imports
stringclasses 399
values | filename
stringclasses 465
values | symbolic_name
stringlengths 1
75
| index_level
int64 0
7.85k
|
---|---|---|---|---|---|
PropHolds (2 ≶ 0). Proof. red. apply symmetry. apply pseudo_order_lt_apart, lt_0_2. Qed. | Instance | Require Import | Classes\orders\semirings.v | apart_0_2 | 3,100 |
x₁ y₁ x₂ y₂ : x₁ < y₁ -> x₂ ≤ y₂ -> x₁ + x₂ < y₁ + y₂. Proof. intros E1 E2. apply lt_le_trans with (y₁ + x₂). - apply (strictly_order_preserving (+ x₂));trivial. - apply (order_preserving (y₁ +));trivial. Qed. | Lemma | Require Import | Classes\orders\semirings.v | plus_lt_le_compat | 3,101 |
x₁ y₁ x₂ y₂ : x₁ ≤ y₁ -> x₂ < y₂ -> x₁ + x₂ < y₁ + y₂. Proof. intros E1 E2. apply le_lt_trans with (y₁ + x₂). - apply (order_preserving (+ x₂));trivial. - apply (strictly_order_preserving (y₁ +));trivial. Qed. | Lemma | Require Import | Classes\orders\semirings.v | plus_le_lt_compat | 3,102 |
x y z : 0 ≤ z -> x < y -> x < y + z. Proof. intros. rewrite <-(plus_0_r x). apply plus_lt_le_compat;trivial. Qed. | Lemma | Require Import | Classes\orders\semirings.v | nonneg_plus_lt_compat_r | 3,103 |
x y z : 0 ≤ z -> x < y -> x < z + y. Proof. intros. rewrite (commutativity (f:=plus)). apply nonneg_plus_lt_compat_r;trivial. Qed. | Lemma | Require Import | Classes\orders\semirings.v | nonneg_plus_lt_compat_l | 3,104 |
x y z : 0 < z -> x ≤ y -> x < y + z. Proof. intros. rewrite <-(plus_0_r x). apply plus_le_lt_compat;trivial. Qed. | Lemma | Require Import | Classes\orders\semirings.v | pos_plus_le_lt_compat_r | 3,105 |
x y z : 0 < z -> x ≤ y -> x < z + y. Proof. intros. rewrite (commutativity (f:=plus)). apply pos_plus_le_lt_compat_r;trivial. Qed. | Lemma | Require Import | Classes\orders\semirings.v | pos_plus_le_lt_compat_l | 3,106 |
x : 0 ≤ x * x. Proof. apply not_lt_le_flip. intros E. destruct (lt_antisym (x * x) 0). split; [trivial |]. apply square_pos. pose proof pseudo_order_apart. apply (strong_extensionality (x *.)). rewrite mult_0_r. apply lt_apart. trivial. Qed. | Lemma | Require Import | Classes\orders\semirings.v | square_nonneg | 3,107 |
x y : 0 ≤ x * y -> 0 < y -> 0 ≤ x. Proof. intros. apply (order_reflecting (.* y)). rewrite rings.mult_0_l. trivial. Qed. | Lemma | Require Import | Classes\orders\semirings.v | nonneg_mult_rev_l | 3,108 |
x y : 0 ≤ x * y -> 0 < x -> 0 ≤ y. Proof. intros. apply nonneg_mult_rev_l with x. - rewrite (commutativity (f:=mult)). trivial. - trivial. Qed. | Lemma | Require Import | Classes\orders\semirings.v | nonneg_mult_rev_r | 3,109 |
PropHolds (0 ≤ 1). Proof. red. rewrite <-(mult_1_r 1). apply square_nonneg. Qed. | Instance | Require Import | Classes\orders\semirings.v | le_0_1 | 3,110 |
PropHolds (0 ≤ 2). Proof. solve_propholds. Qed. | Instance | Require Import | Classes\orders\semirings.v | le_0_2 | 3,111 |
PropHolds (0 ≤ 3). Proof. solve_propholds. Qed. | Instance | Require Import | Classes\orders\semirings.v | le_0_3 | 3,112 |
PropHolds (0 ≤ 4). Proof. solve_propholds. Qed. | Instance | Require Import | Classes\orders\semirings.v | le_0_4 | 3,113 |
1 ≤ 2. Proof. apply nonneg_plus_le_compat_r, le_0_1. Qed. | Lemma | Require Import | Classes\orders\semirings.v | le_1_2 | 3,114 |
1 ≤ 3. Proof. apply nonneg_plus_le_compat_r, le_0_2. Qed. | Lemma | Require Import | Classes\orders\semirings.v | le_1_3 | 3,115 |
1 ≤ 4. Proof. apply nonneg_plus_le_compat_r, le_0_3. Qed. | Lemma | Require Import | Classes\orders\semirings.v | le_1_4 | 3,116 |
2 ≤ 3. Proof. apply (order_preserving (1+)), le_1_2. Qed. | Lemma | Require Import | Classes\orders\semirings.v | le_2_3 | 3,117 |
2 ≤ 4. Proof. apply (order_preserving (1+)), le_1_3. Qed. | Lemma | Require Import | Classes\orders\semirings.v | le_2_4 | 3,118 |
3 ≤ 4. Proof. apply (order_preserving (1+)), le_2_3. Qed. | Lemma | Require Import | Classes\orders\semirings.v | le_3_4 | 3,119 |
x y : 1 ≤ x -> 1 ≤ y -> 1 ≤ x * y. Proof. intros. apply ge_1_mult_le_compat_r; trivial. transitivity 1. - apply le_0_1. - trivial. Qed. | Lemma | Require Import | Classes\orders\semirings.v | ge_1_mult_compat | 3,120 |
x y : 1 < x -> 1 ≤ y -> 1 < x * y. Proof. intros. apply lt_le_trans with x; trivial. apply ge_1_mult_le_compat_r;[trivial| |apply reflexivity]. transitivity 1. - apply le_0_1. - apply lt_le;trivial. Qed. | Lemma | Require Import | Classes\orders\semirings.v | gt_1_ge_1_mult_compat | 3,121 |
x y : 1 ≤ x -> 1 < y -> 1 < x * y. Proof. intros. rewrite (commutativity (f:=mult)). apply gt_1_ge_1_mult_compat;trivial. Qed. | Lemma | Require Import | Classes\orders\semirings.v | ge_1_gt_1_mult_compat | 3,122 |
forall a b c d, 0 <= a /\ a <= b -> 0 < b -> 0 <= c /\ c < d -> a * c < b * d. Proof. intros a b c d [E1 E2] E3 [E4 E5] . apply le_lt_trans with (b * c). - apply mult_le_compat;auto. - apply (strictly_order_preserving (b *.)). trivial. Qed. | Lemma | Require Import | Classes\orders\semirings.v | pos_mult_le_lt_compat | 3,123 |
~(1 ≤ 0). Proof. apply lt_not_le_flip, lt_0_1. Qed. | Lemma | Require Import | Classes\orders\semirings.v | not_le_1_0 | 3,124 |
~(2 ≤ 0). Proof. apply lt_not_le_flip, lt_0_2. Qed. | Lemma | Require Import | Classes\orders\semirings.v | not_le_2_0 | 3,125 |
forall n, 0 <= Core.nat_iter n (plus 1) 0. Proof. induction n;simpl. - reflexivity. - apply nonneg_plus_compat. + apply _. + apply IHn. Qed. | Lemma | Require Import | Classes\orders\semirings.v | repeat_nat_nonneg | 3,126 |
forall n, 0 < Core.nat_iter (S n) (plus 1) 0. Proof. intros n. simpl. apply pos_plus_le_lt_compat_l. - solve_propholds. - apply repeat_nat_nonneg. Qed. | Lemma | Require Import | Classes\orders\semirings.v | repeat_nat_pos | 3,127 |
FullPseudoOrder _ _ := dec_full_pseudo_order lt_correct. | Instance | Require Import | Classes\orders\semirings.v | dec_srorder_fullpseudo | 3,128 |
PseudoSemiRingOrder (<). Proof. split; try apply _. - intros x y E. apply srorder_partial_minus, not_lt_le_flip;trivial. - intros z. repeat (split; try apply _). intros x y E. apply lt_correct in E;apply lt_correct. destruct E as [E2a E2b]. split. + apply (order_preserving (z+));trivial. + intros E3. apply E2b. apply (left_cancellation (+) z);trivial. - apply (apartness.dec_strong_binary_morphism (.*.)). - intros x y E1 E2. apply lt_correct in E1;apply lt_correct in E2;apply lt_correct. destruct E1 as [E1a E1b], E2 as [E2a E2b]. split. + apply nonneg_mult_compat;trivial. + apply symmetric_neq. apply mult_ne_0; apply symmetric_neq;trivial. Qed. | Instance | Require Import | Classes\orders\semirings.v | dec_pseudo_srorder | 3,129 |
FullPseudoSemiRingOrder (≤) (<). Proof. split; try apply _. apply le_iff_not_lt_flip. Qed. | Instance | Require Import | Classes\orders\semirings.v | dec_full_pseudo_srorder | 3,130 |
`{IsSemiCRing R2} `{R2le : Le R2} `{is_mere_relation R2 R2le} (f : R2 -> R1) `{!IsSemiRingPreserving f} `{!IsInjective f} : (forall x y, x ≤ y <-> f x ≤ f y) -> (forall x y : R2, x ≤ y -> exists z, y = x + z) -> SemiRingOrder R2le. Proof. intros P. pose proof (projected_partial_order f P). repeat (split; try apply _). - assumption. - red;intros. apply P. rewrite 2!(preserves_plus (f:=f)). apply (order_preserving _), P. trivial. - red;intros. apply P. apply (order_reflecting (f z +)). rewrite <-2!preserves_plus. apply P. trivial. - intros. apply P. rewrite preserves_mult, preserves_0. apply nonneg_mult_compat; rewrite <-(preserves_0 (f:=f)); apply P;trivial. Qed. | Lemma | Require Import | Classes\orders\semirings.v | projected_srorder | 3,131 |
(forall x, 0 ≤ x -> 0 ≤ f x) -> OrderPreserving f. Proof. intros E. repeat (split; try apply _). intros x y F. destruct (decompose_le F) as [z [Ez1 Ez2]]. apply compose_le with (f z). - apply E;trivial. - rewrite Ez2, (preserves_plus (f:=f)). trivial. Qed. | Lemma | Require Import | Classes\orders\semirings.v | preserving_preserves_nonneg | 3,132 |
`{!OrderPreserving f} x : PropHolds (0 ≤ x) -> PropHolds (0 ≤ f x). Proof. intros. rewrite <-(preserves_0 (f:=f)). apply (order_preserving f);trivial. Qed. | Instance | Require Import | Classes\orders\semirings.v | preserves_nonneg | 3,133 |
`{!OrderPreserving f} x : x ≤ 0 -> f x ≤ 0. Proof. intros. rewrite <-(preserves_0 (f:=f)). apply (order_preserving f);trivial. Qed. | Lemma | Require Import | Classes\orders\semirings.v | preserves_nonpos | 3,134 |
`{!OrderPreserving f} x : 1 ≤ x -> 1 ≤ f x. Proof. intros. rewrite <-(preserves_1 (f:=f)). apply (order_preserving f);trivial. Qed. | Lemma | Require Import | Classes\orders\semirings.v | preserves_ge_1 | 3,135 |
`{!OrderPreserving f} x : x ≤ 1 -> f x ≤ 1. Proof. intros. rewrite <-(preserves_1 (f:=f)). apply (order_preserving f);trivial. Qed. | Lemma | Require Import | Classes\orders\semirings.v | preserves_le_1 | 3,136 |
(forall x, 0 < x -> 0 < f x) -> StrictlyOrderPreserving f. Proof. intros E. repeat (split; try apply _). intros x y F. destruct (decompose_lt F) as [z [Ez1 Ez2]]. apply compose_lt with (f z). - apply E. trivial. - rewrite Ez2, (preserves_plus (f:=f)). trivial. Qed. | Lemma | Require Import | Classes\orders\semirings.v | strictly_preserving_preserves_pos | 3,137 |
`{!StrictlyOrderPreserving f} x : PropHolds (0 < x) -> PropHolds (0 < f x). Proof. intros. rewrite <-(preserves_0 (f:=f)). apply (strictly_order_preserving f);trivial. Qed. | Instance | Require Import | Classes\orders\semirings.v | preserves_pos | 3,138 |
`{!StrictlyOrderPreserving f} x : x < 0 -> f x < 0. Proof. intros. rewrite <-(preserves_0 (f:=f)). apply (strictly_order_preserving f);trivial. Qed. | Lemma | Require Import | Classes\orders\semirings.v | preserves_neg | 3,139 |
`{!StrictlyOrderPreserving f} x : 1 < x -> 1 < f x. Proof. intros. rewrite <-(preserves_1 (f:=f)). apply (strictly_order_preserving f);trivial. Qed. | Lemma | Require Import | Classes\orders\semirings.v | preserves_gt_1 | 3,140 |
`{!StrictlyOrderPreserving f} x : x < 1 -> f x < 1. Proof. intros. rewrite <-(preserves_1 (f:=f)). apply (strictly_order_preserving f);trivial. Qed. | Lemma | Require Import | Classes\orders\semirings.v | preserves_lt_1 | 3,141 |
Type@{UC} := | Pconst (c : C) | PX (P : ) (v : V) (Q : ). | Inductive | Require Import Import Quoting. | Classes\tactics\ring_pol.v | Pol | 3,142 |
P Q : Bool := match P, Q with | Pconst c, Pconst d => c =? d | PX P1 v P2, PX Q1 w Q2 => andb (v =? w) (andb ( P1 Q1) ( P2 Q2)) | _, _ => false end. | Fixpoint | Require Import Import Quoting. | Classes\tactics\ring_pol.v | Peqb | 3,143 |
(vs : Vars V) (P : Pol) : R := match P with | Pconst c => phi c | PX P v Q => ( vs P) * (vs v) + ( vs Q) end. | Fixpoint | Require Import Import Quoting. | Classes\tactics\ring_pol.v | eval | 3,144 |
forall a b : Bool, andb a b = true -> a = true /\ b = true. Proof. intros [|] [|];simpl;auto. Qed. | Lemma | Require Import Import Quoting. | Classes\tactics\ring_pol.v | andb_true | 3,145 |
eval_eqb' : forall P Q : Pol, P =? Q = true -> forall vs : Vars V, eval vs P = eval vs Q. Proof. induction P as [c|P1 IHP1 v P2 IHP2];destruct Q as [d|Q1 w Q2];intros E vs; change eqb with Peqb in E;simpl in E. - simpl. apply ap. apply decide_eqb_ok;trivial. - destruct (false_ne_true E). - destruct (false_ne_true E). - apply andb_true in E. destruct E as [E1 E2]. apply andb_true in E2. destruct E2 as [E2 E3]. simpl. apply compare_eqb_eq,tricho_compare_eq in E1. apply ap011;auto. apply ap011;auto. Qed. | Lemma | Require Import Import Quoting. | Classes\tactics\ring_pol.v | eval_eqb' | 3,146 |
eval_eqb@{} := ltac:(first [exact eval_eqb'@{Ularge}| exact eval_eqb']). | Definition | Require Import Import Quoting. | Classes\tactics\ring_pol.v | eval_eqb@ | 3,147 |
eval_0' : forall P, P =? 0 = true -> forall vs, eval vs P = 0. Proof. induction P;simpl;intros E vs. - change eqb with Peqb in E;simpl in E. apply decide_eqb_ok in E. rewrite E. apply preserves_0. - change eqb with Peqb in E;simpl in E. destruct (false_ne_true E). Qed. | Lemma | Require Import Import Quoting. | Classes\tactics\ring_pol.v | eval_0' | 3,148 |
eval_0@{} := ltac:(first [exact eval_0'@{Ularge}| exact eval_0']). | Definition | Require Import Import Quoting. | Classes\tactics\ring_pol.v | eval_0@ | 3,149 |
c P := match P with | Pconst d => Pconst (c + d) | PX P v Q => PX P v ( c Q) end. | Fixpoint | Require Import Import Quoting. | Classes\tactics\ring_pol.v | addC | 3,150 |
vs : forall c P, eval vs (addC c P) = (phi c) + eval vs P. Proof. induction P;simpl. - apply preserves_plus. - rewrite IHP2. rewrite 2!plus_assoc. rewrite (plus_comm (phi c)). reflexivity. Qed. | Lemma | Require Import Import Quoting. | Classes\tactics\ring_pol.v | eval_addC | 3,151 |
addX' c v Q := match Q with | Pconst d => PX (Pconst c) v Q | PX Q1 w Q2 => match v ?= w with | LT => PX Q1 w (addX' c v Q2) | EQ => PX (addC c Q1) v Q2 | GT => PX (Pconst c) v Q end end. | Fixpoint | Require Import Import Quoting. | Classes\tactics\ring_pol.v | addX' | 3,152 |
c v Q := if c =? 0 then Q else ' c v Q. | Definition | Require Import Import Quoting. | Classes\tactics\ring_pol.v | addX | 3,153 |
eval_addX'@{} vs : forall c (v:V) Q, eval vs (addX' c v Q) = phi c * vs v + eval vs Q. Proof. induction Q as [d|Q1 IH1 w Q2 IH2]. - simpl. reflexivity. - simpl. pose proof (tricho_compare_eq v w) as E. destruct (v ?= w);[clear E|rewrite <-E by split;clear E w|clear E]. + simpl. rewrite IH2. rewrite 2!plus_assoc. apply ap011;trivial. apply plus_comm. + simpl. rewrite eval_addC. rewrite plus_mult_distr_r. symmetry;apply plus_assoc. + simpl. reflexivity. Qed. | Lemma | Require Import Import Quoting. | Classes\tactics\ring_pol.v | eval_addX'@ | 3,154 |
vs : forall c (v:V) Q, eval vs (addX c v Q) = phi c * vs v + eval vs Q. Proof. intros. unfold addX. pose proof (decide_eqb_ok c 0) as E. destruct (c =? 0). - rewrite (fst E) by split. rewrite (preserves_0 (f:=phi)). rewrite mult_0_l,plus_0_l. split. - apply '. Qed. | Lemma | Require Import Import Quoting. | Classes\tactics\ring_pol.v | eval_addX | 3,155 |
PXguard@{} P v Q := if eqb P 0 then Q else PX P v Q. | Definition | Require Import Import Quoting. | Classes\tactics\ring_pol.v | PXguard@ | 3,156 |
vs : forall P (v:V) Q, eval vs (PXguard P v Q) = eval vs P * vs v + eval vs Q. Proof. intros. unfold PXguard. pose proof (eval_0 P) as E. destruct (P =? 0). - rewrite E by split. rewrite mult_0_l,plus_0_l. split. - reflexivity. Qed. | Lemma | Require Import Import Quoting. | Classes\tactics\ring_pol.v | eval_PXguard | 3,157 |
c P := match P with | Pconst d => Pconst (c * d) | PX P v Q => PXguard ( c P) v ( c Q) end. | Fixpoint | Require Import Import Quoting. | Classes\tactics\ring_pol.v | mulC | 3,158 |
vs : forall c P, eval vs (mulC c P) = (phi c) * eval vs P. Proof. induction P as [d | P1 IH1 v P2 IH2];simpl. - apply preserves_mult. - rewrite eval_PXguard. rewrite IH1,IH2,plus_mult_distr_l,mult_assoc. reflexivity. Qed. | Lemma | Require Import Import Quoting. | Classes\tactics\ring_pol.v | eval_mulC | 3,159 |
addP P v Q := match Q with | Pconst _ => PX P v Q | PX Q1 w Q2 => match v ?= w with | LT => PX Q1 w ( addP P v Q2) | EQ => PXguard (addP Q1) v Q2 | GT => PX P v Q end end. | Fixpoint | Require Import Import Quoting. | Classes\tactics\ring_pol.v | add_aux | 3,160 |
P Q := match P with | Pconst c => addC c Q | PX P1 v P2 => add_aux ( P1) P1 v ( P2 Q) end. | Fixpoint | Require Import Import Quoting. | Classes\tactics\ring_pol.v | add | 3,161 |
vs P addP (Eadd : forall Q, eval vs (addP Q) = eval vs P + eval vs Q) : forall (v:V) Q, eval vs (add_aux addP P v Q) = eval vs P * vs v + eval vs Q. Proof. induction Q as [d|Q1 IH1 w Q2 IH2]. - simpl. reflexivity. - simpl. pose proof (tricho_compare_eq v w) as E. destruct (v ?= w);[clear E|rewrite <-E by split;clear E w|clear E]. + simpl. rewrite IH2. rewrite 2!plus_assoc. rewrite (plus_comm (eval vs Q1 * vs w)). reflexivity. + rewrite eval_PXguard. rewrite Eadd. rewrite plus_mult_distr_r. symmetry;apply plus_assoc. + simpl. reflexivity. Qed. | Lemma | Require Import Import Quoting. | Classes\tactics\ring_pol.v | eval_add_aux | 3,162 |
eval_add' vs : forall P Q, eval vs (add P Q) = eval vs P + eval vs Q. Proof. induction P as [c|P1 IH1 v P2 IH2];intros Q. - simpl. apply eval_addC. - simpl. rewrite eval_add_aux;auto. rewrite IH2. apply plus_assoc. Qed. | Lemma | Require Import Import Quoting. | Classes\tactics\ring_pol.v | eval_add' | 3,163 |
eval_add@{} := ltac:(first [exact eval_add'@{Ularge}| exact eval_add'@{}]). | Definition | Require Import Import Quoting. | Classes\tactics\ring_pol.v | eval_add@ | 3,164 |
v P := match P with | Pconst c => addX c v 0 | PX P1 w P2 => match v ?= w with | LT => PX ( v P1) w ( v P2) | _ => PX P v 0 end end. | Fixpoint | Require Import Import Quoting. | Classes\tactics\ring_pol.v | mulX | 3,165 |
eval_mulX@{} vs : forall (v:V) (P:Pol), eval vs (mulX v P) = eval vs P * vs v. Proof. induction P as [c|P1 IH1 w P2 IH2]. - simpl. rewrite eval_addX. simpl. rewrite (preserves_0 (f:=phi)),plus_0_r. split. - simpl. pose proof (tricho_compare_eq v w) as E. destruct (v ?= w);[clear E|rewrite <-E by split;clear E w|clear E]. + simpl. rewrite plus_mult_distr_r,IH1,IH2. apply ap011;trivial. rewrite <-2!mult_assoc;apply ap,mult_comm. + simpl. rewrite (preserves_0 (f:=phi)),plus_0_r. reflexivity. + simpl. rewrite (preserves_0 (f:=phi)),plus_0_r. reflexivity. Qed. | Lemma | Require Import Import Quoting. | Classes\tactics\ring_pol.v | eval_mulX@ | 3,166 |
P v Q := add (mulX v P) Q. | Definition | Require Import Import Quoting. | Classes\tactics\ring_pol.v | mkPX | 3,167 |
vs : forall P v Q, eval vs (mkPX P v Q) = (eval vs P) * (vs v) + eval vs Q. Proof. intros. unfold mkPX. rewrite eval_add,eval_mulX. reflexivity. Qed. | Lemma | Require Import Import Quoting. | Classes\tactics\ring_pol.v | eval_mkPX | 3,168 |
P Q := match P, Q with | Pconst c, _ => mulC c Q | _, Pconst d => mulC d P | PX P1 v P2, PX Q1 w Q2 => add (mulX v (add (mulX w ( P1 Q1)) ( P1 Q2))) (add (mulX w ( P2 Q1)) ( P2 Q2)) end. | Fixpoint | Require Import Import Quoting. | Classes\tactics\ring_pol.v | mul | 3,169 |
eval_mul' vs : forall P Q, eval vs (mul P Q) = eval vs P * eval vs Q. Proof. induction P as [c | P1 IHP1 v P2 IHP2];[apply eval_mulC|]. destruct Q as [d | Q1 w Q2]. - change (mul (PX P1 v P2) (Pconst d)) with (mulC d (PX P1 v P2)). rewrite eval_mulC. apply mult_comm. - simpl. rewrite plus_mult_distr_r,!plus_mult_distr_l. repeat (rewrite eval_add || rewrite eval_mulX). rewrite plus_mult_distr_r,(plus_mult_distr_l (eval vs P2)). rewrite IHP1,IHP2. apply ap011;apply ap011. + rewrite <-!mult_assoc. apply ap. rewrite (mult_comm (vs v)). apply mult_assoc. + rewrite <-mult_assoc,(mult_comm (vs v)),mult_assoc. rewrite IHP1;reflexivity. + symmetry;apply mult_assoc. + auto. Qed. | Lemma | Require Import Import Quoting. | Classes\tactics\ring_pol.v | eval_mul' | 3,170 |
eval_mul@{} := ltac:(first [exact eval_mul'@{Ularge}|exact eval_mul'@{}]). | Definition | Require Import Import Quoting. | Classes\tactics\ring_pol.v | eval_mul@ | 3,171 |
(e: Expr V) := match e with | Var v => PX 1 v 0 | Zero => 0 | One => 1 | Plus a b => add ( a) ( b) | Mult a b => mul ( a) ( b) | Neg a => mulC (almost_negate 1) ( a) end. | Fixpoint | Require Import Import Quoting. | Classes\tactics\ring_pol.v | toPol | 3,172 |
eval_toPol@{} vs : forall e : Expr V, eval vs (toPol e) = Quoting.eval _ vs e. Proof. induction e as [v| | |a IHa b IHb|a IHa b IHb|a IHa];simpl. - rewrite (preserves_1 (f:=phi)),(preserves_0 (f:=phi)),plus_0_r,mult_1_l. reflexivity. - apply preserves_0. - apply preserves_1. - rewrite eval_add,IHa,IHb. reflexivity. - rewrite eval_mul,IHa,IHb. reflexivity. - rewrite eval_mulC. rewrite (almostring_mor_neg (f:=phi)),preserves_1. rewrite <-almost_ring_neg_pr. apply ap,IHa. Qed. | Lemma | Require Import Import Quoting. | Classes\tactics\ring_pol.v | eval_toPol@ | 3,173 |
(V:Type0) : Type0 := | Var (v : V) | Zero | One | Plus (a b : V) | Mult (a b : V) | Neg (a : V) . | Inductive | Require Import | Classes\tactics\ring_quote.v | Expr | 3,174 |
{V:Type0} (vs : Vars V) (e : Expr V) : R := match e with | Var v => vs v | Zero => 0 | One => 1 | Plus a b => vs a + vs b | Mult a b => vs a * vs b | Neg a => almost_negate ( vs a) end. | Fixpoint | Require Import | Classes\tactics\ring_quote.v | eval | 3,175 |
{V:Type0} (vs vs' : Vars V) : pointwise_paths@{Set U} vs vs' -> pointwise_paths@{Set U} (eval vs) (eval vs'). Proof. intros E e;induction e;simpl;auto;apply ap011;auto. Qed. | Lemma | Require Import | Classes\tactics\ring_quote.v | eval_ext | 3,176 |
Vars Empty. Proof. intros []. Defined. | Definition | Require Import | Classes\tactics\ring_quote.v | noVars | 3,177 |
x : Vars Unit := fun _ => x. | Definition | Require Import | Classes\tactics\ring_quote.v | singleton | 3,178 |
{A B:Type0 } (va:Vars A) (vb:Vars B) : Vars (sum@{Set Set} A B) := fun i => match i with inl i => va i | inr i => vb i end. Section Lookup. Class Lookup {A:Type0 } (x: R) (f: Vars A) := { lookup: A; lookup_correct: f lookup = x }. Global Arguments lookup {A} x f {_}. Context (x:R) {A B:Type0 } (va : Vars A) (vb : Vars B). Local Instance lookup_l `{!Lookup x va} : Lookup x ( va vb). Proof. exists (inl (lookup x va)). apply lookup_correct. Defined. | Definition | Require Import | Classes\tactics\ring_quote.v | merge | 3,179 |
{V W:Type0 } (f : V -> W) (e : Expr V) : Expr W := match e with | Var v => Var (f v) | Zero => Zero | One => One | Plus a b => Plus ( f a) ( f b) | Mult a b => Mult ( f a) ( f b) | Neg a => Neg ( f a) end. | Fixpoint | Require Import | Classes\tactics\ring_quote.v | expr_map | 3,180 |
{V W:Type0 } (f : V -> W) v e : eval v (expr_map f e) = eval (Compose@{Set Set U} v f) e. Proof. induction e;simpl;try reflexivity;apply ap011;auto. Qed. | Lemma | Require Import | Classes\tactics\ring_quote.v | eval_map | 3,181 |
{A B C}: (A |_| B) |_| C -> A |_| (B |_| C). Proof. intros [[?|?]|?];auto. Defined. | Definition | Require Import | Classes\tactics\ring_quote.v | sum_assoc | 3,182 |
{A B C}: (A |_| B) -> A |_| (B |_| C). Proof. intros [?|?];auto. Defined. | Definition | Require Import | Classes\tactics\ring_quote.v | sum_aux | 3,183 |
(V:Type0) (v: Vars V) n (V':Type0) (v': Vars V') m (V'':Type0) (v'': Vars V'') `{!Quote v n v'} `{!Quote (merge v v') m v''} : eval (merge v (merge v' v'')) (Plus (expr_map sum_aux (quote n)) (expr_map sum_assoc (quote m))) = n + m. Proof. simpl. rewrite <-(eval_quote n), <-(eval_quote m), 2!eval_map. apply ap011;apply eval_ext. - intros [?|?];reflexivity. - intros [[?|?]|?];reflexivity. Qed. | Lemma | Require Import | Classes\tactics\ring_quote.v | quote_plus_ok | 3,184 |
(V:Type0) (v: Vars V) n (V':Type0) (v': Vars V') m (V'':Type0) (v'': Vars V'') `{!Quote v n v'} `{!Quote (merge v v') m v''} : eval (merge v (merge v' v'')) (Mult (expr_map sum_aux (quote n)) (expr_map sum_assoc (quote m))) = n * m. Proof. simpl. rewrite <-(eval_quote n), <-(eval_quote m), 2!eval_map. apply ap011;apply eval_ext. - intros [?|?];reflexivity. - intros [[?|?]|?];reflexivity. Qed. | Lemma | Require Import | Classes\tactics\ring_quote.v | quote_mult_ok | 3,185 |
quote_neg_ok@{} (V:Type0) (v : Vars V) n (V':Type0) (v' : Vars V') `{!Quote v n v'} : eval (merge v v') (Neg (quote n)) = almost_negate n. Proof. simpl. apply ap,eval_quote. Qed. | Lemma | Require Import | Classes\tactics\ring_quote.v | quote_neg_ok@ | 3,186 |
quote': forall x {V':Type0 } {v: Vars V'} {d: Quote noVars x v}, Expr _ := @quote _ _. | Definition | Require Import | Classes\tactics\ring_quote.v | quote' | 3,187 |
eval_quote': forall x {V':Type0} {v: Vars V'} {d: Quote noVars x v}, eval (merge noVars v) (quote x) = x := @eval_quote _ _. | Definition | Require Import | Classes\tactics\ring_quote.v | eval_quote' | 3,188 |
(V:Type0) (v: Vars V) n (V':Type0) (v': Vars V') m (V'':Type0) (v'': Vars V'') `{!Quote v n v'} `{!Quote (merge v v') m v''} : eval (merge v (merge v' v'')) (expr_map sum_aux (quote n)) = eval (merge v (merge v' v'')) (expr_map sum_assoc (quote m)) -> n = m. Proof. intros E. rewrite <-(eval_quote n), <-(eval_quote m). path_via (eval (merge v (merge v' v'')) (expr_map sum_aux (quote n))); [|path_via (eval (merge v (merge v' v'')) (expr_map sum_assoc (quote m)))]. - rewrite eval_map. apply eval_ext. intros [?|?];reflexivity. - rewrite eval_map. apply eval_ext. intros [[?|?]|?];reflexivity. Qed. | Lemma | Require Import | Classes\tactics\ring_quote.v | eq_quote_ok | 3,189 |
{A B} : Empty |_| A -> A |_| B. Proof. intros [[]|?];auto. Defined. | Definition | Require Import | Classes\tactics\ring_quote.v | sum_forget | 3,190 |
{V:Type0} {v: Vars V} {V':Type0} {v': Vars V'} (l r: R) `{!Quote noVars l v} `{!Quote v r v'} : let heap := (merge v v') in eval heap (expr_map sum_forget (quote l)) = eval heap (quote r) -> l = r. Proof. intros ? E. rewrite <-(eval_quote l),<-(eval_quote r). path_via (eval heap (expr_map sum_forget (quote l))). rewrite eval_map. apply eval_ext. intros [[]|?]. reflexivity. Qed. | Lemma | Require Import | Classes\tactics\ring_quote.v | quote_equality | 3,191 |
`{Q : @Quoting.EqQuote R _ _ _ _ _ V l n m V' l'} `{Trichotomy V Vlt} `{Trichotomy V' Vlt'} : eval phi (Quoting.merge R l l') (toPol (Quoting.expr_map inl (Quoting.eqquote_l R))) = eval phi (Quoting.merge R l l') (toPol (Quoting.eqquote_r R)) -> n = m. Proof. intros E. eapply Quoting.eval_eqquote. etransitivity;[symmetry;apply (eval_toPol _)|]. etransitivity;[|apply (eval_toPol _)]. exact E. Qed. | Lemma | Require Import Import Quoting.Instances. | Classes\tactics\ring_tac.v | normalize_eq | 3,192 |
`{Q : @Quoting.EqQuote R _ _ _ _ _ V l n m V' l'} `{Trichotomy V Vlt} `{Trichotomy V' Vlt'} : toPol (Quoting.expr_map inl (@Quoting.eqquote_l R _ _ _ _ _ _ _ _ _ _ _ Q)) =? toPol (@Quoting.eqquote_r R _ _ _ _ _ _ _ _ _ _ _ Q) = true -> n = m. Proof. intros E. apply normalize_eq. apply eval_eqb,E. Qed. | Lemma | Require Import Import Quoting.Instances. | Classes\tactics\ring_tac.v | by_quoting | 3,193 |
`{Trichotomy V Vlt} (a b : Quoting.Expr V) vs : eval phi vs (toPol a) = eval phi vs (toPol b) -> Quoting.eval _ vs a = Quoting.eval _ vs b. Proof. rewrite !(eval_toPol _). trivial. Qed. | Lemma | Require Import Import Quoting.Instances. | Classes\tactics\ring_tac.v | normalize_prequoted | 3,194 |
`{Trichotomy V Vlt} (a b : Quoting.Expr V) vs : toPol a =? toPol b = true -> Quoting.eval _ vs a = Quoting.eval _ vs b. Proof. intros. apply normalize_prequoted. apply eval_eqb;trivial. Qed. | Lemma | Require Import Import Quoting.Instances. | Classes\tactics\ring_tac.v | prove_prequoted | 3,195 |
decide_eqb_ok@{i} {A:Type@{i} } `{DecidablePaths A} : forall a b, iff@{Set i i} (eqb a b = true) (a = b). Proof. unfold eqb,decide_eqb. intros a b;destruct (decide_rel paths a b) as [E1|E1];split;intros E2;auto. - destruct (false_ne_true E2). - destruct (E1 E2). Qed. | Lemma | Require Import HoTT.Classes.interfaces.canonical_names. | Classes\theory\additional_operations.v | decide_eqb_ok@ | 3,196 |
LT <> EQ. Proof. intros E. change ((fun r => match r with LT => Unit | _ => Empty end) EQ). rewrite <-E. split. Qed. | Lemma | Require Import HoTT.Classes.interfaces.canonical_names. | Classes\theory\additional_operations.v | LT_EQ | 3,197 |
LT <> GT. Proof. intros E. change ((fun r => match r with LT => Unit | _ => Empty end) GT). rewrite <-E. split. Qed. | Lemma | Require Import HoTT.Classes.interfaces.canonical_names. | Classes\theory\additional_operations.v | LT_GT | 3,198 |
EQ <> LT. Proof. apply symmetric_neq, LT_EQ. Qed. | Lemma | Require Import HoTT.Classes.interfaces.canonical_names. | Classes\theory\additional_operations.v | EQ_LT | 3,199 |