Skip to content

Decide where the remaining CSwFP exercises go #53

Open

Description

@arademaker

CSwFP.yaml still marks 14 CSwFP exercises as TODO, and scripts/check-cswfp.py lists them as "exercises still to decide". For each one, decide whether it becomes an exercise in CSwL (and where), is absorbed, or is dropped, and record the outcome in CSwFP.yaml.

  • 2.13 (p. 26): the higher-order function λfλx ↦ f (f x); was twice, no longer in the book
  • 4.5 (p. 68): a grammar for strings that also generates the empty string
  • 5.30 (p. 110): transitive closures of the relations of Exercise 2.7
  • 5.31 (p. 110): reflexive transitive closures of the same relations
  • 5.32 (p. 115): filter the facts of a knowledge base that mention a given entity
  • 6.5 (p. 141): an equivalent formula using only 0, s, ∗, +, <; goes with 6.5 to Logic/FOL
  • 6.6 (p. 146): what formula3 expresses when R is interpreted as <; goes with 6.5 to Logic/FOL
  • 9.10 (p. 237) to 9.16 (p. 259): exercises of sections 9.4–9.8, to be decided when those sections are written (Parsing: write the sections from CSwFP/9.7–9.8 #49)

CSwFP.yaml also has one section-level TODO: the reason for keeping CSwFP/7.2's Aristotle-to-Frege opening in Composition.

Activity

  1. added
    needs-decision
    on Nov 16, 2026
  2. arademaker commented on Nov 18, 2026

    @arademaker
    MemberAuthor

    9.10 stays here for now (decided while porting CSwFP/9.6, where the exercise sits).

    The exercise asks for a rule for complex determiners made of a determiner function and a numeral: less than n, more than n, at least n, at most n, exactly n. In the port it would mean a parser for numerals and a rule DET → DF NUM, so that e.g. prs "Less than 3 dwarfs smiled." has a parse.

    What blocks it:

    • The lexicon (Parsing/Lexicon.lean) is a fixed definition, and prs is tied to it. To add entries, the reader would have to define an extended lexicon and a prs that uses it, and that needs a way to parameterize the parsers by the lexicon that does not exist yet.
    • The lexicon only has less_than and more_than as DF. preproc produces at_least and at_most, but they are not in the lexicon, and there is nothing for exactly or for numerals.

    Exercise 9.13 (in 9.7) asks for the same rule with the parsers of 9.7, and has the same obstacle.

  3. arademaker commented on Nov 19, 2026

    @arademaker
    MemberAuthor

    Exercise 9.10 is now complex-det, in Parsing/Categories.lean (#62).

    The obstacle above was half real. The parsers of the rules never consult the lexicon; only prs did, through collectCats, which already took the lexicon as an argument. So prs is now parseWith lexicon parseSent, where parseWith takes the lexicon and the parser. The reader defines lexicon' (the missing DF entries at_least, at_most, exactly, and digit strings as NUM, in place of a parser for numerals), complexDetRule (DET → DF NUM), complexNpRule, and parseNP' := parseNP <|> complexNpRule, tested with parseWith lexicon' parseNP' and native_decide.

    What stays open: the rules are fixed. sRule calls parseNP, and vpRule parses objects through parseNPsorPPs, so a whole sentence such as Less than 3 dwarfs smiled would need the chain of rules redefined or parameterized by the NP parser. The exercise is therefore scoped to the noun phrase. Exercise 9.13 asks for the same rule with the parsers of 9.7 and meets the same question.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-decision

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions