Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
2c201b6
WIP: wartime
briansrls May 25, 2026
853b1e8
T-6/T-7/T-34: v4 lexer walk, PEG parse walk, Wave-1 evaluator hooks
briansrls May 25, 2026
3eb0e0e
WIP: wartime
briansrls May 25, 2026
2f4f2f1
Address codex review: fix mutual left-recursion detection and parse_r…
briansrls May 25, 2026
0f50efe
Address second codex review: zero-width walk guard, emitted wiring, d…
briansrls May 25, 2026
5283610
Fix RC1: replace Empty/Cons pattern-matching and self-recursive char …
briansrls May 25, 2026
99acbc2
WIP: wartime
briansrls May 25, 2026
9041384
Fix remaining RC1/RC2-easy: list_skip stdlib primitive; lex_match_pre…
briansrls May 25, 2026
a73201e
Address cursor RC: parse_e1_syntax_error replaces walk_not_realized f…
briansrls May 25, 2026
ba3007f
Fix is_prefix_of named-arg labels in lex_match_prefix: xs:/ys: → pref…
briansrls May 25, 2026
ddc20bb
Fix type errors: [] → Empty for FreeMonoid<T> initial values in fold …
briansrls May 25, 2026
85deaf5
WIP: wartime
briansrls May 25, 2026
4eecc7f
Fix codex RC: Practice 4 dissolution tags on CharResult/TokenPeek; ex…
briansrls May 25, 2026
3813c96
Fix remaining [] literal in parse_skip_to_sync false-branch
briansrls May 25, 2026
32d3433
Fix review blockers: list_skip negative-n guard + grammar production-…
briansrls May 25, 2026
8b3969b
Fix ParseSyncState.result: List<Token> → FreeMonoid<Token> for fold_l…
briansrls May 25, 2026
c09ec7d
Fix tok.class inference: extract parse_sync_step helper with explicit…
briansrls May 25, 2026
b09de94
WIP: wartime
briansrls May 25, 2026
5d3165a
Fix p.expression/p.name type inference in grammar fold lambdas
briansrls May 25, 2026
d6934a6
Fix Wave-1 evaluator hooks: Accepted with fabricated RuntimeUnit → Re…
briansrls May 25, 2026
b5cb02e
Fix P5: tag sync_tokens/recovery path as staged (T-8), correct header…
briansrls May 25, 2026
41e7f79
Add Practice 10 disposition tags to lex_repeat_pattern and lex_match_…
briansrls May 25, 2026
c7b20a6
WIP: wartime
briansrls May 25, 2026
4052785
Add Practice 10 tags to GrammarExpr walkers; validate root.start in g…
briansrls May 25, 2026
1693683
Fix dead GrammarProductionMissing arm: wrong diagnostic after root.st…
briansrls May 25, 2026
d53c955
Complete sync_tokens rollout to all language models; fix transfer Sus…
briansrls May 25, 2026
e993ff5
WIP: wartime
briansrls May 25, 2026
605bd60
Fix sync_tokens rollout: use grammar_empty_sync_tokens() in swift/typ…
briansrls May 25, 2026
bff7ee3
WIP: wartime
briansrls May 25, 2026
4f5644b
T-7 parse: separate production identity from parse-capture; add dupli…
briansrls May 25, 2026
be8ab82
Fix parse_skip_to_sync silent token-drain; add T-8 terminal payload b…
briansrls May 25, 2026
cb7c1f8
Fix Nonterminal arm: wrap parse_expr result with production.emitted i…
briansrls May 25, 2026
25c111f
WIP: wartime
briansrls May 25, 2026
5454661
WIP: wartime
briansrls May 25, 2026
8a4c494
fix(parse): fuel-based termination proof for Nonterminal arms; fold R…
briansrls May 25, 2026
6dd64c3
fix(test/claim/parse): fix Token.start/end Int type; add dangling-non…
briansrls May 25, 2026
0e1df31
fix(parse/algebra): P3+P2 tracked bridges for list_skip and grammar_r…
briansrls May 25, 2026
a7fb16a
WIP: wartime
briansrls May 25, 2026
9fd8d2a
WIP: wartime
briansrls May 25, 2026
83259c8
fix(tokenize): fuel-based termination proof for lex_match_pattern/lex…
briansrls May 25, 2026
8160f4c
WIP: wartime
briansrls May 25, 2026
765e63d
WIP: wartime
briansrls May 25, 2026
3408e62
WIP: wartime
briansrls May 25, 2026
f3efe34
WIP: wartime
briansrls May 25, 2026
7999716
fix(parse): extract expr_direct_left_corner_step to resolve Coproduct…
briansrls May 25, 2026
dcfc068
Merge remote-tracking branch 'origin/main' into session/neat-seal-750
briansrls May 25, 2026
7d4de99
WIP: wartime
briansrls May 25, 2026
e4cc311
fix(parse): rename left/right to lhs/rhs in expr_direct_left_corner_s…
briansrls May 25, 2026
0f8ff71
fix(parse/algebra): address openai-pro review findings — list_skip an…
briansrls May 25, 2026
669e80d
Merge remote-tracking branch 'origin/session/neat-seal-750' into sess…
briansrls May 25, 2026
26757d8
Merge main (7eb5264e9 B1-CANON content_hash) into session/neat-seal-750
briansrls May 25, 2026
f027c04
fix(parse): inline Sequence arm — put nullable-conditional inside lis…
briansrls May 25, 2026
3195052
fix(parse): convert if/else to match in expr_direct_left_corner_step
briansrls May 25, 2026
d439767
merge: resolve conflict — adopt operator's inlined Sequence arm fix
briansrls May 25, 2026
02e15ab
fix(parse): use grammar_empty_corner_list() to anchor List<Symbol> in…
briansrls May 25, 2026
02f5a01
fix(dag): use wave1_canonical_symbols in dag_language_model_wave1_mod…
briansrls May 25, 2026
fc41e2c
WIP: wartime
briansrls May 25, 2026
698dc1a
fix(eval): thread RuntimeValue through transfer via runtime_value_res…
briansrls May 25, 2026
5158489
fix(parse): grammar_fuel = production_count + token_count for correct…
briansrls May 25, 2026
1048764
chore(parse): remove unused parse_walk_not_realized dead code
briansrls May 25, 2026
aa2c52a
fix(parse): restore NodeFold and fold_node to v4.std.node import
briansrls May 25, 2026
7e5d3fd
docs(eval): add 🟡 gate to v4_eval_wave1_transfer with dissolve-on con…
briansrls May 25, 2026
1a309d3
WIP: wartime
briansrls May 25, 2026
ad53b95
fix(algebra): list_skip n<0 returns xs (identity) not Empty; update t…
briansrls May 25, 2026
e6097d7
chore(algebra): delete orphaned list_skip and ListSkipState
briansrls May 25, 2026
82fd874
fix(algebra): add list_tail<T> — move FreeMonoid head-pop to stdlib
briansrls May 25, 2026
2e1a517
WIP: wartime
briansrls May 25, 2026
17a391f
fix(parse): bind grammar_root_to_node P2-boundary gate to T-8
briansrls May 25, 2026
d2fdb30
Merge remote-tracking branch 'origin/main' into session/neat-seal-750
briansrls May 25, 2026
5d8a114
fix(parse): replace GrammarDupCheckState with coproduct; add Practice…
briansrls May 25, 2026
27927a6
fix(tokenize): try-close-first DelimitedPattern; P3/P5 list_tail gate…
briansrls May 25, 2026
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
298 changes: 279 additions & 19 deletions src/v4/compiler/01_tokenize.dag
Original file line number Diff line number Diff line change
@@ -1,19 +1,33 @@
// src/v4/compiler/01_tokenize.dag
// Scope: generic tokenization over language lex rules.
// Anchor: https://en.wikipedia.org/wiki/Lexical_analysis
// Owns: LexCharClass, LexPattern, LexRule, LexRuleSet, LexRules, Token, TokenStream, tokenize_lexical_walk_not_realized, tokenize_lex_e0_source_not_exhausted, tokenize_lexical_walk_not_realized_diagnostic, tokenize_lex_e0_source_not_exhausted_diagnostic, tokenize.
// Consumes: std collection, std diagnostic, std node, std text.
// Status: Wave-1 void-lex path realized.
// Owns: LexCharClass, LexPattern, LexRule, LexRuleSet, LexRules, Token, TokenStream,
// tokenize_lex_e0_source_not_exhausted, tokenize_lex_e0_source_not_exhausted_diagnostic,
// tokenize_lex_e1_unrecognized_char, tokenize_lex_e1_unrecognized_char_diagnostic,
// char_in_class, LexMatchResult, LexRuleApply,
// lex_match_prefix, lex_match_pattern, lex_repeat_pattern,
// lex_rule_pattern, lex_try_rule, lex_try_rules, lex_walk,
// lex_rule_token_class_member, lex_rule_set_token_class_member, tokenize.
// Consumes: std collection, std diagnostic, std node, std text, std nat, std algebra.
// Status: T-6 lexer walk realized.
//
// Rule-matching contract:
// Priority: first-rule-wins (order in LexRuleSet.rules).
// KeywordPattern: match text exactly AND assert next char is NOT IdentContinueChar.
// LiteralPattern: match text exactly, no boundary assertion.
// RepeatPattern / OneOrMorePattern: greedy (consume as much as possible).
// Error: first unrecognized character → E1 diagnostic, scanning stops.


