Open
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #681 +/- ##
==========================================
- Coverage 97.04% 97.03% -0.01%
==========================================
Files 284 286 +2
Lines 38037 38267 +230
==========================================
+ Hits 36914 37134 +220
- Misses 1123 1133 +10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Add the Additional Key problem from relational database theory (Garey & Johnson SR7). Given a relational schema (R, F) and known candidate keys K, determines whether R has a candidate key not in K. - Model file with closure computation, minimality check, and known-key filter - 13 unit tests covering creation, evaluation, edge cases, brute force, serialization - CLI create support with --num-attributes, --dependencies, --relation-attrs, --known-keys - Module registration and re-exports - Canonical example-db entry with regenerated fixtures Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Implement the AdditionalKey satisfaction problem from relational database theory (Garey & Johnson A4 SR27). Includes model, CLI registration, unit tests, and example-db entry.
Add problem-def entry, display name, and bibliography reference (Beeri & Bernstein, 1979) for the Additional Key problem from relational database theory. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
Implementation SummaryChanges
Deviations from Plan
Open Questions
Verification
|
There was a problem hiding this comment.
Pull request overview
Adds a new NP-complete satisfaction model, AdditionalKey, representing the “additional candidate key” problem from relational database theory, and wires it into the library exports, CLI instance creation, examples, and paper.
Changes:
- Introduce
AdditionalKeymodel (schema registration, evaluation via FD closure + minimality + exclusion from known keys, example-db spec). - Add unit tests covering evaluation behavior, brute force solving, and serde round-trip.
- Extend CLI
pred createwith new flags/parsing forAdditionalKey, and add an example-db fixture plus paper reference/definition.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/models/misc/additional_key.rs |
New AdditionalKey model implementation, schema registration, variants declaration, and example-db spec. |
src/unit_tests/models/misc/additional_key.rs |
Unit tests for correctness, solver integration, and serialization. |
src/models/misc/mod.rs |
Registers the new misc module, re-exports AdditionalKey, and includes its example specs. |
src/models/mod.rs |
Re-exports AdditionalKey from models::misc. |
src/lib.rs |
Adds AdditionalKey to the crate prelude exports. |
problemreductions-cli/src/cli.rs |
Adds AdditionalKey CLI flags to CreateArgs and the “Flags by problem type” help section. |
problemreductions-cli/src/commands/create.rs |
Adds AdditionalKey instance parsing/creation and an example invocation string. |
src/example_db/fixtures/examples.json |
Adds an AdditionalKey model fixture with sample/optimal satisfying configs. |
docs/paper/references.bib |
Adds Beeri & Bernstein (1979) reference. |
docs/paper/reductions.typ |
Adds paper definition block and display name mapping for AdditionalKey. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+119
to
+125
| } | ||
| } | ||
| // Sort known_keys entries internally for consistent comparison | ||
| let known_keys: Vec<Vec<usize>> = known_keys | ||
| .into_iter() | ||
| .map(|mut k| { | ||
| k.sort_unstable(); |
| //! dependencies F) that is not in K. A candidate key is a minimal set of | ||
| //! attributes whose closure under F covers all of R. | ||
| //! | ||
| //! The problem is NP-complete (Garey & Johnson, SR7). |
Comment on lines
+75
to
+76
| /// Panics if any attribute index is >= `num_attributes`, or if | ||
| /// `relation_attrs` contains duplicates. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add the
AdditionalKeysatisfaction problem model from relational database theory (Garey & Johnson A4 SR27). This NP-complete problem asks whether a relational schema has a candidate key not in a given set of known keys.Fixes #445