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
7 changes: 5 additions & 2 deletions .agents/skills/ptf-extract/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ input error.
blockers and set affected functions to `blocked`; otherwise set reviewed,
complete functions to `ready-for-implementation`.
4. Run `cargo run --manifest-path codegen/Cargo.toml -- validate` and fix
validation errors before finishing. Validation never justifies inferred
science.
validation errors before finishing. When a nontrivial formula expression is
repeated within one implementation, declare it once as an earlier local
implementation variable and reference that variable; retain the published
numeric lexemes and do not assign extra scientific semantics. Validation
never justifies inferred science.

## Output

Expand Down
8 changes: 6 additions & 2 deletions .agents/skills/ptf-generate/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ status when input validation fails; report the blocking input error.
generated structures and classes; `$defs` keys only resolve local references.
Do not infer missing science.
3. Validate, generate both retained targets, and run the required verification
gates. A generator capability gap is a blocker, never an invitation to
hand-write that computational target.
gates. Before validation, extract each repeated nontrivial formula
expression within a function into one earlier local implementation variable
and reference it thereafter; retain published numeric lexemes and do not
invent scientific semantics for the calculation intermediate. A generator
capability gap is a blocker, never an invitation to hand-write that
computational target.
4. After every required check passes, change the selected source functions from
`ready-for-implementation` to `implemented`, then revalidate, regenerate,
and prove the second generation pass is idempotent.
Expand Down
4 changes: 2 additions & 2 deletions codegen/src/formula.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ pub(crate) enum ExprKind {
Grouped(Box<Expr>),
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub(crate) enum UnaryOp {
Plus,
Minus,
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub(crate) enum BinaryOp {
Add,
Subtract,
Expand Down
7 changes: 7 additions & 0 deletions codegen/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,16 @@ pub(crate) struct RawVariable {
#[derive(Clone, Debug)]
pub(crate) struct RawExpression {
pub(crate) implementation_path: String,
pub(crate) source_location: SourceLocation,
pub(crate) expression: crate::formula::Expr,
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub(crate) struct SourceLocation {
pub(crate) line: usize,
pub(crate) column: usize,
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
Loading