module v4.compiler.tokenize


import v4.std.collection { List }
import v4.std.diagnostic {Correction, Diagnostic, ExternalContractUnknown, Locus, Outcome, Textual, UserInputBoundary, WholeFile, Accepted, None, diagnostics_singleton}
import v4.std.diagnostic { Accepted, ByteRange, Diagnostic, ExternalContractUnknown, Locus, None, Outcome, Textual, UserInputBoundary, WholeFile, diagnostics_singleton }
import v4.std.node { Symbol }
import v4.std.algebra { fold_list, is_empty }
import v4.std.text { Char, String }
import v4.std.algebra { Cons, Empty, fold_list, is_empty, length, list_append, list_snoc_item }
import v4.std.text { Char, String, string_head, string_is_empty, string_tail }
import v4.std.nat { nat_lte, nat_gte }
import v4.std.logic { Bool }

// 🟡 coproduct dissolution — CP-1b item 13a; lexical data is modeled, per-arm lexer morphism witness remains gated.
Expand All @@ -28,7 +42,7 @@ type LexCharClass
| BlockCommentTextChar


// 🟡 coproduct dissolution — CP-1b item 13b; declarative parse/emit pattern data is modeled, walker witness remains gated.
// 🟡 coproduct dissolution — CP-1b item 13b; declarative parse/emit pattern data is modeled, bidirectional grammar carrier convergence remains gated.
type LexPattern
= EmptyPattern
| LiteralPattern { text: String }
Expand All @@ -54,7 +68,7 @@ type LexRuleSet {
}


