repo_name stringlengths 1 62 | dataset stringclasses 1
value | lang stringclasses 11
values | pr_id int64 1 20.1k | owner stringlengths 2 34 | reviewer stringlengths 2 39 | diff_hunk stringlengths 15 262k | code_review_comment stringlengths 1 99.6k |
|---|---|---|---|---|---|---|---|
runtime-compat | github_2023 | others | 43 | unjs | ascorbic | @@ -42,18 +38,48 @@
UnJS
</ExternalLink>
</p>
- <a
- href="https://github.com/unjs/runtime-compat"
- class="flex gap-2 text-md text-slate-600 hover:text-slate-900 items-center"
- >
+ <a href="https://github.com/unjs/runtime-compat"
+ class="flex gap-2 text-md text-slate-600 ... | We should extract this into a separate file at some point |
runtime-compat | github_2023 | others | 35 | unjs | ascorbic | @@ -18,4 +18,4 @@ jobs:
cache: "pnpm"
- run: pnpm install
- run: pnpm lint
- - run: pnpm build
+ - run: cd apps/website && pnpm build | Could these be `pnpm run --filter apps/website build` instead of doing cd? |
db0 | github_2023 | typescript | 130 | unjs | pi0 | @@ -1,20 +1,22 @@
-import { PGlite, type PGliteOptions } from "@electric-sql/pglite";
+import type { PGliteOptions, PGliteInterfaceExtensions } from "@electric-sql/pglite";
+import { PGlite as PGliteClass } from "@electric-sql/pglite";
import type { Connector, Statement } from "../types";
export type ConnectorOptio... | I am wondering if we should report it upstream about await or properly investigate via some reproductions out of this PR (sync API for init seems documented and tests pass with it) |
db0 | github_2023 | typescript | 130 | unjs | pi0 | @@ -1,20 +1,22 @@
-import { PGlite, type PGliteOptions } from "@electric-sql/pglite";
+import type { PGliteOptions, PGliteInterfaceExtensions } from "@electric-sql/pglite";
+import { PGlite as PGliteClass } from "@electric-sql/pglite";
import type { Connector, Statement } from "../types";
export type ConnectorOptio... | Do you think we still need it? Can you please explain why we would? (considering now we have your nice work in #132) |
db0 | github_2023 | typescript | 86 | unjs | rafazafar | @@ -0,0 +1,47 @@
+import mysql from "mysql2/promise";
+
+import type { Connector, Statement } from "../types";
+
+export default function mysqlConnector(opts: mysql.ConnectionOptions) {
+ let _connection: mysql.Connection | undefined;
+ const getConnection = async () => {
+ if (_connection) {
+ return _connec... | Would be nice to default to root@localhost:3306 but unsure how useful in practice :) |
db0 | github_2023 | typescript | 110 | unjs | pi0 | @@ -0,0 +1,75 @@
+import { PGlite, type PGliteOptions } from "@electric-sql/pglite";
+import type { Connector, Statement } from "../types";
+
+export type ConnectorOptions = PGliteOptions | I have simplified types for now to avoid duplication and possibly going out of sync |
db0 | github_2023 | others | 80 | unjs | pi0 | @@ -40,8 +40,16 @@ await db.sql`INSERT INTO users VALUES (${userId}, 'John', 'Doe', '')`;
// Query for users
const { rows } = await db.sql`SELECT * FROM users WHERE id = ${userId}`;
console.log(rows);
+
+// Using static parameters
+const tableName = "users";
+const { rows } = await db.sql`SELECT * FROM {${tableName}... | ```suggestion
> [!IMPORTANT]
``` |
db0 | github_2023 | typescript | 60 | unjs | pi0 | @@ -5,7 +5,13 @@ export interface ConnectorOptions {
}
export default function sqliteConnector(options: ConnectorOptions) {
- const getDB = () => globalThis.__cf_env__[options.bindingName];
+ const getDB = () => {
+ const binding = globalThis.__cf_env__?.[options.bindingName];
+ if (!binding) {
+ throw... | ```suggestion
throw new Error(`[db0] [d1] binding ${options.bindingName} not found`);
``` |
db0 | github_2023 | typescript | 60 | unjs | pi0 | @@ -5,7 +5,13 @@ export interface ConnectorOptions {
}
export default function sqliteConnector(options: ConnectorOptions) {
- const getDB = () => globalThis.__cf_env__[options.bindingName];
+ const getDB = () => {
+ const binding = globalThis.__cf_env__?.[options.bindingName];
+ if (!binding) {
+ throw... | ```suggestion
throw new Error(`[db0] [d1] binding \`${options.bindingName}\` not found`);
``` |
db0 | github_2023 | typescript | 33 | unjs | atinux | @@ -0,0 +1,87 @@
+import { Database } from "../types";
+import { DBRecord } from "./record";
+import { JSONSchema, Schema, SchemaBaseType } from "./schema";
+
+export class DBTable<T extends SchemaBaseType = SchemaBaseType> {
+ db: Database;
+ name: string;
+ schema: Schema<T>;
+
+ _records: Record<string, DBRecord... | We need a way to transform the schema to a SQL statement |
db0 | github_2023 | others | 34 | unjs | pi0 | @@ -22,3 +22,5 @@ jobs:
- name: Fix lint issues
run: pnpm run lint:fix
- uses: autofix-ci/action@8caa572fd27b0019a65e4c695447089c8d3138b9
+ with:
+ commit-message: 'style: apply lint fixes' | ```suggestion
commit-message: 'chore: apply automated lint fixes'
``` |
db0 | github_2023 | others | 25 | unjs | pi0 | @@ -40,6 +40,7 @@
"db0": "pnpm jiti src/cli"
},
"devDependencies": {
+ "@libsql/client": "^0.2.2", | We need to also add this `peerDependencies`/`peerDependenciesMeta` |
db0 | github_2023 | others | 25 | unjs | pi0 | @@ -4,19 +4,47 @@ navigation.title: LibSQL
# LibSQL Connector
-Connect to [LibSQL](https://libsql.org/) database.
-
-::alert{type="primary"}
-🚀 This connector will be comming soon! Follow up via [unjs/db0#14](https://github.com/unjs/db0/issues/14).
-::
+Connect to a [LibSQL](https://libsql.org/) database.
```j... | Can you please rewrite it in markdown? instead of ts syntax for readability) |
uncrypto | github_2023 | others | 23 | unjs | pi0 | @@ -8,31 +8,36 @@
"type": "module",
"exports": {
".": {
- "browser": "./dist/crypto.web.mjs",
- "bun": "./dist/crypto.web.mjs",
- "deno": "./dist/crypto.web.mjs",
- "edge-light": "./dist/crypto.web.mjs",
- "edge-routine": "./dist/crypto.web.mjs",
- "lagon": "./dist/crypto.web.mj... | Why is `.` to `-` change required? (update saw your comment above will investigate why. it should not normally make issues. i guess/hope to be fixed by using relative imports for `../` in place of `uncrypto` |
uncrypto | github_2023 | typescript | 23 | unjs | pi0 | @@ -0,0 +1,14 @@
+import { decodeFromBase64Url } from "./utils";
+import type { JWTRegisteredClaims } from "./types";
+
+export function decodeJWT<T extends Record<string, any> = Record<string, any>>( | Please prefer `unknown` for type safety
```suggestion
export function decodeJWT<T extends Record<string, unknown> = Record<string, unknown>>(
``` |
uncrypto | github_2023 | typescript | 23 | unjs | pi0 | @@ -0,0 +1,14 @@
+import { decodeFromBase64Url } from "./utils";
+import type { JWTRegisteredClaims } from "./types";
+
+export function decodeJWT<T extends Record<string, any> = Record<string, any>>(
+ token: string
+) {
+ const parts = token.split("."); | typescript prevents, js runtime can still fail. This one is little bit more secure:
```suggestion
const parts = String(token).split(".");
``` |
uncrypto | github_2023 | typescript | 23 | unjs | pi0 | @@ -0,0 +1,68 @@
+import {
+ DEFAULT_HASH_METHODS,
+ DEFAULT_SIGNATURE_METHOD,
+ createSignature,
+ encodeToBase64Url,
+ importKey,
+} from "./utils";
+import type { JWTRegisteredClaims } from "./types";
+
+const headerAlgMap: Record<string, string> = {
+ HMAC: "HS",
+ RSA: "RS",
+ ECDSA: "ES",
+};
+
+export as... | ```suggestion
T extends Record<string, unknown> = Record<string, unknown>
``` |
uncrypto | github_2023 | typescript | 23 | unjs | pi0 | @@ -0,0 +1,68 @@
+import {
+ DEFAULT_HASH_METHODS,
+ DEFAULT_SIGNATURE_METHOD,
+ createSignature,
+ encodeToBase64Url,
+ importKey,
+} from "./utils";
+import type { JWTRegisteredClaims } from "./types";
+
+const headerAlgMap: Record<string, string> = {
+ HMAC: "HS",
+ RSA: "RS",
+ ECDSA: "ES",
+};
+
+export as... | - Could be nice if we export import object as a separate type/inteface export
- For defaults, we shall assign to a new object and not restructure the object |
uncrypto | github_2023 | typescript | 23 | unjs | pi0 | @@ -0,0 +1,68 @@
+import {
+ DEFAULT_HASH_METHODS,
+ DEFAULT_SIGNATURE_METHOD,
+ createSignature,
+ encodeToBase64Url,
+ importKey,
+} from "./utils";
+import type { JWTRegisteredClaims } from "./types";
+
+const headerAlgMap: Record<string, string> = {
+ HMAC: "HS",
+ RSA: "RS",
+ ECDSA: "ES",
+};
+
+export as... | Same for return type, could be nice to be a separate exported type/interface |
uncrypto | github_2023 | typescript | 23 | unjs | pi0 | @@ -0,0 +1,14 @@
+import { decodeFromBase64Url } from "./utils";
+import type { JWTRegisteredClaims } from "./types";
+
+export function decodeJWT<T extends Record<string, any> = Record<string, any>>(
+ token: string
+) {
+ const parts = token.split(".");
+ if (parts.length !== 3) {
+ throw new Error("Invalid tok... | Decode / Encode can fail for many reasons (runtime errors). Would we nice if create internal `_decodeJWT` util and export a wrapper with `try/catch` protection. I am open to an _unsafe_ version which can throws more explicit errors but as general practice across UnJS, we tend to do similar approach first. |
uncrypto | github_2023 | typescript | 23 | unjs | pi0 | @@ -0,0 +1,59 @@
+// @ts-expect-error: will resolve at runtime
+import { subtle } from "uncrypto"; | You can directly use relative imports `..`. rollup smartly creates shared chunks for us. |
uncrypto | github_2023 | typescript | 23 | unjs | pi0 | @@ -0,0 +1,67 @@
+import {
+ DEFAULT_HASH_METHODS,
+ DEFAULT_SIGNATURE_METHOD,
+ decodeFromBase64Url,
+ decodeFromBase64UrlToBuffer,
+ importKey,
+ textEncoder,
+} from "./utils";
+import type { JWTRegisteredClaims } from "./types";
+// @ts-expect-error: will resolve at runtime
+import { subtle } from "uncrypto";... | (we need to export input/output types individually here as well 🙏🏼 ) |
uncrypto | github_2023 | typescript | 23 | unjs | pi0 | @@ -0,0 +1,67 @@
+import {
+ DEFAULT_HASH_METHODS,
+ DEFAULT_SIGNATURE_METHOD,
+ decodeFromBase64Url,
+ decodeFromBase64UrlToBuffer,
+ importKey,
+ textEncoder,
+} from "./utils";
+import type { JWTRegisteredClaims } from "./types";
+// @ts-expect-error: will resolve at runtime
+import { subtle } from "uncrypto";... | ```suggestion
const [header, payload, signature] = String(token).split(".");
``` |
model-gallery | github_2023 | others | 54 | go-skynet | lunamidori5 | @@ -0,0 +1,42 @@
+name: "mixtral-8x7B-Q6_K"
+
+description: |
+ This is a mixtral model
+
+license: "https://www.apache.org/licenses/LICENSE-2.0"
+urls:
+- https://huggingface.co/TheBloke/Mixtral-8x7B-Instruct-v0.1-GGUF
+
+config_file: |
+ name: mixtral-8x7B-Q6_K
+ context_size: 4096
+ f16: true
+ mmap: true
+ gp... | Lets comment this out so that the user can pick if they want GPU for both, also the models max is like... 86, so please change those (you can set it to 90 if you want) |
model-gallery | github_2023 | others | 54 | go-skynet | lunamidori5 | @@ -0,0 +1,42 @@
+name: "mixtral-8x7B-Q3_K_M"
+
+description: |
+ This is a mixtral model
+
+license: "https://www.apache.org/licenses/LICENSE-2.0"
+urls:
+- https://huggingface.co/TheBloke/Mixtral-8x7B-Instruct-v0.1-GGUF
+
+config_file: |
+ name: mixtral-8x7B-Q3_K_M
+ context_size: 4096
+ f16: true
+ mmap: true
+... | Looks great! Lets just set this to 90 and then ill merge! |
model-gallery | github_2023 | others | 31 | go-skynet | mudler | @@ -0,0 +1,6 @@
+ | ```suggestion
#!/bin/bash
``` |
model-gallery | github_2023 | others | 31 | go-skynet | mudler | @@ -9,4 +9,14 @@ The model gallery is a curated collection of models created by the community and
We encourage contributions to the gallery! However, please note that if you are submitting a pull request (PR), we cannot accept PRs that include URLs to models based on LLaMA or models with licenses that do not allow r... | ```suggestion
bash ./load.sh wizard
``` |
model-gallery | github_2023 | others | 12 | go-skynet | tmm1 | @@ -0,0 +1,37 @@
+name: "llama2-13b-chat"
+
+description: |
+Llama 2 13B Chat -> Llama 2 is a collection of pretrained and fine-tuned generative text models ranging in scale from 7 billion to 70 billion parameters.
+
+license: "https://ai.meta.com/llama/license/"
+urls:
+- https://ai.meta.com/llama/
+
+config... | Not sure these are necessary or even make sense with the colons |
go-llama.cpp | github_2023 | go | 164 | go-skynet | mudler | @@ -0,0 +1,60 @@
+package llama_test
+
+import (
+ "fmt"
+ "os"
+
+ . "github.com/go-skynet/go-llama.cpp"
+ . "github.com/onsi/ginkgo/v2"
+ . "github.com/onsi/gomega"
+)
+
+var _ = Describe("LLama binding", func() {
+ testModelPath := os.Getenv("TEST_MODEL")
+
+ Context("Declaration", func() {
+ It("fails with no mode... | ginkgo has `Skip()` see https://github.com/go-skynet/LocalAI/blob/77e1ae3d707d94b819fe774ec886127fabadb335/api/api_test.go#L293 for example to skip tests |
go-llama.cpp | github_2023 | go | 164 | go-skynet | mudler | @@ -0,0 +1,60 @@
+package llama_test
+
+import (
+ "fmt"
+ "os"
+
+ . "github.com/go-skynet/go-llama.cpp"
+ . "github.com/onsi/ginkgo/v2"
+ . "github.com/onsi/gomega"
+)
+
+var _ = Describe("LLama binding", func() {
+ testModelPath := os.Getenv("TEST_MODEL")
+
+ Context("Declaration", func() {
+ It("fails with no mode... | ```suggestion
``` |
go-llama.cpp | github_2023 | others | 95 | go-skynet | mudler | @@ -145,6 +145,7 @@ endif
ifeq ($(BUILD_TYPE),metal)
EXTRA_LIBS=
+ CGO_LDFLAGS+="-framework Accelerate -framework Foundation -framework Metal -framework MetalKit -framework MetalPerformanceShaders" | 🤦 feeling guilty, good catch! |
go-llama.cpp | github_2023 | go | 28 | go-skynet | deadprogram | @@ -23,7 +25,14 @@ func New(model string, opts ...ModelOption) (*LLama, error) {
return nil, fmt.Errorf("failed loading model")
}
- return &LLama{state: result}, nil
+ ll := &LLama{state: result}
+
+ // set a finalizer to remove any callbacks when the struct is reclaimed by the garbage collector.
+ runtime.SetFi... | I have not had much success with this pattern in Go. Not being able to control when the finalizer kicks in can sometimes result in unexpected behavior..
In GoCV we require the caller manually release the C memory. To help prevent leaks we use a custom profiler used when running the unit tests.
Anyhow, just mentio... |
biomes-game | github_2023 | python | 26 | ill-inc | aabtop | @@ -4,13 +4,29 @@
import shutil
import subprocess
import sys
+import os
+VENV_PATH = '.venv'
def check_version():
version = sys.version_info
- if version.major != 3 or version.minor < 8:
- raise Exception("This script requires Python 3.8 or higher.")
+ if version.major != 3 or version.minor < ... | > I thought I addressed this and your latest merge would have fixed the issue, but apparently not. Unfortunately I can't dig in too much right now because I'm on a plane. I'll take another look later, but I would like to get this in soon.
Ahh, so after looking at the new errors more closely, they are real, and cause... |
biomes-game | github_2023 | typescript | 8 | ill-inc | turtlesoupy | @@ -211,12 +211,14 @@ export const SplashPage: React.FunctionComponent<{
const [playYoutubeTrailer, setPlayYoutubeTrailer] = useState(false);
return (
- <>
- <Head>
- <meta name="theme-color" content="#1C0D28" />
- <meta name="viewport" content="width=device-width, initial-scale=1" />
- ... | Can you check the root page too? I think it is index.tsx — I believe it does something different than splash |
biomes-game | github_2023 | typescript | 8 | ill-inc | turtlesoupy | @@ -54,7 +54,7 @@ export const BiomesHeadTag: React.FunctionComponent<BiomesHeadTagProps> = (
export default function Index({}: {}) {
return (
<RootErrorBoundary>
- <BiomesHeadTag />
+ <BiomesHeadTag description="Biomes is an open source sandbox MMORPG built for the web using web technologies" /> | Can you make this the default in that head tag? |
biomes-game | github_2023 | typescript | 7 | ill-inc | turtlesoupy | @@ -26,6 +26,12 @@ export const SplashHeader: React.FunctionComponent<{
/>
</div>
<div className="flex gap-[16px]">
+ <a target="_blank" href="https://github.com/ill-inc/biomes-game">
+ GitHub
+ </a>
+ <a target="_blank" href="https://www.x.com/illdotinc"> | The linter has a legit comment here about noreferrer! |
Leetbuddy.nvim | github_2023 | others | 31 | Dhanus3133 | Dhanus3133 | @@ -64,6 +64,19 @@ LeetBuddy.nvim allows you to customize certain aspects of its behavior. You can
require('leetbuddy').setup({
domain = "com" -- `cn` for chinese leetcode
language = "py",
+ keys = {
+ -- Overwrites the key to select the question
+ select = "<Space>",
+ -- These repl... | ```suggestion
keys = {
select = "<CR>",
reset = "<C-r>",
easy = "<C-e>",
medium = "<C-d>",
hard = "<C-h>",
accepted = "<C-a>",
not_started = "<C-y>",
tried = "<C-t>",
}
``` |
Leetbuddy.nvim | github_2023 | others | 31 | Dhanus3133 | Dhanus3133 | @@ -5,6 +5,16 @@ local default_config = {
directory = vim.loop.os_homedir() .. sep .. ".leetcode",
language = "py",
debug = false,
+ keys = {
+ select = "<CR>",
+ reset = "<A-r>",
+ easy = "<A-e>",
+ medium = "<A-m>",
+ hard = "<A-h>",
+ accepted = "<A-a>",
+ not_started = "<A-y>",
+ t... | ```suggestion
keys = {
select = "<CR>",
reset = "<C-r>",
easy = "<C-e>",
medium = "<C-m>",
hard = "<C-h>",
accepted = "<C-a>",
not_started = "<C-y>",
tried = "<C-t>",
},
``` |
pfr | github_2023 | others | 234 | teorth | YaelDillies | @@ -949,3 +949,5 @@ protected lemma AEFiniteKernelSupport.prodMkLeft [MeasurableSingletonClass S]
exact .of_discrete
end ProbabilityTheory.Kernel
+
+#min_imports | Accident? |
pfr | github_2023 | others | 232 | teorth | YaelDillies | @@ -21,13 +22,23 @@ example {A : Set G} {K : ℝ} (h₀A : A.Nonempty) (hA : Nat.card (A + A) ≤ K
/-- The improved version -/
example {A : Set G} {K : ℝ} (h₀A : A.Nonempty) (hA : Nat.card (A + A) ≤ K * Nat.card A) :
- ∃ (H : AddSubgroup G) (c : Set G),
+ ∃ (H : Submodule (ZMod 2) G) (c : Set G),
Nat.card c... | ```suggestion
``` |
pfr | github_2023 | others | 228 | teorth | YaelDillies | @@ -14,16 +15,29 @@ variable {Ω : Type uΩ} {S : Type uS} {T : Type uT} [mΩ : MeasurableSpace Ω]
/-- The assertion that the law of $X$ is the uniform probability measure on a finite set $H$.
While in applications $H$ will be non-empty finite set, $X$ measurable, and and $μ$ a probability
measure, it could be technica... | It did exist though 😅 (under the name `condCount`) |
pfr | github_2023 | others | 224 | teorth | YaelDillies | @@ -62,22 +62,27 @@ lemma mutualInfo_congr {κ η : Kernel T (S × U)} {μ : Measure T} (h : κ =ᵐ
rw [snd_apply, ht, snd_apply]
rw [entropy_congr h1, entropy_congr h2, entropy_congr h]
-lemma compProd_assoc (ξ : Kernel T S) [IsMarkovKernel ξ]
- (κ : Kernel (T × S) U) [IsMarkovKernel κ] (η : Kernel (T × S × U) ... | Can you please move that to a new file `PFR.Mathlib.MeasureTheory.MeasurableSpace.Embedding` so that it doesn't get lost in an otherwise unrelated file? I will soon start seriously upstreaming stuff from PFR and putting things where they belong is tremendously helpful for that. Thanks! |
pfr | github_2023 | others | 224 | teorth | YaelDillies | @@ -363,12 +365,20 @@ lemma rdist_add_const [IsProbabilityMeasure μ] [IsProbabilityMeasure μ']
B.rdist_eq hX' (hY'.add_const _), entropy_add_const hY' c, C, entropy_add_const]
exact hX'.sub hY'
+
+@[fun_prop]
+lemma Measurable.prod' {α β δ : Type*} {_ : MeasurableSpace α} {_ : MeasurableSpace β}
+ {_ : Measu... | Similarly, can this move to `PFR.Mathlib.MeasureTheory.Group.Arithmetic`? |
pfr | github_2023 | others | 224 | teorth | YaelDillies | @@ -236,7 +251,7 @@ lemma rdist_set_le (A B : Set G) [Finite A] [Finite B] (hA : A.Nonempty) (hB : B
· rw [Set.Nat.card_coe_set_eq,]
exact Set.ncard_eq_toFinset_card (A - B)
· exact isProbabilityMeasure_map (Measurable.aemeasurable measurable_sub)
- rw [Measure.map_apply measurable_sub (measurableSet_discre... | ```suggestion
rw [Measure.map_apply measurable_sub .of_discrete]
``` |
pfr | github_2023 | others | 224 | teorth | YaelDillies | @@ -66,7 +66,7 @@ lemma sum_measure_preimage_singleton' (μ : Measure Ω) [IsProbabilityMeasure μ
[Fintype T] [MeasurableSpace T] [MeasurableSingletonClass T] {Y : Ω → T} (hY : Measurable Y) :
∑ y : T, (μ (Y ⁻¹' {y})).toReal = 1 := by
rw [← ENNReal.toReal_sum, sum_measure_preimage_singleton] <;>
- simp [h... | ```suggestion
simp [hY .of_discrete, measure_ne_top]
``` |
pfr | github_2023 | others | 224 | teorth | YaelDillies | @@ -88,17 +88,17 @@ lemma sub_mem_symmGroup (hX : Measurable X) (hdist : d[X # X] = 0)
have hFY' : IndepFun F Y' := by
have : Measurable (fun z ↦ z - c) := measurable_sub_const' c
apply hindep.comp this measurable_id
- rw [indepFun_iff_measure_inter_preimage_eq_mul.1 hFY' _ _ hs $ ... | ```suggestion
rw [indepFun_iff_measure_inter_preimage_eq_mul.1 hFY' _ _ hs .of_discrete]
```
and below |
pfr | github_2023 | others | 224 | teorth | YaelDillies | @@ -198,7 +198,7 @@ lemma condIndep_copies (X : Ω → α) (Y : Ω → β) (hX : Measurable X) (hY :
rw [h1] at hy
have hy'' : μ (Y ⁻¹' {y}) ≠ 0 := by
convert hy
- exact (map_apply hY $ measurableSet_discrete _).symm
+ exact (map_apply hY $ .of_discrete).symm | ```suggestion
exact (map_apply hY .of_discrete).symm
``` |
pfr | github_2023 | others | 224 | teorth | YaelDillies | @@ -71,82 +105,112 @@ lemma deleteMiddle_compProd (ξ : Kernel α β) [IsSFiniteKernel ξ]
/-- Given a kernel taking values in a product of three spaces, forget the last variable. -/
noncomputable
def deleteRight (κ : Kernel α (β × γ × δ)) : Kernel α (β × γ) :=
- map κ (fun p ↦ (p.1, p.2.1)) (measurable_fst.prod_mk (me... | ```suggestion
``` |
pfr | github_2023 | others | 224 | teorth | YaelDillies | @@ -205,11 +206,13 @@ lemma condKernel_map_prod_mk_left {V : Type*} [Nonempty V] [MeasurableSpace V]
have h_preimage : (fun p ↦ (p.1, f p)) ⁻¹' (Prod.fst ⁻¹' {x.2}) = Prod.fst ⁻¹' {x.2} := by
ext p; simp
rw [condKernel_apply' _ _ _, condKernel_apply' _ _ h_ne_zero]; swap
- · rw [map_apply' _ _ _ (measurable... | I believe this works?
```suggestion
rw [map_apply' _ .of_discrete _ (measurable_fst (measurableSet_singleton _)), h_preimage]
``` |
pfr | github_2023 | others | 221 | teorth | YaelDillies | @@ -174,7 +174,8 @@ lemma PFR_conjecture_aux (h₀A : A.Nonempty) (hA : Nat.card (A + A) ≤ K * Nat
PFR_conjecture_pos_aux h₀A hA
let A' := A.toFinite.toFinset
have h₀A' : Finset.Nonempty A' := by
- simp [A', Finset.Nonempty]
+ simp only [Finset.Nonempty, Finite.toFinset_setOf, Finset.mem_filter, Finset.m... | ```suggestion
simp [A', Finset.Nonempty] using h₀A
```
is more robust to lemma renames |
pfr | github_2023 | others | 221 | teorth | YaelDillies | @@ -1240,7 +1235,7 @@ max (dimension A') (dimension A'') := by
convert zpow_neg K 17 using 1
norm_cast
calc (dimension B : ℝ)
- _ ≤ (((max (dimension A') (dimension A'')) : ℕ) : ℝ) := by norm_cast
+ _ ≤ (((max (dimension A') (dimension A'')) : ℕ) : ℝ) := Nat.cast_le.mpr hBdim | That's less robust than what was before |
pfr | github_2023 | others | 206 | teorth | YaelDillies | @@ -206,10 +212,10 @@ lemma rdist_zero_eq_half_ent [IsFiniteMeasure μ] [IsProbabilityMeasure μ'] :
measurability
measurability
simp [entropy_def, h]
- simp [rdist_def, entropy_const (0 : G), aux]
+ simp only [rdist_def, aux, entropy_const (0 : G), zero_div, sub_zero] | Why this change? |
pfr | github_2023 | others | 206 | teorth | YaelDillies | @@ -489,7 +496,7 @@ lemma condRuzsaDist_eq_sum {X : Ω → G} {Z : Ω → S} {Y : Ω' → G} {W : Ω
all_goals {
rw [Measure.map_apply ‹_›]
convert measure_empty
- simp [← FiniteRange.range]
+ simp only [← FiniteRange.range, Set.preimage_compl, Set.preimage_range, Set.compl_univ] | Similarly, why this change? |
pfr | github_2023 | others | 206 | teorth | YaelDillies | @@ -606,18 +615,21 @@ lemma condRuzsaDist'_prod_eq_sum {X : Ω → G} {Y : Ω' → G} {W W' : Ω' →
[IsFiniteMeasure μ'] [FiniteRange W] [FiniteRange W']:
d[X ; μ # Y | ⟨W', W⟩; μ']
= ∑ w in FiniteRange.toFinset W, (μ' (W ⁻¹' {w})).toReal * d[X ; μ # Y | W' ; (μ'[|W ← w])] := by
- have : d[X ; μ # Y | ⟨W', W... | This is a good change |
pfr | github_2023 | others | 206 | teorth | YaelDillies | @@ -152,19 +152,25 @@ lemma ProbabilityTheory.IndepFun.rdist_eq [IsFiniteMeasure μ]
rw [h_prod, entropy_def, Measure.map_map (measurable_fst.sub measurable_snd) (hX.prod_mk hY)]
rfl
-/-- $d[X;Y] ≤ H[X]/2 + H[Y]/2$. -/
-lemma rdist_le_avg_ent {X : Ω → G} {Y : Ω' → G} [FiniteRange X] [FiniteRange Y] (hX: Measurab... | If you want to reformat things, here's how statements should look like:
```suggestion
lemma rdist_le_avg_ent {X : Ω → G} {Y : Ω' → G} [FiniteRange X] [FiniteRange Y] (hX : Measurable X)
(hY : Measurable Y) (μ : Measure Ω := by volume_tac) (μ' : Measure Ω' := by volume_tac)
``` |
pfr | github_2023 | others | 206 | teorth | YaelDillies | @@ -795,16 +806,19 @@ lemma condRuzsaDist_of_copy {X : Ω → G} (hX : Measurable X) {Z : Ω → S} (h
all_goals {
rw [Measure.map_apply ‹_›]
convert measure_empty
- simp [← FiniteRange.range]
+ simp only [Finset.coe_union, ← FiniteRange.range, Set.compl_union, Set.preimage_inter,
+ Set.pr... | I consider `measurability` to be flexible input |
pfr | github_2023 | others | 206 | teorth | YaelDillies | @@ -49,14 +49,14 @@ variable [Nonempty H]
instance discreteUniform.isProbabilityMeasure : IsProbabilityMeasure (discreteUniform H) := by
rw [isProbabilityMeasure_iff, discreteUniform_apply, Set.univ_inter, ENNReal.div_self]
- . simp [Nat.pos_iff_ne_zero.mp Nat.card_pos]
+ . simp only [ne_eq, Nat.cast_eq_zero, ... | This simp is not preceding anything? |
pfr | github_2023 | others | 206 | teorth | YaelDillies | @@ -90,7 +90,7 @@ lemma isUniform_iff_uniform_dist {Ω : Type*} [mΩ : MeasurableSpace Ω] {μ: Me
simp only [Set.Finite.mem_toFinset, Set.mem_inter_iff, AHf] at hx
simp [hx]
intro x hx
- simp at hx
+ simp only [Set.Finite.mem_toFinset, Set.mem_inter_iff, not_and] at hx
... | This simp is preceding a simpa, which is flexible |
pfr | github_2023 | others | 206 | teorth | YaelDillies | @@ -554,19 +562,21 @@ lemma condRuzsaDist'_def (X : Ω → G) (Y : Ω' → G) (W : Ω' → T) (μ : Me
@[simp] lemma condRuzsaDist'_zero_right (X : Ω → G) (Y : Ω' → G) (W : Ω' → T) (μ : Measure Ω) :
d[X ; μ # Y | W ; 0] = 0 := by
- simp only [condRuzsaDist'_def, aemeasurable_zero_measure, not_true_eq_false, Measure.map_... | followed by measurability |
pfr | github_2023 | others | 206 | teorth | YaelDillies | @@ -604,18 +614,20 @@ lemma condRuzsaDist'_prod_eq_sum {X : Ω → G} {Y : Ω' → G} {W W' : Ω' →
[IsFiniteMeasure μ'] [FiniteRange W] [FiniteRange W']:
d[X ; μ # Y | ⟨W', W⟩; μ']
= ∑ w in FiniteRange.toFinset W, (μ' (W ⁻¹' {w})).toReal * d[X ; μ # Y | W' ; (μ'[|W ← w])] := by
- have : d[X ; μ # Y | ⟨W', W... | A (better) alternative
```suggestion
simpa using ht ω
```
|
pfr | github_2023 | others | 206 | teorth | YaelDillies | @@ -663,7 +675,7 @@ lemma condRuzsaDist'_eq_integral (X : Ω → G) {Y : Ω' → G} {W : Ω' → T}
have : (μ'.map W) (FiniteRange.toFinset W : Set T)ᶜ = 0 := by
rw [Measure.map_apply ‹_›]
convert measure_empty
- simp [← FiniteRange.range]
+ simp only [← FiniteRange.range, Set.preimage_compl, Set.preimage_ran... | followed by measurability |
pfr | github_2023 | others | 206 | teorth | YaelDillies | @@ -36,30 +36,24 @@ lemma finiteRange_of_finset {Ω G : Type*} (f: Ω → G) (A : Finset G) (h : ∀
exact h ω
lemma FiniteRange.range {Ω G : Type*} (X : Ω → G) [hX : FiniteRange X] :
- Set.range X = FiniteRange.toFinset X := by
- simp [FiniteRange.toFinset]
+ Set.range X = FiniteRange.toFinset X := by simp only... | not followed by anything |
pfr | github_2023 | others | 206 | teorth | YaelDillies | @@ -177,19 +183,20 @@ lemma rdist_of_inj {H:Type*} [hH : MeasurableSpace H] [MeasurableSingletonClass
have : φ ∘ (fun x ↦ x.1 - x.2) = g ∘ f := by
ext x
simp
- rw [this, ← MeasureTheory.Measure.map_map (g := g) (f := f) (measurable_of_countable _) (measurable_of_countable _), ← MeasureThe... | Maybe you could introduce `lemma Measurable.of_countable {f : α → β} := measurable_of_countable _` (put it in `PFR.Mathlib.MeasureTheory.MeasurableSpace.Basic`) so that this can become
```suggestion
convert Measure.map_prod_map _ _ .of_countable .of_countable
``` |
pfr | github_2023 | others | 206 | teorth | YaelDillies | @@ -876,7 +886,8 @@ lemma condRuzsaDist'_of_copy (X : Ω → G) {Y : Ω' → G} (hY : Measurable Y)
simp only [A]
rw [Measure.map_apply ‹_›]
convert measure_empty
- simp [← FiniteRange.range]
+ simp only [Finset.coe_union, ← FiniteRange.range, Set.compl_union, Set.preimage_inter,
+ Set.preimage_comp... | When reviewing, I am not going to flag every single occurrence of the same issue. You should be proactive and fix them all when I show you one or two occurrences. |
pfr | github_2023 | others | 206 | teorth | YaelDillies | @@ -189,9 +190,11 @@ lemma rdist_set_add_const (A B: Set G) [Finite A] [Finite B] [Nonempty A] [None
. exact Set.Nonempty.to_subtype (Set.Nonempty.add (Set.nonempty_coe_sort.mp ‹_›) (Set.singleton_nonempty _))
. exact Set.Nonempty.to_subtype (Set.Nonempty.add (Set.nonempty_coe_sort.mp ‹_›) (Set.singleton_nonempt... | Similarly here I have previously flagged the same issue but you have only fixed the locations I explicitly flagged |
pfr | github_2023 | others | 206 | teorth | YaelDillies | @@ -771,9 +773,9 @@ lemma single {Ω : Type u} [MeasurableSpace Ω] [DiscreteMeasurableSpace Ω] (μ
contrapose! hz
have : Disjoint {z} A := by simp [hz]
replace this := measureReal_union (μ := μ) this (measurableSet_discrete _)
- simp [hA] at this
+ simp only [singleton_union, hA] at this
have h := measureRe... | Maybe this all can be `simpa [this] using h`? Not sure, you should try |
pfr | github_2023 | others | 206 | teorth | YaelDillies | @@ -979,7 +983,7 @@ lemma dimension_of_shift {G: Type u} [AddCommGroup G]
rcases ha with ⟨ b, ⟨ hb, hb'⟩ ⟩
rw [Submodule.mem_map]
use b - v, hshift b hb
- simp [← hb']
+ simp only [map_sub, AddMonoidHom.coe_toIntLinearMap, AddSubgroup.coeSubtype, ← hb']
abel | abel is flexible |
pfr | github_2023 | others | 206 | teorth | YaelDillies | @@ -993,15 +997,15 @@ lemma conclusion_transfers {A B : Set G}
set f : G' → G := fun a ↦ (a : G) + x
have hf : Function.Injective f := by
intro y z hyz
- simp [f] at hyz
+ simp only [add_left_inj, SetLike.coe_eq_coe, f] at hyz
exact hyz | ```suggestion
simpa [f] using hyz
``` |
pfr | github_2023 | others | 206 | teorth | YaelDillies | @@ -1236,8 +1244,7 @@ theorem weak_PFR_int {A : Set G} [Finite A] (hnA : A.Nonempty) {K : ℝ} (hK : 0
rw [← log_mul (by positivity) _]
. apply log_le_log _ hA
norm_cast
- have : Nonempty (A-A) := by
- exact Set.Nonempty.coe_sort (Set.Nonempty.sub hnA hnA)
+ have : Nonempty (A-A) := Set.Nonempty.coe... | ```suggestion
have : Nonempty (A - A) := (hnA.sub hnA).coe_sort
``` |
pfr | github_2023 | others | 206 | teorth | YaelDillies | @@ -177,19 +183,19 @@ lemma rdist_of_inj {H:Type*} [hH : MeasurableSpace H] [MeasurableSingletonClass
have : φ ∘ (fun x ↦ x.1 - x.2) = g ∘ f := by
ext x
simp
- rw [this, ← MeasureTheory.Measure.map_map (g := g) (f := f) (measurable_of_countable _) (measurable_of_countable _), ← MeasureThe... | Using the new "anonymous dot notation",
```suggestion
convert Measure.map_prod_map _ _ .of_countable .of_countable
```
This also makes sure you put `Measurable.of_countable` in the right namespace |
pfr | github_2023 | others | 206 | teorth | YaelDillies | @@ -152,19 +152,25 @@ lemma ProbabilityTheory.IndepFun.rdist_eq [IsFiniteMeasure μ]
rw [h_prod, entropy_def, Measure.map_map (measurable_fst.sub measurable_snd) (hX.prod_mk hY)]
rfl
-/-- $d[X;Y] ≤ H[X]/2 + H[Y]/2$. -/
-lemma rdist_le_avg_ent {X : Ω → G} {Y : Ω' → G} [FiniteRange X] [FiniteRange Y] (hX: Measurab... | Here and elsewhere
```suggestion
(φ : G →+ H) (hφ : Injective φ) [IsProbabilityMeasure μ] [IsProbabilityMeasure μ' ]:
```
You will possibly need to `open Function` |
pfr | github_2023 | others | 206 | teorth | YaelDillies | @@ -771,10 +773,9 @@ lemma single {Ω : Type u} [MeasurableSpace Ω] [DiscreteMeasurableSpace Ω] (μ
contrapose! hz
have : Disjoint {z} A := by simp [hz]
replace this := measureReal_union (μ := μ) this (measurableSet_discrete _)
- simp [hA] at this
+ simp only [singleton_union, hA] at this
have h := measureR... | ```suggestion
simpa [this] using measureReal_mono (μ := μ) (show insert z A ⊆ Set.univ by simp)
``` |
pfr | github_2023 | others | 206 | teorth | YaelDillies | @@ -993,15 +996,14 @@ lemma conclusion_transfers {A B : Set G}
set f : G' → G := fun a ↦ (a : G) + x
have hf : Function.Injective f := by
intro y z hyz
- simp [f] at hyz
- exact hyz
+ simpa [f] using hyz
have hA' : A = f '' A' := by
simp_rw [hA, ← Set.image_vadd, Set.image_image, vadd_eq_add... | ```suggestion
simpa [g] using hyz
``` |
pfr | github_2023 | others | 206 | teorth | YaelDillies | @@ -1163,11 +1169,11 @@ lemma weak_PFR_asymm (A B : Set G) [Finite A] [Finite B] (hA : A.Nonempty) (hB :
. rw [hN]
exact QuotientAddGroup.subsingleton_quotient_top
infer_instance
- simp [this] at hdim
+ simp only [this, Nat.cast_one, log_one, zero_add] at hdim
rw [← le_div_iff' (by positivity)] a... | ```suggestion
convert le_trans ?_ hdim using 1
``` |
pfr | github_2023 | others | 206 | teorth | YaelDillies | @@ -36,19 +36,15 @@ lemma finiteRange_of_finset {Ω G : Type*} (f: Ω → G) (A : Finset G) (h : ∀
exact h ω
lemma FiniteRange.range {Ω G : Type*} (X : Ω → G) [hX : FiniteRange X] :
- Set.range X = FiniteRange.toFinset X := by
- simp [FiniteRange.toFinset]
+ Set.range X = FiniteRange.toFinset X := by simp [Fin... | ```suggestion
simp_rw [← Finset.mem_coe, ← FiniteRange.range X, Set.mem_range, exists_apply_eq_apply]
``` |
pfr | github_2023 | others | 206 | teorth | YaelDillies | @@ -618,25 +618,25 @@ end dim
variable {G : Type u} [AddCommGroup G] [Module.Free ℤ G] [Module.Finite ℤ G] [Countable G] [MeasurableSpace G] [MeasurableSingletonClass G]
-open Real MeasureTheory ProbabilityTheory Pointwise Set
+open Real MeasureTheory ProbabilityTheory Pointwise Set Function
/-- Move to Mathlib... | ```suggestion
convert this.id
``` |
pfr | github_2023 | others | 206 | teorth | YaelDillies | @@ -851,7 +851,7 @@ lemma weak_PFR_asymm_prelim (A B : Set G) [Finite A] [Finite B] (hnA : A.Nonempt
have ha : φ'.toFun ∘ UA = e.toFun ∘ X := by ext x; exact (he (UA x)).symm
have hb : φ'.toFun ∘ UB = e.toFun ∘ Y := by ext x; exact (he (UB x)).symm
- have he_inj : Function.Injective e.toFun := AddEquiv.i... | ```suggestion
have he_inj : Injective e := e.injective
``` |
pfr | github_2023 | others | 209 | teorth | YaelDillies | @@ -10,6 +10,8 @@ namespace ProbabilityTheory
open MeasureTheory Set
open scoped BigOperators
+/- [TODO]: `sum_meas_smul_cond_fiber'` should substitute `sum_meas_smul_cond_fiber` in Mathlib once
+the definition of `FiniteRange` is in Mathlib.-/ | Note: I don't think we'll ever put `FiniteRange` in mathlib. @RemyDegenne can confirm/infirm, but I believe the plan is to directly shoot for the stars and get the integral version of entropy. |
pfr | github_2023 | others | 208 | teorth | YaelDillies | @@ -460,27 +460,31 @@ lemma ent_of_sub_smul_le {Y : Ω → G} [IsProbabilityMeasure μ] [Fintype G]
(hX: Measurable X) (hY: Measurable Y) (hindep: IndepFun X Y μ) {a : ℤ} :
H[X - a • Y; μ] - H[X; μ] ≤ 4 * |a| * d[X ; μ # Y ; μ] := by
- obtain ⟨Ω', mΩ', μ', nX'₁, Y', X'₂, hμ', hindep', hnX'₁, hY', hX'₂, idX₁, i... | ```suggestion
let φ : Fin 3 → G → G := ![-id, id, id]
```
if you fancy |
pfr | github_2023 | others | 192 | teorth | YaelDillies | @@ -82,10 +82,36 @@ variable {Ω Ω' Ω'' Ω''' G T : Type*}
variable {X : Ω → G} {Y : Ω' → G} {Z : Ω'' → G} [FiniteRange X] [FiniteRange Y] [FiniteRange Z]
+-- Mathlib PR #12918 has been merged.
+@[to_additive]
+lemma ProbabilityTheory.IdentDistrib.inv {α : Type*} {β : Type*} {γ : Type*}
+ [MeasurableSpace α] [Mea... | You should merge master into your branch to remove the lemma |
pfr | github_2023 | others | 183 | teorth | YaelDillies | @@ -38,9 +38,9 @@ lemma nat_cauchy_schwartz {B : Type*} [Fintype B] (v w : B → ℕ) :
lemma nat_cauchy_schwartz' {X : Type*} (B : Finset X) (v w : X → ℕ) :
(B.sum (v * w))^2 ≤ B.sum (v^2) * B.sum (w^2) := by
have := nat_cauchy_schwartz (fun b : B => v b) (fun b : B => w b)
- rwa [← (show Finset.univ.sum (fun b : ... | Just making you aware that the following is possibly a better fix
```suggestion
rwa [← (show Finset.univ.sum (fun b : B => (v * w) b) = B.sum (v * w) from Finset.sum_attach ..),
← (show Finset.univ.sum (fun b : B => (v^2 : X → ℕ) b) = B.sum (v^2) from Finset.sum_attach ..),
← (show Finset.univ.sum (fun b ... |
pfr | github_2023 | others | 172 | teorth | YaelDillies | @@ -115,7 +115,7 @@ lemma condEntropy_mul_right (hX : Measurable X) (hY : Measurable Y) :
condEntropy_of_injective μ hX hY (fun y x ↦ x * y) mul_left_injective
/-- $$H[X / Y | Y] = H[X | Y]$$ -/
-@[to_additive "$$H[X - Y | Y] = H[X | Y]$$"]
+@[to_additive "$$H[Y - X | Y] = H[X | Y]$$"] | You should fix both the additive and multiplicative docstrings |
pfr | github_2023 | others | 159 | teorth | sgouezel | @@ -109,8 +109,23 @@ lemma FiniteRange.full {Ω G : Type*} [MeasurableSpace Ω] [MeasurableSpace G] [
ext ω; simp
measurability
-lemma FiniteRange.null_of_compl {Ω G : Type*} [MeasurableSpace Ω] [MeasurableSpace G] [MeasurableSingletonClass G] {X : Ω → G} (hX: Measurable X) [FiniteRange X] (μ: Measure Ω) : (μ.map... | You don't need `hX` here: otherwise, `mu.map X` is the zero measure, so the conclusion is obviously true. |
pfr | github_2023 | others | 137 | teorth | YaelDillies | @@ -0,0 +1,27 @@
+import Mathlib.Data.Fintype.Basic
+
+namespace Fintype
+
+variable {α : Type*} [Fintype α]
+
+def elem (i : α) : Finset.univ (α := α) := ⟨i, Fintype.complete i⟩
+
+theorem elem_bijective : Function.Bijective Fintype.elem (α := α) :=
+ ⟨ fun _ _ ↦ Subtype.mk_eq_mk.mp, Function.LeftInverse.surjective (... | Can you do without introducing this? We don't want this in mathlib. |
pfr | github_2023 | others | 130 | teorth | YaelDillies | @@ -227,133 +227,89 @@ variable {ι Ω : Type*} {κ : ι → Type*} {α : ∀ i, κ i → Type*} [Measu
[IsProbabilityMeasure μ] {m : ∀ i j, MeasurableSpace (α i j)} {f : ∀ i j, Ω → α i j}
[Fintype ι] [∀ i, Fintype (κ i)]
--- Below, two approaches
-
-/-- If a family of functions `i j ↦ f i j` is independent, then the famil... | I think we should not delete these. `iIndepFun.pi` is the correct lemma to prove, even if it's not the one we've managed to prove first. |
pfr | github_2023 | others | 131 | teorth | YaelDillies | @@ -287,73 +331,76 @@ lemma exists_indexfn {ι ι': Type*} [hι': Nonempty ι'] {ST : ι' → Finset
simp [this, hi]
variable {ι ι' : Type*} {α : ι → Type*} [hι': Nonempty ι']
- {n : (i : ι) → MeasurableSpace (α i)} {f : (i : ι) → Ω → α i} {hf : (i : ι) → Measurable (f i)} {ST : ι' → Finset ι} (hS : Pairwise (Disjoin... | How do you feel about this lemma now that you've proved the "correct" one? Do you think this one should go in mathlib, or should we ditch it? |
pfr | github_2023 | others | 126 | teorth | YaelDillies | @@ -94,8 +96,168 @@ lemma goursat (H : AddSubgroup (G × G')): ∃ (H₀ : AddSubgroup G) (H₁ : Ad
exact h_bij'
rw [Nat.card_eq_of_bijective bij h_bij, Nat.card_prod H₀ H₁]
+
+/- TODO: Find an appropriate home for these lemmas -/
+lemma Nat.card_image_le {α β: Type*} {s : Set α} {f : α → β} (hs : s.Finite) :
+ Na... | Does it help to write it like this?
```suggestion
let B := A - {0} ×ˢ S
``` |
pfr | github_2023 | others | 84 | teorth | llllvvuu | @@ -306,16 +306,120 @@ lemma entropy_eq_log_card {X : Ω → S} (hX : Measurable X) (μ : Measure Ω) (
rw [entropy_def, measureEntropy_eq_card_iff_measure_eq, Measure.map_apply hX MeasurableSet.univ]
simp
+lemma Finset.Nonempty_image {α β : Type*} [DecidableEq β]
+{s : Finset α} (hs : s.Nonempty) (f : α → β) : (s.i... | are we allowed to add these assumptions?
- `Nonempty S` is already added via `variables` in this file
- we can derive `hμ'` and `NeZero \mu` via `rcases` (the statement degenerates if either is false)
- IIRC I didn't need `hX`
- `hbd` should be WLOG but not sure how to formalize it |
pfr | github_2023 | others | 69 | teorth | sgouezel | @@ -291,9 +291,9 @@ lemma entropy_comm
exact (entropy_comp_of_injective μ (hX.prod_mk hY) Prod.swap Prod.swap_injective).symm
/-- $H[(X,Y),Z] = H[X,(Y,Z)]$. -/
-lemma entropy_assoc [MeasurableSingletonClass S] [MeasurableSingletonClass T] [MeasurableSingletonClass U]
- (hX : Measurable X) (hY : Measurable Y) (... | This change is wrong, you should have indentation by 4 spaces. |
pfr | github_2023 | others | 69 | teorth | sgouezel | @@ -483,12 +484,15 @@ lemma chain_rule (μ : Measure Ω) [IsProbabilityMeasure μ] (hX : Measurable X)
rw [entropy_comm hX hY, chain_rule' μ hY hX]
/-- Another form of the chain rule: $H[X|Y] = H[X,Y] - H[Y]. -/
-lemma chain_rule'' (μ : Measure Ω) [IsProbabilityMeasure μ] (hX : Measurable X) (hY : Measurable Y) : H[... | ditto |
pfr | github_2023 | others | 69 | teorth | sgouezel | @@ -483,12 +484,15 @@ lemma chain_rule (μ : Measure Ω) [IsProbabilityMeasure μ] (hX : Measurable X)
rw [entropy_comm hX hY, chain_rule' μ hY hX]
/-- Another form of the chain rule: $H[X|Y] = H[X,Y] - H[Y]. -/
-lemma chain_rule'' (μ : Measure Ω) [IsProbabilityMeasure μ] (hX : Measurable X) (hY : Measurable Y) : H[... | ditto. (And the proof should also have only two spaces of indentation). |
pfr | github_2023 | others | 65 | teorth | teorth | @@ -41,8 +41,9 @@ variable (p : refPackage Ω₀₁ Ω₀₂ G)
variable {Ω : Type*} [mΩ : MeasureSpace Ω] [IsProbabilityMeasure (ℙ : Measure Ω)]
variable (X₁ X₂ X₁' X₂' : Ω → G)
+ (hX₁ : Measurable X₁) (hX₂ : Measurable X₂) (hX₁' : Measurable X₁') (hX₂' : Measurable X₂') | Yes, I think we will need measurability hypotheses like this throughout the paper (of course in the end they will all be automatic because all our spaces are finite with the discrete sigma alegbra). In retrospect we probably should have worked with a "bundled" random variable class in which the measurability hypothese... |
pfr | github_2023 | others | 65 | teorth | teorth | @@ -63,14 +64,28 @@ local notation3 "I₁" => I[ U : V | S ]
local notation3 "I₂" => I[ U : W | S ]
/-- The quantity $I_3 = I[V:W|S]$ is equal to $I_2$. -/
-lemma I₃_eq : I[ V : W | S ] = I₂ := by sorry
+lemma I₃_eq : I[ V : W | S ] = I₂ := by
+ sorry | OK. You can relinquish it for now (by leaving a comment on the Zulip), and I will update the list to indicate the remaining task to establish here if you would like someone else to take over. |
pfr | github_2023 | others | 21 | teorth | YaelDillies | @@ -223,7 +223,7 @@ lemma measureEntropy_le_log_card [MeasurableSingletonClass S] (μ : Measure S) :
rw [Fintype.card_eq_zero]
simp
| inr h =>
- refine log_nonneg ?_
+ apply log_nonneg | This is a regression IMO. It's hard to know what `apply` does and that has unexpected behavior. |
pfr | github_2023 | others | 21 | teorth | YaelDillies | @@ -132,10 +132,8 @@ lemma strictConcaveOn_negIdMulLog : StrictConcaveOn ℝ (Set.Ici (0 : ℝ)) negI
lemma sum_negIdMulLog_le {S : Type*} [Fintype S] {w : S → ℝ} {p : S → ℝ} (h0 : ∀ s, 0 ≤ w s)
(h1 : ∑ s, w s = 1) (hmem : ∀ s, 0 ≤ p s) :
- ∑ s, (w s) * negIdMulLog (p s) ≤ negIdMulLog (∑ s, (w s) * (p s)) := by
... | This is one of the two changes I agree with. |
pfr | github_2023 | others | 21 | teorth | YaelDillies | @@ -139,11 +139,9 @@ lemma h_concave : ConcaveOn ℝ (Set.Icc 0 1) h := by
intro x hx
exact (h_deriv hx.1).differentiableAt.differentiableWithinAt
rw [interior_Icc]
- refine ((strictMonoOn_log.monotoneOn.mono ?_).neg.add_const (-1)).congr ?_
- · intro x hx
- exact hx.1
- · intro x hx
- rw [(h_deriv ... | And this is the second one. |
pfr | github_2023 | others | 14 | teorth | kkytola | @@ -0,0 +1,378 @@
+import Mathlib.MeasureTheory.Measure.Typeclasses
+
+/-!
+# Measures as real valued-functions
+
+Given a measure `μ`, we define `μ.real` as the function sending a set `s` to `(μ s).toReal`, and
+develop a basic API around this.
+
+We essentially copy relevant lemmas from the files `MeasureSpaceDef.lea... | Is the correct design choice to state this assuming instance `[IsFiniteMeasure μ]` or is it better to assume `(h : μ univ ≠ ∞ := by finiteness)` and let the `finiteness` tactic fill in the proof in particular if an instance `[IsFiniteMeasure μ]` is around. One could argue that there are not many other ways in which the... |
jolpica-f1 | github_2023 | others | 140 | jolpica | jolpica | @@ -0,0 +1,8 @@
+# Community Projects
+
+Jolpica F1 is maintained by a small group of volunteers, but we welcome contributions from the wider F1 data community. This section highlights projects built by community members using our API.
+
+- [tap-f1](https://github.com/ReubenFrankel/tap-f1): A Singer tap for F1
+- [f1da... | ```suggestion
- [FormulaOne Card](https://github.com/marcokreeft87/formulaone-card): Home Assistant Card showing Formula One Data
``` |
jolpica-f1 | github_2023 | others | 134 | jolpica | jolpica | @@ -1,15 +1,15 @@
# jolpica-f1
-API for querying formula one data, with backwards compatible endpoints for the soon to be deprecated ergast api.
+Jolpica F1 is an open source API for querying Formula 1 data, with backwards compatible endpoints for the soon to be deprecated Ergast API.
+
+Jolpica F1 is maintained by a ... | ```suggestion
Jolpica F1 is maintained by a small group of volunteers. Our hosting costs are around $45 USD per month. If you want to support the project's ongoing development and improvements, please consider [donating to our Kofi]([url](https://ko-fi.com/jolpicaf1)). Our fundraising goal is to be break-even by the s... |
jolpica-f1 | github_2023 | python | 122 | jolpica | jolpica | @@ -1,7 +1,12 @@
-from .models import SessionEntry, SessionType
+from .models import Session, SessionEntry, SessionType
def run_data_correction(): | This should be fine as the data being reverted each time is cause by it being incorrect in Ergast.
So we only need to correct it after an import. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.