Skip to content

Chapters 10 and 13 - #69

Open
felipponn wants to merge 16 commits into
cslib-community:mainfrom
felipponn:main
Open

Chapters 10 and 13#69
felipponn wants to merge 16 commits into
cslib-community:mainfrom
felipponn:main

Conversation

@felipponn

Copy link
Copy Markdown

In this pull request, we use the TimeM monad and systematically extends the codebase to support time complexity analysis for algorithms in Chapter 13, including Fibonacci, binomial coefficients, and the knapsack problem.

Beyond that, we create the structure for Chapter 10, choosing to implement the ThinBy multi-function as a predicate. All sections are implemented, and some exercises are suggested.

felipponn and others added 16 commits June 30, 2026 14:46
Under the current Lean/Mathlib toolchain, `simp only [..., decide_eq_true_eq,
<proj-lemmas>]` no longer strips `decide P = true` to `P` when projection
rfl-lemmas (`residue`/`count`/`value_add`/`weight_add`) are unfolded in the
same call: `decide_eq_true_eq` is reported unused and the goal stays wrapped
in `decide (…) = true`, so the following `constructor` / `calc` / `⟨_, _⟩`
steps fail (no `And` constructor; `calc` type mismatch; `Eq.refl` given 2
fields).

Fix: strip the `decide` in its own `simp only [_, decide_eq_true_eq]` pass
first, then unfold the projections in a second step. Three sites across the
two `key_fact` theorems (coin-change and knapsack). No statements changed;
the whole `Fad` library builds again (8696 jobs, 0 errors).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AbkMyCwYRAiUy3NFwn9M4f
@arademaker

Copy link
Copy Markdown
Member

API.lean duplicates code from CSLib. Let's get rid of it.

@arademaker

arademaker commented Sep 8, 2026

Copy link
Copy Markdown
Member

@felipponn, I couldn't find the example you showed me using the Query model. Can you double-check whether you submitted it?

@felipponn

Copy link
Copy Markdown
Author

@BXimenaGomez123, could we review the existing code and consider switching the API.lean import for a direct CSLib import?

Comment thread Fad/Chapter13.lean
@@ -1,6 +1,9 @@
import Fad.Chapter1
import Fad.Chapter10
import Fad.API

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be avoided. We can follow Chapter2, using directly the CSLib definitions already available, we import it.

@arademaker arademaker mentioned this pull request Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants