Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/lib/commons/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ export type FunctorPropertyAssignment = Replace<
>

export type Lemma = {
id: string
title: string
claim: string
proof: string
Expand Down
5 changes: 5 additions & 0 deletions src/routes/category-implications/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@
well.
</p>

<p class="hint">
In some cases, implications are a bit too rigid, which is why we also provide a small
collection of <a href="/lemmas">lemmas</a>.
</p>

<button class="button" onclick={toggle}>
{#if show_deduced_implications}
Hide deduced implications
Expand Down
9 changes: 1 addition & 8 deletions src/routes/lemma/[id]/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,13 @@ import { batch, query } from '$lib/server/db.catdat'
import { render_nested_formulas } from '$lib/server/rendering'
import { error } from '@sveltejs/kit'
import sql from 'sql-template-tag'
import type { EntryGenerator } from './$types'

export const entries: EntryGenerator = async () => {
const { rows, err } = query<{ id: string }>(sql`SELECT id FROM lemmas`)
if (err) throw new Error('Database error: Failed to load tags')
return rows
}

export const load = async (event) => {
const id = event.params.id

const { results, err } = batch<[Lemma, CategoryShort, { id: string }]>([
sql`
SELECT title, claim, proof FROM lemmas WHERE id = ${id}
SELECT id, title, claim, proof FROM lemmas WHERE id = ${id}
`,
sql`
SELECT c.id, c.name
Expand Down
15 changes: 15 additions & 0 deletions src/routes/lemmas/+page.server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { Lemma } from '$lib/commons/types'
import { query } from '$lib/server/db.catdat'
import { render_nested_formulas } from '$lib/server/rendering'
import { error } from '@sveltejs/kit'
import sql from 'sql-template-tag'

export const load = async (event) => {
const { rows: lemmas, err } = query<Lemma>(
sql`SELECT id, title, claim, proof FROM lemmas ORDER BY lower(title)`,
)

if (err) error(500, 'Could not load lemmas')

return { lemmas }
}
24 changes: 24 additions & 0 deletions src/routes/lemmas/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<script lang="ts">
import MetaData from '$components/MetaData.svelte'
import SuggestionForm from '$components/SuggestionForm.svelte'

let { data } = $props()
</script>

<MetaData title="Lemmas" />

<h2>Lemmas</h2>

<p class="hint">
These are reusable lemmas used in multiple proofs of categorical properties in CatDat.
</p>

<ul>
{#each data.lemmas as lemma (lemma.id)}
<li>
<a href="/lemma/{lemma.id}">{lemma.title}</a>
</li>
{/each}
</ul>

<SuggestionForm />