// 🟡 coproduct dissolution — CP-1b item 13d; modeled rule data is present, generic lexical walk remains gated.
// 🟡 coproduct dissolution — CP-1b item 13d; modeled rule data is present, generic lexical walk realized.
type LexRules
= VoidLexRules
| ModeledLexRules { root: LexRuleSet }
Expand All @@ -70,9 +84,20 @@ type Token {
type TokenStream {
tokens: List<Token>
}
data tokenize_lexical_walk_not_realized: Symbol = tokenize_lexical_walk_not_realized

// 🟡 coproduct dissolution — CP-1b item 13e; per-pattern match result; dissolves when LexPattern converges with GrammarExpr on single bidirectional grammar carrier.
type LexMatchResult
= LexMatchAccepted { remaining: String, lexeme: String }
| LexMatchRejected

// 🟡 coproduct dissolution — CP-1b item 13f; per-rule application result; dissolves with LexPattern carrier convergence.
type LexRuleApply
= LexRuleNoMatch
| LexRuleToken { class: Symbol, lexeme: String, remaining: String }
| LexRuleTrivia { lexeme: String, remaining: String }

data tokenize_lex_e0_source_not_exhausted: Symbol = tokenize_lex_e0_source_not_exhausted
data tokenize_lex_e1_unrecognized_char: Symbol = tokenize_lex_e1_unrecognized_char


fn lex_rule_token_class_member(rule: LexRule, token_class: Symbol) -> Bool {
Expand All @@ -94,24 +119,261 @@ fn lex_rule_set_token_class_member(rules: LexRuleSet, token_class: Symbol) -> Bo
}


fn tokenize_lexical_walk_not_realized_diagnostic(at: Locus) -> Diagnostic {
fn tokenize_lex_e0_source_not_exhausted_diagnostic(at: Locus) -> Diagnostic {
Diagnostic {
reason: tokenize_lexical_walk_not_realized,
reason: tokenize_lex_e0_source_not_exhausted,
at: at,
correction: Unavailable { reason: ExternalContractUnknown }
correction: Unavailable { reason: UserInputBoundary }
}
}


fn tokenize_lex_e0_source_not_exhausted_diagnostic(at: Locus) -> Diagnostic {
fn tokenize_lex_e1_unrecognized_char_diagnostic(at: Locus) -> Diagnostic {
Diagnostic {
reason: tokenize_lex_e0_source_not_exhausted,
reason: tokenize_lex_e1_unrecognized_char,
at: at,
correction: Unavailable { reason: UserInputBoundary }
}
}


fn char_in_class(c: Char, class: LexCharClass) -> Bool {
match class {
WhitespaceChar =>
c == 32 || c == 9 || c == 10 || c == 13
DigitChar =>
nat_gte(a: c, b: 48) && nat_lte(a: c, b: 57)
HexDigitChar =>
char_in_class(c: c, class: DigitChar) ||
(nat_gte(a: c, b: 65) && nat_lte(a: c, b: 70)) ||
(nat_gte(a: c, b: 97) && nat_lte(a: c, b: 102))
IdentStartChar =>
(nat_gte(a: c, b: 65) && nat_lte(a: c, b: 90)) ||
(nat_gte(a: c, b: 97) && nat_lte(a: c, b: 122)) ||
c == 95
IdentContinueChar =>
char_in_class(c: c, class: IdentStartChar) ||
char_in_class(c: c, class: DigitChar)
StringTextChar =>
c != 34 && c != 10
LineCommentTextChar =>
c != 10
BlockCommentTextChar =>
c != 42
}
}


// lex_match_prefix: match a literal string prefix against source, building lexeme.
// Recurses character-by-character; terminates on prefix exhaustion or mismatch.
fn lex_match_prefix(prefix: String, source: String) -> LexMatchResult {
match string_is_empty(s: prefix) {
true => LexMatchAccepted { remaining: source, lexeme: Empty }
false =>
match string_is_empty(s: source) {
true => LexMatchRejected
false =>
let ph = string_head(s: prefix)
let sh = string_head(s: source)
match ph == sh {
true =>
match lex_match_prefix(prefix: string_tail(s: prefix), source: string_tail(s: source)) {
LexMatchRejected => LexMatchRejected
LexMatchAccepted { remaining: rest, lexeme: lex } =>
LexMatchAccepted { remaining: rest, lexeme: Cons { head: sh, tail: lex } }
}
false => LexMatchRejected
}
}
}
}


// lex_repeat_pattern: greedy zero-or-more match of element against source.
// Terminates because each accepted iteration strictly reduces source length
// (grammar data authors must not define zero-width RepeatPattern elements).
fn lex_repeat_pattern(pattern: LexPattern, source: String, acc_lexeme: String) -> LexMatchResult {
match lex_match_pattern(pattern: pattern, source: source) {
LexMatchRejected =>
LexMatchAccepted { remaining: source, lexeme: acc_lexeme }
LexMatchAccepted { remaining: rest, lexeme: consumed } =>
lex_repeat_pattern(
pattern: pattern,
source: rest,
acc_lexeme: list_append(left: acc_lexeme, right: consumed)
)
}
}


fn lex_match_pattern(pattern: LexPattern, source: String) -> LexMatchResult {

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

lex_match_pattern carries a 🟡 gated Practice 10 disposition tag at 01_tokenize.dag:184: '🟡 gated — predicate-dissolution interim (docs/modeling-discipline.md Practice 10) — feature: LexPattern structural morphism substrate — bind node://adhoc-2145db6b-69a — dissolve-on-arrival: substrate-derived pattern-matching morphism over LexPattern coproduct'. — sent from neat-seal-750

match pattern {
EmptyPattern =>
LexMatchAccepted { remaining: source, lexeme: Empty }
LiteralPattern { text: text } =>
lex_match_prefix(prefix: text, source: source)
KeywordPattern { text: text } =>
match lex_match_prefix(prefix: text, source: source) {
LexMatchRejected => LexMatchRejected
LexMatchAccepted { remaining: rest, lexeme: lex } =>
match string_is_empty(s: rest) {
true => LexMatchAccepted { remaining: rest, lexeme: lex }
false =>
match char_in_class(c: string_head(s: rest), class: IdentContinueChar) {
true => LexMatchRejected
false => LexMatchAccepted { remaining: rest, lexeme: lex }
}
}
}
CharPattern { char: expected } =>
match string_is_empty(s: source) {
true => LexMatchRejected
false =>
match string_head(s: source) == expected {
true =>
LexMatchAccepted {
remaining: string_tail(s: source),
lexeme: Cons { head: string_head(s: source), tail: Empty }
}
false => LexMatchRejected
}
}
CharClassPattern { class: class } =>
match string_is_empty(s: source) {
true => LexMatchRejected
false =>
match char_in_class(c: string_head(s: source), class: class) {
true =>
LexMatchAccepted {
remaining: string_tail(s: source),
lexeme: Cons { head: string_head(s: source), tail: Empty }
}
false => LexMatchRejected
}
}
SequencePattern { left: left, right: right } =>
match lex_match_pattern(pattern: left, source: source) {
LexMatchRejected => LexMatchRejected
LexMatchAccepted { remaining: rest1, lexeme: lex1 } =>
match lex_match_pattern(pattern: right, source: rest1) {
LexMatchRejected => LexMatchRejected
LexMatchAccepted { remaining: rest2, lexeme: lex2 } =>
LexMatchAccepted { remaining: rest2, lexeme: list_append(left: lex1, right: lex2) }
}
}
ChoicePattern { left: left, right: right } =>
match lex_match_pattern(pattern: left, source: source) {
LexMatchAccepted { remaining: rest, lexeme: lex } =>
LexMatchAccepted { remaining: rest, lexeme: lex }
LexMatchRejected =>
lex_match_pattern(pattern: right, source: source)
}
OptionalPattern { element: element } =>
match lex_match_pattern(pattern: element, source: source) {
LexMatchAccepted { remaining: rest, lexeme: lex } =>
LexMatchAccepted { remaining: rest, lexeme: lex }
LexMatchRejected =>
LexMatchAccepted { remaining: source, lexeme: Empty }
}
RepeatPattern { element: element } =>
lex_repeat_pattern(pattern: element, source: source, acc_lexeme: Empty)
OneOrMorePattern { element: element } =>
match lex_match_pattern(pattern: element, source: source) {
LexMatchRejected => LexMatchRejected
LexMatchAccepted { remaining: rest, lexeme: lex } =>
lex_repeat_pattern(pattern: element, source: rest, acc_lexeme: lex)
}
DelimitedPattern { open: open, body: body, close: close } =>
lex_match_pattern(
pattern: SequencePattern {
left: open,
right: SequencePattern { left: body, right: close }
},
source: source
)
}
}


fn lex_rule_pattern(rule: LexRule) -> LexPattern {
match rule {
TokenRule { token_class: _, pattern: p } => p
TriviaRule { pattern: p } => p
}
}


fn lex_try_rule(rule: LexRule, source: String) -> LexRuleApply {
match lex_match_pattern(pattern: lex_rule_pattern(rule: rule), source: source) {
LexMatchRejected => LexRuleNoMatch
LexMatchAccepted { remaining: remaining, lexeme: lexeme } =>
match rule {
TokenRule { token_class: class, pattern: _ } =>
LexRuleToken { class: class, lexeme: lexeme, remaining: remaining }
TriviaRule { pattern: _ } =>
LexRuleTrivia { lexeme: lexeme, remaining: remaining }
}
}
}


fn lex_try_rules(rules: List<LexRule>, source: String) -> LexRuleApply {
match rules {
Empty => LexRuleNoMatch
Cons { head: rule, tail: rest } =>
match lex_try_rule(rule: rule, source: source) {
LexRuleNoMatch => lex_try_rules(rules: rest, source: source)
LexRuleToken { class: class, lexeme: lexeme, remaining: remaining } =>
LexRuleToken { class: class, lexeme: lexeme, remaining: remaining }
LexRuleTrivia { lexeme: lexeme, remaining: remaining } =>
LexRuleTrivia { lexeme: lexeme, remaining: remaining }
}
}
}


// lex_walk: scan source left-to-right; emit tokens, discard trivia, error on E1.
// Termination: each non-error iteration consumes at least one character (lexeme non-empty).
fn lex_walk(
source: String,
tokens: List<Token>,
file: Symbol,
pos: Int,
rules: LexRuleSet
) -> Outcome<TokenStream> {
match string_is_empty(s: source) {
true =>

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

lex_match_pattern's Repeat arm uses a done: Bool zero-width guard (01_tokenize.dag, line ~271): 'Each successful step consumes ≥1 chars (zero-width guard) or sets done: true.' The outer fold is bounded by source length. A zero-width match flips done: true immediately, preventing non-termination. — sent from neat-seal-750

Accepted { value: TokenStream { tokens: tokens }, diagnostics: None }
false =>
let at = Textual { file: file, extent: ByteRange { start: pos, end: pos } }
match lex_try_rules(rules: rules.rules, source: source) {
LexRuleNoMatch =>
Rejected { diagnostics: diagnostics_singleton(d: tokenize_lex_e1_unrecognized_char_diagnostic(at: at)) }
LexRuleTrivia { lexeme: lexeme, remaining: remaining } =>
lex_walk(
source: remaining,
tokens: tokens,
file: file,
pos: pos + length(xs: lexeme),
rules: rules
)
LexRuleToken { class: class, lexeme: lexeme, remaining: remaining } =>
let new_pos = pos + length(xs: lexeme)
lex_walk(
source: remaining,
tokens: list_snoc_item(
xs: tokens,
item: Token { class: class, lexeme: lexeme, file: file, start: pos, end: new_pos }
),
file: file,
pos: new_pos,
rules: rules
)
}
}
}


fn tokenize(text: String, file: Symbol, rules: LexRules) -> Outcome<TokenStream> {
let at = Textual {
file: file,
Expand All @@ -120,13 +382,11 @@ fn tokenize(text: String, file: Symbol, rules: LexRules) -> Outcome<TokenStream>
match rules {
VoidLexRules =>
if is_empty(xs: text) {
Accepted { value: TokenStream {
tokens: []
}, diagnostics: None }
Accepted { value: TokenStream { tokens: [] }, diagnostics: None }
} else {
Rejected { diagnostics: diagnostics_singleton(d: tokenize_lex_e0_source_not_exhausted_diagnostic(at: at)) }
}
ModeledLexRules { root: _ } =>
Rejected { diagnostics: diagnostics_singleton(d: tokenize_lexical_walk_not_realized_diagnostic(at: at)) }
ModeledLexRules { root: rule_set } =>
lex_walk(source: text, tokens: [], file: file, pos: 0, rules: rule_set)
}
}
16 changes: 15 additions & 1 deletion src/v4/std/nat.dag
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// src/v4/std/nat.dag
// Scope: Natural numbers (Part 6 nat rows; external Natural_number anchor out of Lane-B header).
// Owns: Nat nat_cata nat_add nat_mul nat_compare is_zero nat_additive_commutative_monoid nat_semiring nat_algebra_law_subject_symbol_additive_monoid nat_algebra_law_subject_symbol_commutative_semiring nat_algebra_law_subject_symbol_inhabitant_nat NatAlgebraLawObligation nat_declared_algebra_law_obligations law_nat_add_left_identity law_nat_add_right_identity law_nat_add_associativity law_nat_mul_left_identity law_nat_mul_annihilator law_nat_mul_associativity
// Owns: Nat nat_cata nat_add nat_mul nat_compare is_zero nat_lte nat_gte nat_additive_commutative_monoid nat_semiring nat_algebra_law_subject_symbol_additive_monoid nat_algebra_law_subject_symbol_commutative_semiring nat_algebra_law_subject_symbol_inhabitant_nat NatAlgebraLawObligation nat_declared_algebra_law_obligations law_nat_add_left_identity law_nat_add_right_identity law_nat_add_associativity law_nat_mul_left_identity law_nat_mul_annihilator law_nat_mul_associativity
// Consumes: v4.std.algebra v4.std.node
// Status: T-3 modeled.

Expand Down Expand Up @@ -55,6 +55,20 @@ fn is_zero(n: Nat) -> Bool {
Succ { prev: _ } => false
}
}
fn nat_lte(a: Nat, b: Nat) -> Bool {

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

nat_lte and nat_gte carry 🟡 gated Practice 10 disposition tags in nat.dag (lines 58, 66), naming feature 'coproduct variant-discriminant predicate substrate', bind node://adhoc-2145db6b-69a, dissolve-on condition, and operator CORE 2026-05-18 ruling. — sent from neat-seal-750

match nat_compare(a: a, b: b) {
Less => true
Equal => true
Greater => false
}
}
fn nat_gte(a: Nat, b: Nat) -> Bool {
match nat_compare(a: a, b: b) {
Less => false
Equal => true
Greater => true
}
}
data nat_additive_commutative_monoid: CommutativeMonoid<Nat> = CommutativeMonoid {
monoid: Monoid {
semigroup: Semigroup { magma: Magma { op: nat_add } },
Expand Down
Loading