Skip to main content

alimentar/
generated_contracts.rs

1// Auto-generated contract assertions from YAML — DO NOT EDIT.
2// Zero cost in release builds (debug_assert!).
3// Regenerate: pv codegen contracts/ -o src/generated_contracts.rs
4// Include:   #[macro_use] #[allow(unused_macros)] mod generated_contracts;
5
6// Auto-generated from contracts/absolute-position-v1.yaml — DO NOT EDIT
7// Contract: absolute-position-v1
8
9/// Preconditions for equation `absolute_position_add`.
10/// Domain-specific. Call: `contract_pre_absolute_position_add!(slice_expr)`
11macro_rules! contract_pre_absolute_position_add {
12    () => {{}};
13    ($input:expr) => {{
14        let indices = &$input;
15        debug_assert!(
16            indices.len() > 0,
17            "Contract absolute_position_add: precondition violated — indices.len() > 0"
18        );
19    }};
20}
21
22// Auto-generated from contracts/activation-kernel-v1.yaml — DO NOT EDIT
23// Contract: activation-kernel-v1
24
25/// Preconditions for equation `gelu`.
26/// Domain-specific. Call: `contract_pre_gelu!(slice_expr)`
27macro_rules! contract_pre_gelu {
28    () => {{}};
29    ($input:expr) => {{
30        let x = &$input;
31        debug_assert!(
32            x.iter().all(|v| v.is_finite()),
33            "Contract gelu: precondition violated — x.iter().all(|v| v.is_finite())"
34        );
35        debug_assert!(
36            x.len() > 0,
37            "Contract gelu: precondition violated — x.len() > 0"
38        );
39    }};
40}
41
42/// Preconditions for equation `relu`.
43/// Domain-specific. Call: `contract_pre_relu!(slice_expr)`
44macro_rules! contract_pre_relu {
45    () => {{}};
46    ($input:expr) => {{
47        let x = &$input;
48        debug_assert!(
49            x.iter().all(|v| v.is_finite()),
50            "Contract relu: precondition violated — x.iter().all(|v| v.is_finite())"
51        );
52        debug_assert!(
53            x.len() > 0,
54            "Contract relu: precondition violated — x.len() > 0"
55        );
56    }};
57}
58
59/// Preconditions for equation `silu`.
60/// Domain-specific. Call: `contract_pre_silu!(slice_expr)`
61macro_rules! contract_pre_silu {
62    () => {{}};
63    ($input:expr) => {{
64        let x = &$input;
65        debug_assert!(
66            x.iter().all(|v| v.is_finite()),
67            "Contract silu: precondition violated — x.iter().all(|v| v.is_finite())"
68        );
69        debug_assert!(
70            x.len() > 0,
71            "Contract silu: precondition violated — x.len() > 0"
72        );
73    }};
74}
75
76// Auto-generated from contracts/active-learning-v1.yaml — DO NOT EDIT
77// Contract: active-learning-v1
78
79/// Preconditions for equation `entropy_score`.
80/// Domain-specific. Call: `contract_pre_entropy_score!(slice_expr)`
81macro_rules! contract_pre_entropy_score {
82    () => {{}};
83    ($input:expr) => {{
84        let input = &$input;
85        debug_assert!(
86            input.len() > 0,
87            "Contract entropy_score: precondition violated — input.len() > 0"
88        );
89        debug_assert!(
90            input.iter().all(|v| v.is_finite()),
91            "Contract entropy_score: precondition violated — input.iter().all(|v| v.is_finite())"
92        );
93    }};
94}
95
96/// Preconditions for equation `margin_score`.
97/// Domain-specific. Call: `contract_pre_margin_score!(slice_expr)`
98macro_rules! contract_pre_margin_score {
99    () => {{}};
100    ($input:expr) => {{
101        let input = &$input;
102        debug_assert!(
103            input.len() > 0,
104            "Contract margin_score: precondition violated — input.len() > 0"
105        );
106        debug_assert!(
107            input.iter().all(|v| v.is_finite()),
108            "Contract margin_score: precondition violated — input.iter().all(|v| v.is_finite())"
109        );
110    }};
111}
112
113/// Preconditions for equation `qbc_score`.
114/// Domain-specific. Call: `contract_pre_qbc_score!(slice_expr)`
115macro_rules! contract_pre_qbc_score {
116    () => {{}};
117    ($input:expr) => {{
118        let input = &$input;
119        debug_assert!(
120            input.len() > 0,
121            "Contract qbc_score: precondition violated — input.len() > 0"
122        );
123        debug_assert!(
124            input.iter().all(|v| v.is_finite()),
125            "Contract qbc_score: precondition violated — input.iter().all(|v| v.is_finite())"
126        );
127    }};
128}
129
130/// Preconditions for equation `uncertainty_score`.
131/// Domain-specific. Call: `contract_pre_uncertainty_score!(slice_expr)`
132macro_rules! contract_pre_uncertainty_score {
133    () => {{}};
134    ($input:expr) => {{
135        let input = &$input;
136        debug_assert!(input.len() > 0,
137            "Contract uncertainty_score: precondition violated — input.len() > 0");
138        debug_assert!(input.iter().all(|v| v.is_finite()),
139            "Contract uncertainty_score: precondition violated — input.iter().all(|v| v.is_finite())");
140    }};
141}
142
143// Auto-generated from contracts/adamw-kernel-v1.yaml — DO NOT EDIT
144// Contract: adamw-kernel-v1
145
146/// Preconditions for equation `adam_moments`.
147/// Domain-specific. Call: `contract_pre_adam_moments!(slice_expr)`
148macro_rules! contract_pre_adam_moments {
149    () => {{}};
150    ($input:expr) => {{
151        let params = &$input;
152        debug_assert!(
153            params.len() > 0,
154            "Contract adam_moments: precondition violated — params.len() > 0"
155        );
156    }};
157}
158
159/// Preconditions for equation `adam_variance`.
160/// Domain-specific. Call: `contract_pre_adam_variance!(slice_expr)`
161macro_rules! contract_pre_adam_variance {
162    () => {{}};
163    ($input:expr) => {{
164        let params = &$input;
165        debug_assert!(
166            params.len() > 0,
167            "Contract adam_variance: precondition violated — params.len() > 0"
168        );
169    }};
170}
171
172/// Preconditions for equation `bias_correction`.
173/// Domain-specific. Call: `contract_pre_bias_correction!(slice_expr)`
174macro_rules! contract_pre_bias_correction {
175    () => {{}};
176    ($input:expr) => {{
177        let params = &$input;
178        debug_assert!(
179            params.len() > 0,
180            "Contract bias_correction: precondition violated — params.len() > 0"
181        );
182    }};
183}
184
185/// Preconditions for equation `weight_update`.
186/// Domain-specific. Call: `contract_pre_weight_update!(slice_expr)`
187macro_rules! contract_pre_weight_update {
188    () => {{}};
189    ($input:expr) => {{
190        let params = &$input;
191        debug_assert!(
192            params.len() > 0,
193            "Contract weight_update: precondition violated — params.len() > 0"
194        );
195    }};
196}
197
198// Auto-generated from contracts/alibi-kernel-v1.yaml — DO NOT EDIT
199// Contract: alibi-kernel-v1
200
201/// Preconditions for equation `alibi_bias`.
202/// Domain-specific. Call: `contract_pre_alibi_bias!(slice_expr)`
203macro_rules! contract_pre_alibi_bias {
204    () => {{}};
205    ($input:expr) => {{
206        let indices = &$input;
207        debug_assert!(
208            indices.len() > 0,
209            "Contract alibi_bias: precondition violated — indices.len() > 0"
210        );
211    }};
212}
213
214/// Preconditions for equation `alibi_slopes`.
215/// Domain-specific. Call: `contract_pre_alibi_slopes!(slice_expr)`
216macro_rules! contract_pre_alibi_slopes {
217    () => {{}};
218    ($input:expr) => {{
219        let indices = &$input;
220        debug_assert!(
221            indices.len() > 0,
222            "Contract alibi_slopes: precondition violated — indices.len() > 0"
223        );
224    }};
225}
226
227// Auto-generated from contracts/apr-checkpoint-v1.yaml — DO NOT EDIT
228// Contract: apr-checkpoint-v1
229
230/// Preconditions for equation `identity`.
231/// Domain-specific. Call: `contract_pre_identity!(slice_expr)`
232macro_rules! contract_pre_identity {
233    () => {{}};
234    ($input:expr) => {{
235        let data = &$input;
236        debug_assert!(
237            !data.is_empty(),
238            "Contract identity: precondition violated — !data.is_empty()"
239        );
240        debug_assert!(
241            data.len() > 0,
242            "Contract identity: precondition violated — data.len() > 0"
243        );
244    }};
245}
246
247// Auto-generated from contracts/apr-format-invariants-v1.yaml — DO NOT EDIT
248// Contract: apr-format-invariants-v1
249
250/// Preconditions for equation `detect_regression`.
251/// Domain-specific. Call: `contract_pre_detect_regression!(slice_expr)`
252macro_rules! contract_pre_detect_regression {
253    () => {{}};
254    ($input:expr) => {{
255        let input = &$input;
256        debug_assert!(
257            input.len() > 0,
258            "Contract detect_regression: precondition violated — input.len() > 0"
259        );
260    }};
261}
262
263/// Preconditions for equation `format_report`.
264/// Domain-specific. Call: `contract_pre_format_report!(slice_expr)`
265macro_rules! contract_pre_format_report {
266    () => {{}};
267    ($input:expr) => {{
268        let input = &$input;
269        debug_assert!(
270            input.len() > 0,
271            "Contract format_report: precondition violated — input.len() > 0"
272        );
273    }};
274}
275
276/// Preconditions for equation `parse_playbook`.
277/// Domain-specific. Call: `contract_pre_parse_playbook!(slice_expr)`
278macro_rules! contract_pre_parse_playbook {
279    () => {{}};
280    ($input:expr) => {{
281        let input = &$input;
282        debug_assert!(
283            input.len() > 0,
284            "Contract parse_playbook: precondition violated — input.len() > 0"
285        );
286    }};
287}
288
289/// Preconditions for equation `serialize_roundtrip`.
290/// Domain-specific. Call: `contract_pre_serialize_roundtrip!(slice_expr)`
291macro_rules! contract_pre_serialize_roundtrip {
292    () => {{}};
293    ($input:expr) => {{
294        let input = &$input;
295        debug_assert!(
296            input.len() > 0,
297            "Contract serialize_roundtrip: precondition violated — input.len() > 0"
298        );
299    }};
300}
301
302/// Preconditions for equation `validate_schema`.
303/// Domain-specific. Call: `contract_pre_validate_schema!(slice_expr)`
304macro_rules! contract_pre_validate_schema {
305    () => {{}};
306    ($input:expr) => {{
307        let input = &$input;
308        debug_assert!(
309            input.len() > 0,
310            "Contract validate_schema: precondition violated — input.len() > 0"
311        );
312    }};
313}
314
315// Auto-generated from contracts/arch-constraints-v1.yaml — DO NOT EDIT
316// Contract: arch-constraints-v1
317
318/// Preconditions for equation `arch_constraint_lookup`.
319/// Domain-specific. Call: `contract_pre_arch_constraint_lookup!(slice_expr)`
320macro_rules! contract_pre_arch_constraint_lookup {
321    () => {{}};
322    ($input:expr) => {{
323        let input = &$input;
324        debug_assert!(
325            input.len() > 0,
326            "Contract arch_constraint_lookup: precondition violated — input.len() > 0"
327        );
328    }};
329}
330
331// Auto-generated from contracts/architecture-requirements-v1.yaml — DO NOT EDIT
332// Contract: architecture-requirements-v1
333
334/// Preconditions for equation `constraint_matrix_exhaustiveness`.
335/// Domain-specific. Call: `contract_pre_constraint_matrix_exhaustiveness!(slice_expr)`
336macro_rules! contract_pre_constraint_matrix_exhaustiveness {
337    () => {{}};
338    ($input:expr) => {{
339        let input = &$input;
340        debug_assert!(
341            input.len() > 0,
342            "Contract constraint_matrix_exhaustiveness: precondition violated — input.len() > 0"
343        );
344    }};
345}
346
347/// Preconditions for equation `role_mapping`.
348/// Domain-specific. Call: `contract_pre_role_mapping!(slice_expr)`
349macro_rules! contract_pre_role_mapping {
350    () => {{}};
351    ($input:expr) => {{
352        let input = &$input;
353        debug_assert!(
354            input.len() > 0,
355            "Contract role_mapping: precondition violated — input.len() > 0"
356        );
357    }};
358}
359
360/// Preconditions for equation `weight_completeness`.
361/// Domain-specific. Call: `contract_pre_weight_completeness!(slice_expr)`
362macro_rules! contract_pre_weight_completeness {
363    () => {{}};
364    ($input:expr) => {{
365        let input = &$input;
366        debug_assert!(
367            input.len() > 0,
368            "Contract weight_completeness: precondition violated — input.len() > 0"
369        );
370    }};
371}
372
373// Auto-generated from contracts/arima-v1.yaml — DO NOT EDIT
374// Contract: arima-v1
375
376/// Preconditions for equation `ar_forecast`.
377/// Domain-specific. Call: `contract_pre_ar_forecast!(slice_expr)`
378macro_rules! contract_pre_ar_forecast {
379    () => {{}};
380    ($input:expr) => {{
381        let input = &$input;
382        debug_assert!(
383            input.len() > 0,
384            "Contract ar_forecast: precondition violated — input.len() > 0"
385        );
386        debug_assert!(
387            input.iter().all(|v| v.is_finite()),
388            "Contract ar_forecast: precondition violated — input.iter().all(|v| v.is_finite())"
389        );
390    }};
391}
392
393/// Preconditions for equation `differencing`.
394/// Domain-specific. Call: `contract_pre_differencing!(slice_expr)`
395macro_rules! contract_pre_differencing {
396    () => {{}};
397    ($input:expr) => {{
398        let input = &$input;
399        debug_assert!(
400            input.len() > 0,
401            "Contract differencing: precondition violated — input.len() > 0"
402        );
403        debug_assert!(
404            input.iter().all(|v| v.is_finite()),
405            "Contract differencing: precondition violated — input.iter().all(|v| v.is_finite())"
406        );
407    }};
408}
409
410/// Preconditions for equation `forecast_finite`.
411/// Domain-specific. Call: `contract_pre_forecast_finite!(slice_expr)`
412macro_rules! contract_pre_forecast_finite {
413    () => {{}};
414    ($input:expr) => {{
415        let input = &$input;
416        debug_assert!(input.len() > 0,
417            "Contract forecast_finite: precondition violated — input.len() > 0");
418        debug_assert!(input.iter().all(|v| v.is_finite()),
419            "Contract forecast_finite: precondition violated — input.iter().all(|v| v.is_finite())");
420    }};
421}
422
423/// Preconditions for equation `ma_filter`.
424/// Domain-specific. Call: `contract_pre_ma_filter!(slice_expr)`
425macro_rules! contract_pre_ma_filter {
426    () => {{}};
427    ($input:expr) => {{
428        let input = &$input;
429        debug_assert!(
430            input.len() > 0,
431            "Contract ma_filter: precondition violated — input.len() > 0"
432        );
433        debug_assert!(
434            input.iter().all(|v| v.is_finite()),
435            "Contract ma_filter: precondition violated — input.iter().all(|v| v.is_finite())"
436        );
437    }};
438}
439
440// Auto-generated from contracts/attention-head-extraction-v1.yaml — DO NOT EDIT
441// Contract: attention-head-extraction-v1
442
443/// Preconditions for equation `identity`.
444/// Domain-specific. Call: `contract_pre_identity!(slice_expr)`
445macro_rules! contract_pre_identity {
446    () => {{}};
447    ($input:expr) => {{
448        let q = &$input;
449        debug_assert!(
450            q.len() > 0,
451            "Contract identity: precondition violated — q.len() > 0"
452        );
453    }};
454}
455
456// Auto-generated from contracts/attention-kernel-v1.yaml — DO NOT EDIT
457// Contract: attention-kernel-v1
458
459/// Preconditions for equation `attention`.
460/// Domain-specific. Call: `contract_pre_attention!(slice_expr)`
461macro_rules! contract_pre_attention {
462    () => {{}};
463    ($input:expr) => {{
464        let query = &$input;
465        debug_assert!(
466            query.len() > 0,
467            "Contract attention: precondition violated — query.len() > 0"
468        );
469    }};
470}
471
472/// Postconditions for equation `attention`.
473/// Call before return: `contract_post_attention!(result_expr)`
474macro_rules! contract_post_attention {
475    ($result:expr) => {{
476        let _contract_result = &$result;
477        debug_assert!(
478            _contract_result.iter().all(|v| v.is_finite()),
479            "Contract attention: postcondition violated — result.iter().all(|v| v.is_finite())"
480        );
481    }};
482}
483
484/// Combined pre+post contract for equation `attention`.
485macro_rules! contract_attention {
486    ($input:expr, $body:expr) => {{
487        contract_pre_attention!($input);
488        let _contract_result = $body;
489        contract_post_attention!(_contract_result);
490        _contract_result
491    }};
492}
493
494// Auto-generated from contracts/attention-scaling-v1.yaml — DO NOT EDIT
495// Contract: attention-scaling-v1
496
497/// Preconditions for equation `attention_entropy`.
498/// Domain-specific. Call: `contract_pre_attention_entropy!(slice_expr)`
499macro_rules! contract_pre_attention_entropy {
500    () => {{}};
501    ($input:expr) => {{
502        let q = &$input;
503        debug_assert!(
504            q.len() > 0,
505            "Contract attention_entropy: precondition violated — q.len() > 0"
506        );
507    }};
508}
509
510/// Preconditions for equation `numerical_stability`.
511/// Domain-specific. Call: `contract_pre_numerical_stability!(slice_expr)`
512macro_rules! contract_pre_numerical_stability {
513    () => {{}};
514    ($input:expr) => {{
515        let q = &$input;
516        debug_assert!(
517            q.len() > 0,
518            "Contract numerical_stability: precondition violated — q.len() > 0"
519        );
520    }};
521}
522
523/// Preconditions for equation `scaled_dot_product`.
524/// Domain-specific. Call: `contract_pre_scaled_dot_product!(slice_expr)`
525macro_rules! contract_pre_scaled_dot_product {
526    () => {{}};
527    ($input:expr) => {{
528        let a = &$input;
529        debug_assert!(
530            a.len() > 0,
531            "Contract scaled_dot_product: precondition violated — a.len() > 0"
532        );
533    }};
534}
535
536/// Preconditions for equation `score_bound_with_qknorm`.
537/// Domain-specific. Call: `contract_pre_score_bound_with_qknorm!(slice_expr)`
538macro_rules! contract_pre_score_bound_with_qknorm {
539    () => {{}};
540    ($input:expr) => {{
541        let input = &$input;
542        debug_assert!(input.iter().all(|v| v.is_finite()),
543            "Contract score_bound_with_qknorm: precondition violated — input.iter().all(|v| v.is_finite())");
544        debug_assert!(input.len() > 0,
545            "Contract score_bound_with_qknorm: precondition violated — input.len() > 0");
546    }};
547}
548
549/// Preconditions for equation `softmax_saturation`.
550/// Domain-specific. Call: `contract_pre_softmax_saturation!(slice_expr)`
551macro_rules! contract_pre_softmax_saturation {
552    () => {{}};
553    ($input:expr) => {{
554        let x = &$input;
555        debug_assert!(
556            x.iter().all(|v| v.is_finite()),
557            "Contract softmax_saturation: precondition violated — x.iter().all(|v| v.is_finite())"
558        );
559        debug_assert!(
560            x.len() > 0,
561            "Contract softmax_saturation: precondition violated — x.len() > 0"
562        );
563    }};
564}
565
566/// Preconditions for equation `variance_preservation`.
567/// Domain-specific. Call: `contract_pre_variance_preservation!(slice_expr)`
568macro_rules! contract_pre_variance_preservation {
569    () => {{}};
570    ($input:expr) => {{
571        let q = &$input;
572        debug_assert!(
573            q.len() > 0,
574            "Contract variance_preservation: precondition violated — q.len() > 0"
575        );
576    }};
577}
578
579// Auto-generated from contracts/avx2-fma-dot-v1.yaml — DO NOT EDIT
580// Contract: avx2-fma-dot-v1
581
582/// Preconditions for equation `dot_product`.
583/// Domain-specific. Call: `contract_pre_dot_product!(slice_expr)`
584macro_rules! contract_pre_dot_product {
585    () => {{}};
586    ($input:expr) => {{
587        let a = &$input;
588        debug_assert!(
589            a.len() > 0,
590            "Contract dot_product: precondition violated — a.len() > 0"
591        );
592    }};
593}
594
595/// Preconditions for equation `fma_accumulation`.
596/// Domain-specific. Call: `contract_pre_fma_accumulation!(slice_expr)`
597macro_rules! contract_pre_fma_accumulation {
598    () => {{}};
599    ($input:expr) => {{
600        let a = &$input;
601        debug_assert!(
602            a.len() > 0,
603            "Contract fma_accumulation: precondition violated — a.len() > 0"
604        );
605    }};
606}
607
608// Auto-generated from contracts/backend-dispatch-v1.yaml — DO NOT EDIT
609// Contract: backend-dispatch-v1
610
611/// Preconditions for equation `garbage_oracle`.
612/// Domain-specific. Call: `contract_pre_garbage_oracle!(slice_expr)`
613macro_rules! contract_pre_garbage_oracle {
614    () => {{}};
615    ($input:expr) => {{
616        let input = &$input;
617        debug_assert!(
618            input.len() > 0,
619            "Contract garbage_oracle: precondition violated — input.len() > 0"
620        );
621        debug_assert!(
622            input.iter().all(|v| v.is_finite()),
623            "Contract garbage_oracle: precondition violated — input.iter().all(|v| v.is_finite())"
624        );
625    }};
626}
627
628/// Preconditions for equation `gpu_threshold`.
629/// Domain-specific. Call: `contract_pre_gpu_threshold!(slice_expr)`
630macro_rules! contract_pre_gpu_threshold {
631    () => {{}};
632    ($input:expr) => {{
633        let input = &$input;
634        debug_assert!(
635            input.len() > 0,
636            "Contract gpu_threshold: precondition violated — input.len() > 0"
637        );
638        debug_assert!(
639            input.iter().all(|v| v.is_finite()),
640            "Contract gpu_threshold: precondition violated — input.iter().all(|v| v.is_finite())"
641        );
642    }};
643}
644
645/// Preconditions for equation `qk_norm_score_bound`.
646/// Domain-specific. Call: `contract_pre_qk_norm_score_bound!(slice_expr)`
647macro_rules! contract_pre_qk_norm_score_bound {
648    () => {{}};
649    ($input:expr) => {{
650        let input = &$input;
651        debug_assert!(input.iter().all(|v| v.is_finite()),
652            "Contract qk_norm_score_bound: precondition violated — input.iter().all(|v| v.is_finite())");
653        debug_assert!(input.len() > 0,
654            "Contract qk_norm_score_bound: precondition violated — input.len() > 0");
655    }};
656}
657
658/// Preconditions for equation `simd_only_threshold`.
659/// Domain-specific. Call: `contract_pre_simd_only_threshold!(slice_expr)`
660macro_rules! contract_pre_simd_only_threshold {
661    () => {{}};
662    ($input:expr) => {{
663        let input = &$input;
664        debug_assert!(input.len() > 0,
665            "Contract simd_only_threshold: precondition violated — input.len() > 0");
666        debug_assert!(input.iter().all(|v| v.is_finite()),
667            "Contract simd_only_threshold: precondition violated — input.iter().all(|v| v.is_finite())");
668    }};
669}
670
671// Auto-generated from contracts/batch-training-v1.yaml — DO NOT EDIT
672// Contract: batch-training-v1
673
674/// Preconditions for equation `batch_loss`.
675/// Domain-specific. Call: `contract_pre_batch_loss!(slice_expr)`
676macro_rules! contract_pre_batch_loss {
677    () => {{}};
678    ($input:expr) => {{
679        let predicted = &$input;
680        debug_assert!(
681            predicted.len() > 0,
682            "Contract batch_loss: precondition violated — predicted.len() > 0"
683        );
684    }};
685}
686
687/// Preconditions for equation `gradient_accumulation`.
688/// Domain-specific. Call: `contract_pre_gradient_accumulation!(slice_expr)`
689macro_rules! contract_pre_gradient_accumulation {
690    () => {{}};
691    ($input:expr) => {{
692        let params = &$input;
693        debug_assert!(
694            params.len() > 0,
695            "Contract gradient_accumulation: precondition violated — params.len() > 0"
696        );
697    }};
698}
699
700/// Preconditions for equation `gradient_clipping`.
701/// Domain-specific. Call: `contract_pre_gradient_clipping!(slice_expr)`
702macro_rules! contract_pre_gradient_clipping {
703    () => {{}};
704    ($input:expr) => {{
705        let params = &$input;
706        debug_assert!(
707            params.len() > 0,
708            "Contract gradient_clipping: precondition violated — params.len() > 0"
709        );
710    }};
711}
712
713// Auto-generated from contracts/batched-beam-search-v1.yaml — DO NOT EDIT
714// Contract: batched-beam-search-v1
715
716/// Preconditions for equation `batched_beam_projection`.
717/// Domain-specific. Call: `contract_pre_batched_beam_projection!(slice_expr)`
718macro_rules! contract_pre_batched_beam_projection {
719    () => {{}};
720    ($input:expr) => {{
721        let input = &$input;
722        debug_assert!(
723            input.len() > 0,
724            "Contract batched_beam_projection: precondition violated — input.len() > 0"
725        );
726    }};
727}
728
729/// Preconditions for equation `beam_selection`.
730/// Domain-specific. Call: `contract_pre_beam_selection!(slice_expr)`
731macro_rules! contract_pre_beam_selection {
732    () => {{}};
733    ($input:expr) => {{
734        let input = &$input;
735        debug_assert!(
736            input.len() > 0,
737            "Contract beam_selection: precondition violated — input.len() > 0"
738        );
739    }};
740}
741
742/// Preconditions for equation `sequential_beam_projection`.
743/// Domain-specific. Call: `contract_pre_sequential_beam_projection!(slice_expr)`
744macro_rules! contract_pre_sequential_beam_projection {
745    () => {{}};
746    ($input:expr) => {{
747        let input = &$input;
748        debug_assert!(
749            input.len() > 0,
750            "Contract sequential_beam_projection: precondition violated — input.len() > 0"
751        );
752    }};
753}
754
755/// Preconditions for equation `termination`.
756/// Domain-specific. Call: `contract_pre_termination!(slice_expr)`
757macro_rules! contract_pre_termination {
758    () => {{}};
759    ($input:expr) => {{
760        let input = &$input;
761        debug_assert!(
762            input.len() > 0,
763            "Contract termination: precondition violated — input.len() > 0"
764        );
765    }};
766}
767
768// Auto-generated from contracts/batchnorm-kernel-v1.yaml — DO NOT EDIT
769// Contract: batchnorm-kernel-v1
770
771/// Preconditions for equation `batchnorm_eval`.
772/// Domain-specific. Call: `contract_pre_batchnorm_eval!(slice_expr)`
773macro_rules! contract_pre_batchnorm_eval {
774    () => {{}};
775    ($input:expr) => {{
776        let input = &$input;
777        debug_assert!(
778            input.iter().all(|v| v.is_finite()),
779            "Contract batchnorm_eval: precondition violated — input.iter().all(|v| v.is_finite())"
780        );
781        debug_assert!(
782            input.len() > 0,
783            "Contract batchnorm_eval: precondition violated — input.len() > 0"
784        );
785    }};
786}
787
788/// Preconditions for equation `batchnorm_train`.
789/// Domain-specific. Call: `contract_pre_batchnorm_train!(slice_expr)`
790macro_rules! contract_pre_batchnorm_train {
791    () => {{}};
792    ($input:expr) => {{
793        let input = &$input;
794        debug_assert!(input.iter().all(|v| v.is_finite()),
795            "Contract batchnorm_train: precondition violated — input.iter().all(|v| v.is_finite())");
796        debug_assert!(input.len() > 0,
797            "Contract batchnorm_train: precondition violated — input.len() > 0");
798    }};
799}
800
801/// Preconditions for equation `running_stats`.
802/// Domain-specific. Call: `contract_pre_running_stats!(slice_expr)`
803macro_rules! contract_pre_running_stats {
804    () => {{}};
805    ($input:expr) => {{
806        let input = &$input;
807        debug_assert!(
808            input.iter().all(|v| v.is_finite()),
809            "Contract running_stats: precondition violated — input.iter().all(|v| v.is_finite())"
810        );
811        debug_assert!(
812            input.len() > 0,
813            "Contract running_stats: precondition violated — input.len() > 0"
814        );
815    }};
816}
817
818// Auto-generated from contracts/bayesian-v1.yaml — DO NOT EDIT
819// Contract: bayesian-v1
820
821/// Preconditions for equation `blr_predict`.
822/// Domain-specific. Call: `contract_pre_blr_predict!(slice_expr)`
823macro_rules! contract_pre_blr_predict {
824    () => {{}};
825    ($input:expr) => {{
826        let input = &$input;
827        debug_assert!(
828            input.len() > 0,
829            "Contract blr_predict: precondition violated — input.len() > 0"
830        );
831        debug_assert!(
832            input.iter().all(|v| v.is_finite()),
833            "Contract blr_predict: precondition violated — input.iter().all(|v| v.is_finite())"
834        );
835    }};
836}
837
838/// Preconditions for equation `conjugate_update`.
839/// Domain-specific. Call: `contract_pre_conjugate_update!(slice_expr)`
840macro_rules! contract_pre_conjugate_update {
841    () => {{}};
842    ($input:expr) => {{
843        let input = &$input;
844        debug_assert!(input.len() > 0,
845            "Contract conjugate_update: precondition violated — input.len() > 0");
846        debug_assert!(input.iter().all(|v| v.is_finite()),
847            "Contract conjugate_update: precondition violated — input.iter().all(|v| v.is_finite())");
848    }};
849}
850
851/// Preconditions for equation `posterior_predictive`.
852/// Domain-specific. Call: `contract_pre_posterior_predictive!(slice_expr)`
853macro_rules! contract_pre_posterior_predictive {
854    () => {{}};
855    ($input:expr) => {{
856        let input = &$input;
857        debug_assert!(input.len() > 0,
858            "Contract posterior_predictive: precondition violated — input.len() > 0");
859        debug_assert!(input.iter().all(|v| v.is_finite()),
860            "Contract posterior_predictive: precondition violated — input.iter().all(|v| v.is_finite())");
861    }};
862}
863
864/// Preconditions for equation `posterior_valid`.
865/// Domain-specific. Call: `contract_pre_posterior_valid!(slice_expr)`
866macro_rules! contract_pre_posterior_valid {
867    () => {{}};
868    ($input:expr) => {{
869        let input = &$input;
870        debug_assert!(input.len() > 0,
871            "Contract posterior_valid: precondition violated — input.len() > 0");
872        debug_assert!(input.iter().all(|v| v.is_finite()),
873            "Contract posterior_valid: precondition violated — input.iter().all(|v| v.is_finite())");
874    }};
875}
876
877// Auto-generated from contracts/bias-add-v1.yaml — DO NOT EDIT
878// Contract: bias-add-v1
879
880/// Preconditions for equation `bias_add`.
881/// Domain-specific. Call: `contract_pre_bias_add!(slice_expr)`
882macro_rules! contract_pre_bias_add {
883    () => {{}};
884    ($input:expr) => {{
885        let input = &$input;
886        debug_assert!(
887            input.len() > 0,
888            "Contract bias_add: precondition violated — input.len() > 0"
889        );
890        debug_assert!(
891            input.iter().all(|v| v.is_finite()),
892            "Contract bias_add: precondition violated — input.iter().all(|v| v.is_finite())"
893        );
894    }};
895}
896
897// Auto-generated from contracts/bidirectional-attention-v1.yaml — DO NOT EDIT
898// Contract: bidirectional-attention-v1
899
900/// Preconditions for equation `bidirectional_attention`.
901/// Domain-specific. Call: `contract_pre_bidirectional_attention!(slice_expr)`
902macro_rules! contract_pre_bidirectional_attention {
903    () => {{}};
904    ($input:expr) => {{
905        let q = &$input;
906        debug_assert!(
907            q.len() > 0,
908            "Contract bidirectional_attention: precondition violated — q.len() > 0"
909        );
910    }};
911}
912
913// Auto-generated from contracts/blake3-state-v1.yaml — DO NOT EDIT
914// Contract: blake3-state-v1
915
916/// Preconditions for equation `composite_hash`.
917/// Domain-specific. Call: `contract_pre_composite_hash!(slice_expr)`
918macro_rules! contract_pre_composite_hash {
919    () => {{}};
920    ($input:expr) => {{
921        let parts = &$input;
922        debug_assert!(
923            parts.len() > 0,
924            "Contract composite_hash: precondition violated — parts.len() > 0"
925        );
926    }};
927}
928
929/// Preconditions for equation `hash_file`.
930/// Call at function entry: `contract_pre_hash_file!(input_expr)`
931macro_rules! contract_pre_hash_file {
932    () => {{}};
933    ($input:expr) => {{
934        let _contract_input = &$input;
935    }};
936}
937
938/// Preconditions for equation `hash_string`.
939/// Domain-specific. Call: `contract_pre_hash_string!(slice_expr)`
940macro_rules! contract_pre_hash_string {
941    () => {{}};
942    ($input:expr) => {{
943        let input = &$input;
944        debug_assert!(
945            !input.is_empty(),
946            "Contract hash_string: precondition violated — !input.is_empty()"
947        );
948        debug_assert!(
949            input.len() <= 1_073_741_824,
950            "Contract hash_string: precondition violated — input.len() <= 1_073_741_824"
951        );
952    }};
953}
954
955// Auto-generated from contracts/bpe-tokenization-v1.yaml — DO NOT EDIT
956// Contract: bpe-tokenization-v1
957
958/// Preconditions for equation `decode`.
959/// Domain-specific. Call: `contract_pre_decode!(slice_expr)`
960macro_rules! contract_pre_decode {
961    () => {{}};
962    ($input:expr) => {{
963        let input = &$input;
964        debug_assert!(
965            input.len() > 0,
966            "Contract decode: precondition violated — input.len() > 0"
967        );
968    }};
969}
970
971/// Preconditions for equation `encode`.
972/// Domain-specific. Call: `contract_pre_encode!(slice_expr)`
973macro_rules! contract_pre_encode {
974    () => {{}};
975    ($input:expr) => {{
976        let input = &$input;
977        debug_assert!(
978            input.len() > 0,
979            "Contract encode: precondition violated — input.len() > 0"
980        );
981    }};
982}
983
984/// Preconditions for equation `merge_rule`.
985/// Domain-specific. Call: `contract_pre_merge_rule!(slice_expr)`
986macro_rules! contract_pre_merge_rule {
987    () => {{}};
988    ($input:expr) => {{
989        let input = &$input;
990        debug_assert!(
991            input.len() > 0,
992            "Contract merge_rule: precondition violated — input.len() > 0"
993        );
994    }};
995}
996
997// Auto-generated from contracts/builder-pattern-v1.yaml — DO NOT EDIT
998// Contract: builder-pattern-v1
999
1000/// Preconditions for equation `builder_pattern`.
1001/// Domain-specific. Call: `contract_pre_builder_pattern!(slice_expr)`
1002macro_rules! contract_pre_builder_pattern {
1003    () => {{}};
1004    ($input:expr) => {{
1005        let input = &$input;
1006        debug_assert!(
1007            input.len() > 0,
1008            "Contract builder_pattern: precondition violated — input.len() > 0"
1009        );
1010    }};
1011}
1012
1013// Auto-generated from contracts/calibration-v1.yaml — DO NOT EDIT
1014// Contract: calibration-v1
1015
1016/// Preconditions for equation `expected_calibration_error`.
1017/// Domain-specific. Call: `contract_pre_expected_calibration_error!(slice_expr)`
1018macro_rules! contract_pre_expected_calibration_error {
1019    () => {{}};
1020    ($input:expr) => {{
1021        let input = &$input;
1022        debug_assert!(input.len() > 0,
1023            "Contract expected_calibration_error: precondition violated — input.len() > 0");
1024        debug_assert!(input.iter().all(|v| v.is_finite()),
1025            "Contract expected_calibration_error: precondition violated — input.iter().all(|v| v.is_finite())");
1026    }};
1027}
1028
1029/// Preconditions for equation `isotonic_regression`.
1030/// Domain-specific. Call: `contract_pre_isotonic_regression!(slice_expr)`
1031macro_rules! contract_pre_isotonic_regression {
1032    () => {{}};
1033    ($input:expr) => {{
1034        let input = &$input;
1035        debug_assert!(input.len() > 0,
1036            "Contract isotonic_regression: precondition violated — input.len() > 0");
1037        debug_assert!(input.iter().all(|v| v.is_finite()),
1038            "Contract isotonic_regression: precondition violated — input.iter().all(|v| v.is_finite())");
1039    }};
1040}
1041
1042/// Preconditions for equation `maximum_calibration_error`.
1043/// Domain-specific. Call: `contract_pre_maximum_calibration_error!(slice_expr)`
1044macro_rules! contract_pre_maximum_calibration_error {
1045    () => {{}};
1046    ($input:expr) => {{
1047        let input = &$input;
1048        debug_assert!(input.len() > 0,
1049            "Contract maximum_calibration_error: precondition violated — input.len() > 0");
1050        debug_assert!(input.iter().all(|v| v.is_finite()),
1051            "Contract maximum_calibration_error: precondition violated — input.iter().all(|v| v.is_finite())");
1052    }};
1053}
1054
1055/// Preconditions for equation `platt_scaling`.
1056/// Domain-specific. Call: `contract_pre_platt_scaling!(slice_expr)`
1057macro_rules! contract_pre_platt_scaling {
1058    () => {{}};
1059    ($input:expr) => {{
1060        let input = &$input;
1061        debug_assert!(
1062            input.len() > 0,
1063            "Contract platt_scaling: precondition violated — input.len() > 0"
1064        );
1065        debug_assert!(
1066            input.iter().all(|v| v.is_finite()),
1067            "Contract platt_scaling: precondition violated — input.iter().all(|v| v.is_finite())"
1068        );
1069    }};
1070}
1071
1072/// Preconditions for equation `reliability_diagram`.
1073/// Domain-specific. Call: `contract_pre_reliability_diagram!(slice_expr)`
1074macro_rules! contract_pre_reliability_diagram {
1075    () => {{}};
1076    ($input:expr) => {{
1077        let input = &$input;
1078        debug_assert!(input.len() > 0,
1079            "Contract reliability_diagram: precondition violated — input.len() > 0");
1080        debug_assert!(input.iter().all(|v| v.is_finite()),
1081            "Contract reliability_diagram: precondition violated — input.iter().all(|v| v.is_finite())");
1082    }};
1083}
1084
1085// Auto-generated from contracts/classification-finetune-v1.yaml — DO NOT EDIT
1086// Contract: classification-finetune-v1
1087
1088/// Preconditions for equation `classifier_weight_shape`.
1089/// Domain-specific. Call: `contract_pre_classifier_weight_shape!(slice_expr)`
1090macro_rules! contract_pre_classifier_weight_shape {
1091    () => {{}};
1092    ($input:expr) => {{
1093        let a = &$input;
1094        debug_assert!(
1095            a.len() > 0,
1096            "Contract classifier_weight_shape: precondition violated — a.len() > 0"
1097        );
1098    }};
1099}
1100
1101/// Preconditions for equation `label_bounds`.
1102/// Domain-specific. Call: `contract_pre_label_bounds!(slice_expr)`
1103macro_rules! contract_pre_label_bounds {
1104    () => {{}};
1105    ($input:expr) => {{
1106        let a = &$input;
1107        debug_assert!(
1108            a.len() > 0,
1109            "Contract label_bounds: precondition violated — a.len() > 0"
1110        );
1111    }};
1112}
1113
1114/// Preconditions for equation `logit_shape`.
1115/// Domain-specific. Call: `contract_pre_logit_shape!(slice_expr)`
1116macro_rules! contract_pre_logit_shape {
1117    () => {{}};
1118    ($input:expr) => {{
1119        let a = &$input;
1120        debug_assert!(
1121            a.len() > 0,
1122            "Contract logit_shape: precondition violated — a.len() > 0"
1123        );
1124    }};
1125}
1126
1127/// Preconditions for equation `softmax_sum`.
1128/// Domain-specific. Call: `contract_pre_softmax_sum!(slice_expr)`
1129macro_rules! contract_pre_softmax_sum {
1130    () => {{}};
1131    ($input:expr) => {{
1132        let x = &$input;
1133        debug_assert!(
1134            x.iter().all(|v| v.is_finite()),
1135            "Contract softmax_sum: precondition violated — x.iter().all(|v| v.is_finite())"
1136        );
1137        debug_assert!(
1138            x.len() > 0,
1139            "Contract softmax_sum: precondition violated — x.len() > 0"
1140        );
1141    }};
1142}
1143
1144// Auto-generated from contracts/classifier-pipeline-v1.yaml — DO NOT EDIT
1145// Contract: classifier-pipeline-v1
1146
1147/// Preconditions for equation `embedding_extraction`.
1148/// Domain-specific. Call: `contract_pre_embedding_extraction!(slice_expr)`
1149macro_rules! contract_pre_embedding_extraction {
1150    () => {{}};
1151    ($input:expr) => {{
1152        let indices = &$input;
1153        debug_assert!(
1154            indices.len() > 0,
1155            "Contract embedding_extraction: precondition violated — indices.len() > 0"
1156        );
1157    }};
1158}
1159
1160/// Preconditions for equation `evaluation`.
1161/// Call at function entry: `contract_pre_evaluation!(input_expr)`
1162macro_rules! contract_pre_evaluation {
1163    () => {{}};
1164    ($input:expr) => {{
1165        let _contract_input = &$input;
1166    }};
1167}
1168
1169/// Preconditions for equation `linear_probe`.
1170/// Call at function entry: `contract_pre_linear_probe!(input_expr)`
1171macro_rules! contract_pre_linear_probe {
1172    () => {{}};
1173    ($input:expr) => {{
1174        let _contract_input = &$input;
1175    }};
1176}
1177
1178// Auto-generated from contracts/cma-es-kernel-v1.yaml — DO NOT EDIT
1179// Contract: cma-es-kernel-v1
1180
1181/// Preconditions for equation `covariance_update`.
1182/// Domain-specific. Call: `contract_pre_covariance_update!(slice_expr)`
1183macro_rules! contract_pre_covariance_update {
1184    () => {{}};
1185    ($input:expr) => {{
1186        let params = &$input;
1187        debug_assert!(
1188            params.len() > 0,
1189            "Contract covariance_update: precondition violated — params.len() > 0"
1190        );
1191    }};
1192}
1193
1194/// Preconditions for equation `mean_update`.
1195/// Domain-specific. Call: `contract_pre_mean_update!(slice_expr)`
1196macro_rules! contract_pre_mean_update {
1197    () => {{}};
1198    ($input:expr) => {{
1199        let params = &$input;
1200        debug_assert!(
1201            params.len() > 0,
1202            "Contract mean_update: precondition violated — params.len() > 0"
1203        );
1204    }};
1205}
1206
1207/// Preconditions for equation `sample`.
1208/// Domain-specific. Call: `contract_pre_sample!(slice_expr)`
1209macro_rules! contract_pre_sample {
1210    () => {{}};
1211    ($input:expr) => {{
1212        let params = &$input;
1213        debug_assert!(
1214            params.len() > 0,
1215            "Contract sample: precondition violated — params.len() > 0"
1216        );
1217    }};
1218}
1219
1220// Auto-generated from contracts/codebert-tokenizer-validation-v1.yaml — DO NOT EDIT
1221// Contract: codebert-tokenizer-validation-v1
1222
1223/// Preconditions for equation `tokenizer_adequacy`.
1224/// Domain-specific. Call: `contract_pre_tokenizer_adequacy!(slice_expr)`
1225macro_rules! contract_pre_tokenizer_adequacy {
1226    () => {{}};
1227    ($input:expr) => {{
1228        let input = &$input;
1229        debug_assert!(
1230            input.len() > 0,
1231            "Contract tokenizer_adequacy: precondition violated — input.len() > 0"
1232        );
1233    }};
1234}
1235
1236// Auto-generated from contracts/codegen-dispatch-v1.yaml — DO NOT EDIT
1237// Contract: codegen-dispatch-v1
1238
1239/// Preconditions for equation `apply_script`.
1240/// Call at function entry: `contract_pre_apply_script!(input_expr)`
1241macro_rules! contract_pre_apply_script {
1242    () => {{}};
1243    ($input:expr) => {{
1244        let _contract_input = &$input;
1245    }};
1246}
1247
1248/// Preconditions for equation `check_script`.
1249/// Call at function entry: `contract_pre_check_script!(input_expr)`
1250macro_rules! contract_pre_check_script {
1251    () => {{}};
1252    ($input:expr) => {{
1253        let _contract_input = &$input;
1254    }};
1255}
1256
1257/// Preconditions for equation `state_query_script`.
1258/// Call at function entry: `contract_pre_state_query_script!(input_expr)`
1259macro_rules! contract_pre_state_query_script {
1260    () => {{}};
1261    ($input:expr) => {{
1262        let _contract_input = &$input;
1263    }};
1264}
1265
1266// Auto-generated from contracts/comply-check-v1.yaml — DO NOT EDIT
1267// Contract: comply-check-v1
1268
1269/// Preconditions for equation `aggregate_score`.
1270/// Domain-specific. Call: `contract_pre_aggregate_score!(slice_expr)`
1271macro_rules! contract_pre_aggregate_score {
1272    () => {{}};
1273    ($input:expr) => {{
1274        let checks = &$input;
1275        debug_assert!(
1276            checks.len() > 0,
1277            "Contract aggregate_score: precondition violated — checks.len() > 0"
1278        );
1279    }};
1280}
1281
1282/// Preconditions for equation `run_checks`.
1283/// Call at function entry: `contract_pre_run_checks!(input_expr)`
1284macro_rules! contract_pre_run_checks {
1285    () => {{}};
1286    ($input:expr) => {{
1287        let _contract_input = &$input;
1288    }};
1289}
1290
1291// Auto-generated from contracts/configuration-v1.yaml — DO NOT EDIT
1292// Contract: configuration-v1
1293
1294/// Preconditions for equation `configuration`.
1295/// Domain-specific. Call: `contract_pre_configuration!(slice_expr)`
1296macro_rules! contract_pre_configuration {
1297    () => {{}};
1298    ($input:expr) => {{
1299        let input = &$input;
1300        debug_assert!(
1301            input.len() > 0,
1302            "Contract configuration: precondition violated — input.len() > 0"
1303        );
1304    }};
1305}
1306
1307/// Postconditions for equation `configuration`.
1308/// Call before return: `contract_post_configuration!(result_expr)`
1309macro_rules! contract_post_configuration {
1310    ($result:expr) => {{
1311        let _contract_result = &$result;
1312        debug_assert!(
1313            _contract_result.len() > 0,
1314            "Contract configuration: postcondition violated — result.len() > 0"
1315        );
1316    }};
1317}
1318
1319/// Combined pre+post contract for equation `configuration`.
1320macro_rules! contract_configuration {
1321    ($input:expr, $body:expr) => {{
1322        contract_pre_configuration!($input);
1323        let _contract_result = $body;
1324        contract_post_configuration!(_contract_result);
1325        _contract_result
1326    }};
1327}
1328
1329// Auto-generated from contracts/context-generation-v1.yaml — DO NOT EDIT
1330// Contract: context-generation-v1
1331
1332/// Preconditions for equation `generate_context`.
1333/// Call at function entry: `contract_pre_generate_context!(input_expr)`
1334macro_rules! contract_pre_generate_context {
1335    () => {{}};
1336    ($input:expr) => {{
1337        let _contract_input = &$input;
1338    }};
1339}
1340
1341/// Preconditions for equation `index_persistence`.
1342/// Call at function entry: `contract_pre_index_persistence!(input_expr)`
1343macro_rules! contract_pre_index_persistence {
1344    () => {{}};
1345    ($input:expr) => {{
1346        let _contract_input = &$input;
1347    }};
1348}
1349
1350// Auto-generated from contracts/continuous-batching-v1.yaml — DO NOT EDIT
1351// Contract: continuous-batching-v1
1352
1353/// Preconditions for equation `chunked_prefill`.
1354/// Call at function entry: `contract_pre_chunked_prefill!(input_expr)`
1355macro_rules! contract_pre_chunked_prefill {
1356    () => {{}};
1357    ($input:expr) => {{
1358        let _contract_input = &$input;
1359    }};
1360}
1361
1362/// Preconditions for equation `correctness_under_batching`.
1363/// Call at function entry: `contract_pre_correctness_under_batching!(input_expr)`
1364macro_rules! contract_pre_correctness_under_batching {
1365    () => {{}};
1366    ($input:expr) => {{
1367        let _contract_input = &$input;
1368    }};
1369}
1370
1371/// Preconditions for equation `decode_degradation`.
1372/// Domain-specific. Call: `contract_pre_decode_degradation!(slice_expr)`
1373macro_rules! contract_pre_decode_degradation {
1374    () => {{}};
1375    ($input:expr) => {{
1376        let input = &$input;
1377        debug_assert!(
1378            input.len() > 0,
1379            "Contract decode_degradation: precondition violated — input.len() > 0"
1380        );
1381    }};
1382}
1383
1384/// Preconditions for equation `request_state`.
1385/// Call at function entry: `contract_pre_request_state!(input_expr)`
1386macro_rules! contract_pre_request_state {
1387    () => {{}};
1388    ($input:expr) => {{
1389        let _contract_input = &$input;
1390    }};
1391}
1392
1393/// Preconditions for equation `scheduling_fairness`.
1394/// Call at function entry: `contract_pre_scheduling_fairness!(input_expr)`
1395macro_rules! contract_pre_scheduling_fairness {
1396    () => {{}};
1397    ($input:expr) => {{
1398        let _contract_input = &$input;
1399    }};
1400}
1401
1402/// Preconditions for equation `throughput_scaling`.
1403/// Call at function entry: `contract_pre_throughput_scaling!(input_expr)`
1404macro_rules! contract_pre_throughput_scaling {
1405    () => {{}};
1406    ($input:expr) => {{
1407        let _contract_input = &$input;
1408    }};
1409}
1410
1411/// Preconditions for equation `token_budget`.
1412/// Domain-specific. Call: `contract_pre_token_budget!(slice_expr)`
1413macro_rules! contract_pre_token_budget {
1414    () => {{}};
1415    ($input:expr) => {{
1416        let input = &$input;
1417        debug_assert!(
1418            input.len() > 0,
1419            "Contract token_budget: precondition violated — input.len() > 0"
1420        );
1421    }};
1422}
1423
1424// Auto-generated from contracts/conv1d-kernel-v1.yaml — DO NOT EDIT
1425// Contract: conv1d-kernel-v1
1426
1427/// Preconditions for equation `conv1d`.
1428/// Domain-specific. Call: `contract_pre_conv1d!(slice_expr)`
1429macro_rules! contract_pre_conv1d {
1430    () => {{}};
1431    ($input:expr) => {{
1432        let a = &$input;
1433        debug_assert!(
1434            a.len() > 0,
1435            "Contract conv1d: precondition violated — a.len() > 0"
1436        );
1437    }};
1438}
1439
1440// Auto-generated from contracts/conversation-generation-v1.yaml — DO NOT EDIT
1441// Contract: conversation-generation-v1
1442
1443/// Preconditions for equation `chatml_format`.
1444/// Domain-specific. Call: `contract_pre_chatml_format!(slice_expr)`
1445macro_rules! contract_pre_chatml_format {
1446    () => {{}};
1447    ($input:expr) => {{
1448        let input = &$input;
1449        debug_assert!(
1450            input.len() > 0,
1451            "Contract chatml_format: precondition violated — input.len() > 0"
1452        );
1453    }};
1454}
1455
1456/// Preconditions for equation `conversation_types`.
1457/// Domain-specific. Call: `contract_pre_conversation_types!(slice_expr)`
1458macro_rules! contract_pre_conversation_types {
1459    () => {{}};
1460    ($input:expr) => {{
1461        let input = &$input;
1462        debug_assert!(
1463            input.len() > 0,
1464            "Contract conversation_types: precondition violated — input.len() > 0"
1465        );
1466    }};
1467}
1468
1469/// Preconditions for equation `quality_gate`.
1470/// Domain-specific. Call: `contract_pre_quality_gate!(slice_expr)`
1471macro_rules! contract_pre_quality_gate {
1472    () => {{}};
1473    ($input:expr) => {{
1474        let input = &$input;
1475        debug_assert!(
1476            input.len() > 0,
1477            "Contract quality_gate: precondition violated — input.len() > 0"
1478        );
1479    }};
1480}
1481
1482// Auto-generated from contracts/cpu-q4k-activation-quant-v1.yaml — DO NOT EDIT
1483// Contract: cpu-q4k-activation-quant-v1
1484
1485/// Preconditions for equation `current_path`.
1486/// Domain-specific. Call: `contract_pre_current_path!(slice_expr)`
1487macro_rules! contract_pre_current_path {
1488    () => {{}};
1489    ($input:expr) => {{
1490        let x = &$input;
1491        debug_assert!(
1492            x.iter().all(|v| v.is_finite()),
1493            "Contract current_path: precondition violated — x.iter().all(|v| v.is_finite())"
1494        );
1495        debug_assert!(
1496            x.len() > 0,
1497            "Contract current_path: precondition violated — x.len() > 0"
1498        );
1499    }};
1500}
1501
1502/// Preconditions for equation `speedup_bound`.
1503/// Domain-specific. Call: `contract_pre_speedup_bound!(slice_expr)`
1504macro_rules! contract_pre_speedup_bound {
1505    () => {{}};
1506    ($input:expr) => {{
1507        let x = &$input;
1508        debug_assert!(
1509            x.iter().all(|v| v.is_finite()),
1510            "Contract speedup_bound: precondition violated — x.iter().all(|v| v.is_finite())"
1511        );
1512        debug_assert!(
1513            x.len() > 0,
1514            "Contract speedup_bound: precondition violated — x.len() > 0"
1515        );
1516    }};
1517}
1518
1519/// Preconditions for equation `target_path`.
1520/// Domain-specific. Call: `contract_pre_target_path!(slice_expr)`
1521macro_rules! contract_pre_target_path {
1522    () => {{}};
1523    ($input:expr) => {{
1524        let x = &$input;
1525        debug_assert!(
1526            x.iter().all(|v| v.is_finite()),
1527            "Contract target_path: precondition violated — x.iter().all(|v| v.is_finite())"
1528        );
1529        debug_assert!(
1530            x.len() > 0,
1531            "Contract target_path: precondition violated — x.len() > 0"
1532        );
1533    }};
1534}
1535
1536// Auto-generated from contracts/cpu-work-stealing-v1.yaml — DO NOT EDIT
1537// Contract: cpu-work-stealing-v1
1538
1539/// Preconditions for equation `l1_tiling`.
1540/// Domain-specific. Call: `contract_pre_l1_tiling!(slice_expr)`
1541macro_rules! contract_pre_l1_tiling {
1542    () => {{}};
1543    ($input:expr) => {{
1544        let input = &$input;
1545        debug_assert!(
1546            input.len() > 0,
1547            "Contract l1_tiling: precondition violated — input.len() > 0"
1548        );
1549        debug_assert!(
1550            input.iter().all(|v| v.is_finite()),
1551            "Contract l1_tiling: precondition violated — input.iter().all(|v| v.is_finite())"
1552        );
1553    }};
1554}
1555
1556/// Preconditions for equation `rayon_overhead`.
1557/// Domain-specific. Call: `contract_pre_rayon_overhead!(slice_expr)`
1558macro_rules! contract_pre_rayon_overhead {
1559    () => {{}};
1560    ($input:expr) => {{
1561        let input = &$input;
1562        debug_assert!(
1563            input.len() > 0,
1564            "Contract rayon_overhead: precondition violated — input.len() > 0"
1565        );
1566        debug_assert!(
1567            input.iter().all(|v| v.is_finite()),
1568            "Contract rayon_overhead: precondition violated — input.iter().all(|v| v.is_finite())"
1569        );
1570    }};
1571}
1572
1573// Auto-generated from contracts/cross-entropy-kernel-v1.yaml — DO NOT EDIT
1574// Contract: cross-entropy-kernel-v1
1575
1576/// Preconditions for equation `cross_entropy`.
1577/// Domain-specific. Call: `contract_pre_cross_entropy!(slice_expr)`
1578macro_rules! contract_pre_cross_entropy {
1579    () => {{}};
1580    ($input:expr) => {{
1581        let logits = &$input;
1582        debug_assert!(
1583            logits.len() > 0,
1584            "Contract cross_entropy: precondition violated — logits.len() > 0"
1585        );
1586        debug_assert!(
1587            logits.iter().all(|v| v.is_finite()),
1588            "Contract cross_entropy: precondition violated — logits.iter().all(|v| v.is_finite())"
1589        );
1590    }};
1591}
1592
1593/// Postconditions for equation `cross_entropy`.
1594/// Call before return: `contract_post_cross_entropy!(result_expr)`
1595macro_rules! contract_post_cross_entropy {
1596    ($result:expr) => {{
1597        let _contract_result = &$result;
1598        debug_assert!(
1599            _contract_result.is_finite(),
1600            "Contract cross_entropy: postcondition violated — result.is_finite()"
1601        );
1602        debug_assert!(
1603            *_contract_result >= 0.0,
1604            "Contract cross_entropy: postcondition violated — result >= 0.0"
1605        );
1606    }};
1607}
1608
1609/// Combined pre+post contract for equation `cross_entropy`.
1610macro_rules! contract_cross_entropy {
1611    ($input:expr, $body:expr) => {{
1612        contract_pre_cross_entropy!($input);
1613        let _contract_result = $body;
1614        contract_post_cross_entropy!(_contract_result);
1615        _contract_result
1616    }};
1617}
1618
1619/// Preconditions for equation `log_softmax`.
1620/// Domain-specific. Call: `contract_pre_log_softmax!(slice_expr)`
1621macro_rules! contract_pre_log_softmax {
1622    () => {{}};
1623    ($input:expr) => {{
1624        let x = &$input;
1625        debug_assert!(
1626            x.iter().all(|v| v.is_finite()),
1627            "Contract log_softmax: precondition violated — x.iter().all(|v| v.is_finite())"
1628        );
1629        debug_assert!(
1630            x.len() > 0,
1631            "Contract log_softmax: precondition violated — x.len() > 0"
1632        );
1633    }};
1634}
1635
1636// Auto-generated from contracts/cuda-classify-training-v1.yaml — DO NOT EDIT
1637// Contract: cuda-classify-training-v1
1638
1639/// Preconditions for equation `device_dispatch`.
1640/// Call at function entry: `contract_pre_device_dispatch!(input_expr)`
1641macro_rules! contract_pre_device_dispatch {
1642    () => {{}};
1643    ($input:expr) => {{
1644        let _contract_input = &$input;
1645    }};
1646}
1647
1648/// Preconditions for equation `gpu_forward`.
1649/// Call at function entry: `contract_pre_gpu_forward!(input_expr)`
1650macro_rules! contract_pre_gpu_forward {
1651    () => {{}};
1652    ($input:expr) => {{
1653        let _contract_input = &$input;
1654    }};
1655}
1656
1657/// Preconditions for equation `weight_roundtrip`.
1658/// Domain-specific. Call: `contract_pre_weight_roundtrip!(slice_expr)`
1659macro_rules! contract_pre_weight_roundtrip {
1660    () => {{}};
1661    ($input:expr) => {{
1662        let weights = &$input;
1663        debug_assert!(
1664            weights.len() > 0,
1665            "Contract weight_roundtrip: precondition violated — weights.len() > 0"
1666        );
1667    }};
1668}
1669
1670// Auto-generated from contracts/dag-ordering-v1.yaml — DO NOT EDIT
1671// Contract: dag-ordering-v1
1672
1673/// Preconditions for equation `kahn_sort`.
1674/// Call at function entry: `contract_pre_kahn_sort!(input_expr)`
1675macro_rules! contract_pre_kahn_sort {
1676    () => {{}};
1677    ($input:expr) => {{
1678        let _contract_input = &$input;
1679    }};
1680}
1681
1682/// Preconditions for equation `topological_sort`.
1683/// Call at function entry: `contract_pre_topological_sort!(input_expr)`
1684macro_rules! contract_pre_topological_sort {
1685    () => {{}};
1686    ($input:expr) => {{
1687        let _contract_input = &$input;
1688    }};
1689}
1690
1691// Auto-generated from contracts/decision-tree-v1.yaml — DO NOT EDIT
1692// Contract: decision-tree-v1
1693
1694/// Preconditions for equation `gini_impurity`.
1695/// Domain-specific. Call: `contract_pre_gini_impurity!(slice_expr)`
1696macro_rules! contract_pre_gini_impurity {
1697    () => {{}};
1698    ($input:expr) => {{
1699        let input = &$input;
1700        debug_assert!(
1701            input.len() > 0,
1702            "Contract gini_impurity: precondition violated — input.len() > 0"
1703        );
1704        debug_assert!(
1705            input.iter().all(|v| v.is_finite()),
1706            "Contract gini_impurity: precondition violated — input.iter().all(|v| v.is_finite())"
1707        );
1708    }};
1709}
1710
1711/// Preconditions for equation `gini_split`.
1712/// Domain-specific. Call: `contract_pre_gini_split!(slice_expr)`
1713macro_rules! contract_pre_gini_split {
1714    () => {{}};
1715    ($input:expr) => {{
1716        let input = &$input;
1717        debug_assert!(
1718            input.len() > 0,
1719            "Contract gini_split: precondition violated — input.len() > 0"
1720        );
1721        debug_assert!(
1722            input.iter().all(|v| v.is_finite()),
1723            "Contract gini_split: precondition violated — input.iter().all(|v| v.is_finite())"
1724        );
1725    }};
1726}
1727
1728/// Preconditions for equation `mse_split`.
1729/// Domain-specific. Call: `contract_pre_mse_split!(slice_expr)`
1730macro_rules! contract_pre_mse_split {
1731    () => {{}};
1732    ($input:expr) => {{
1733        let input = &$input;
1734        debug_assert!(
1735            input.len() > 0,
1736            "Contract mse_split: precondition violated — input.len() > 0"
1737        );
1738        debug_assert!(
1739            input.iter().all(|v| v.is_finite()),
1740            "Contract mse_split: precondition violated — input.iter().all(|v| v.is_finite())"
1741        );
1742    }};
1743}
1744
1745/// Preconditions for equation `prediction`.
1746/// Domain-specific. Call: `contract_pre_prediction!(slice_expr)`
1747macro_rules! contract_pre_prediction {
1748    () => {{}};
1749    ($input:expr) => {{
1750        let input = &$input;
1751        debug_assert!(
1752            input.len() > 0,
1753            "Contract prediction: precondition violated — input.len() > 0"
1754        );
1755        debug_assert!(
1756            input.iter().all(|v| v.is_finite()),
1757            "Contract prediction: precondition violated — input.iter().all(|v| v.is_finite())"
1758        );
1759    }};
1760}
1761
1762// Auto-generated from contracts/display-format-v1.yaml — DO NOT EDIT
1763// Contract: display-format-v1
1764
1765/// Preconditions for equation `display_format`.
1766/// Domain-specific. Call: `contract_pre_display_format!(slice_expr)`
1767macro_rules! contract_pre_display_format {
1768    () => {{}};
1769    ($input:expr) => {{
1770        let input = &$input;
1771        debug_assert!(
1772            input.len() > 0,
1773            "Contract display_format: precondition violated — input.len() > 0"
1774        );
1775    }};
1776}
1777
1778/// Postconditions for equation `display_format`.
1779/// Call before return: `contract_post_display_format!(result_expr)`
1780macro_rules! contract_post_display_format {
1781    ($result:expr) => {{
1782        let _contract_result = &$result;
1783        debug_assert!(
1784            _contract_result.len() > 0,
1785            "Contract display_format: postcondition violated — result.len() > 0"
1786        );
1787    }};
1788}
1789
1790/// Combined pre+post contract for equation `display_format`.
1791macro_rules! contract_display_format {
1792    ($input:expr, $body:expr) => {{
1793        contract_pre_display_format!($input);
1794        let _contract_result = $body;
1795        contract_post_display_format!(_contract_result);
1796        _contract_result
1797    }};
1798}
1799
1800/// Preconditions for equation `render`.
1801/// Domain-specific. Call: `contract_pre_render!(slice_expr)`
1802macro_rules! contract_pre_render {
1803    () => {{}};
1804    ($input:expr) => {{
1805        let input = &$input;
1806        debug_assert!(
1807            input.len() > 0,
1808            "Contract render: precondition violated — input.len() > 0"
1809        );
1810    }};
1811}
1812
1813/// Postconditions for equation `render`.
1814/// Call before return: `contract_post_render!(result_expr)`
1815macro_rules! contract_post_render {
1816    ($result:expr) => {{
1817        let _contract_result = &$result;
1818        debug_assert!(
1819            _contract_result.len() > 0,
1820            "Contract render: postcondition violated — result.len() > 0"
1821        );
1822    }};
1823}
1824
1825/// Combined pre+post contract for equation `render`.
1826macro_rules! contract_render {
1827    ($input:expr, $body:expr) => {{
1828        contract_pre_render!($input);
1829        let _contract_result = $body;
1830        contract_post_render!(_contract_result);
1831        _contract_result
1832    }};
1833}
1834
1835// Auto-generated from contracts/distributed-training-v1.yaml — DO NOT EDIT
1836// Contract: distributed-training-v1
1837
1838/// Preconditions for equation `gradient_allreduce`.
1839/// Domain-specific. Call: `contract_pre_gradient_allreduce!(slice_expr)`
1840macro_rules! contract_pre_gradient_allreduce {
1841    () => {{}};
1842    ($input:expr) => {{
1843        let params = &$input;
1844        debug_assert!(
1845            params.len() > 0,
1846            "Contract gradient_allreduce: precondition violated — params.len() > 0"
1847        );
1848    }};
1849}
1850
1851/// Preconditions for equation `lora_gradient_size`.
1852/// Domain-specific. Call: `contract_pre_lora_gradient_size!(slice_expr)`
1853macro_rules! contract_pre_lora_gradient_size {
1854    () => {{}};
1855    ($input:expr) => {{
1856        let grad_output = &$input;
1857        debug_assert!(grad_output.len() > 0,
1858            "Contract lora_gradient_size: precondition violated — grad_output.len() > 0");
1859        debug_assert!(grad_output.iter().all(|v| v.is_finite()),
1860            "Contract lora_gradient_size: precondition violated — grad_output.iter().all(|v| v.is_finite())");
1861    }};
1862}
1863
1864/// Preconditions for equation `sharding`.
1865/// Domain-specific. Call: `contract_pre_sharding!(slice_expr)`
1866macro_rules! contract_pre_sharding {
1867    () => {{}};
1868    ($input:expr) => {{
1869        let input = &$input;
1870        debug_assert!(
1871            input.len() > 0,
1872            "Contract sharding: precondition violated — input.len() > 0"
1873        );
1874        debug_assert!(
1875            input.iter().all(|v| v.is_finite()),
1876            "Contract sharding: precondition violated — input.iter().all(|v| v.is_finite())"
1877        );
1878    }};
1879}
1880
1881/// Preconditions for equation `swiglu_ffn`.
1882/// Domain-specific. Call: `contract_pre_swiglu_ffn!(slice_expr)`
1883macro_rules! contract_pre_swiglu_ffn {
1884    () => {{}};
1885    ($input:expr) => {{
1886        let input = &$input;
1887        debug_assert!(
1888            input.len() > 0,
1889            "Contract swiglu_ffn: precondition violated — input.len() > 0"
1890        );
1891        debug_assert!(
1892            input.iter().all(|v| v.is_finite()),
1893            "Contract swiglu_ffn: precondition violated — input.iter().all(|v| v.is_finite())"
1894        );
1895    }};
1896}
1897
1898/// Preconditions for equation `weighted_loss`.
1899/// Domain-specific. Call: `contract_pre_weighted_loss!(slice_expr)`
1900macro_rules! contract_pre_weighted_loss {
1901    () => {{}};
1902    ($input:expr) => {{
1903        let predicted = &$input;
1904        debug_assert!(
1905            predicted.len() > 0,
1906            "Contract weighted_loss: precondition violated — predicted.len() > 0"
1907        );
1908    }};
1909}
1910
1911// Auto-generated from contracts/dpo-loss-v1.yaml — DO NOT EDIT
1912// Contract: dpo-loss-v1
1913
1914/// Preconditions for equation `dpo_loss`.
1915/// Domain-specific. Call: `contract_pre_dpo_loss!(slice_expr)`
1916macro_rules! contract_pre_dpo_loss {
1917    () => {{}};
1918    ($input:expr) => {{
1919        let predicted = &$input;
1920        debug_assert!(
1921            predicted.len() > 0,
1922            "Contract dpo_loss: precondition violated — predicted.len() > 0"
1923        );
1924    }};
1925}
1926
1927/// Preconditions for equation `implicit_reward`.
1928/// Domain-specific. Call: `contract_pre_implicit_reward!(slice_expr)`
1929macro_rules! contract_pre_implicit_reward {
1930    () => {{}};
1931    ($input:expr) => {{
1932        let predicted = &$input;
1933        debug_assert!(
1934            predicted.len() > 0,
1935            "Contract implicit_reward: precondition violated — predicted.len() > 0"
1936        );
1937    }};
1938}
1939
1940/// Preconditions for equation `log_ratio`.
1941/// Domain-specific. Call: `contract_pre_log_ratio!(slice_expr)`
1942macro_rules! contract_pre_log_ratio {
1943    () => {{}};
1944    ($input:expr) => {{
1945        let predicted = &$input;
1946        debug_assert!(
1947            predicted.len() > 0,
1948            "Contract log_ratio: precondition violated — predicted.len() > 0"
1949        );
1950    }};
1951}
1952
1953// Auto-generated from contracts/drift-detection-v1.yaml — DO NOT EDIT
1954// Contract: drift-detection-v1
1955
1956/// Preconditions for equation `classify_drift`.
1957/// Domain-specific. Call: `contract_pre_classify_drift!(slice_expr)`
1958macro_rules! contract_pre_classify_drift {
1959    () => {{}};
1960    ($input:expr) => {{
1961        let x = &$input;
1962    }};
1963}
1964
1965/// Preconditions for equation `min_samples_guard`.
1966/// Domain-specific. Call: `contract_pre_min_samples_guard!(slice_expr)`
1967macro_rules! contract_pre_min_samples_guard {
1968    () => {{}};
1969    ($input:expr) => {{
1970        let params = &$input;
1971        debug_assert!(
1972            params.len() > 0,
1973            "Contract min_samples_guard: precondition violated — params.len() > 0"
1974        );
1975    }};
1976}
1977
1978/// Preconditions for equation `performance_drift`.
1979/// Domain-specific. Call: `contract_pre_performance_drift!(slice_expr)`
1980macro_rules! contract_pre_performance_drift {
1981    () => {{}};
1982    ($input:expr) => {{
1983        let input = &$input;
1984        debug_assert!(
1985            input.len() > 0,
1986            "Contract performance_drift: precondition violated — input.len() > 0"
1987        );
1988    }};
1989}
1990
1991/// Preconditions for equation `univariate_drift`.
1992/// Domain-specific. Call: `contract_pre_univariate_drift!(slice_expr)`
1993macro_rules! contract_pre_univariate_drift {
1994    () => {{}};
1995    ($input:expr) => {{
1996        let input = &$input;
1997        debug_assert!(
1998            input.len() > 0,
1999            "Contract univariate_drift: precondition violated — input.len() > 0"
2000        );
2001    }};
2002}
2003
2004// Auto-generated from contracts/dropout-v1.yaml — DO NOT EDIT
2005// Contract: dropout-v1
2006
2007/// Preconditions for equation `dropout_eval`.
2008/// Domain-specific. Call: `contract_pre_dropout_eval!(slice_expr)`
2009macro_rules! contract_pre_dropout_eval {
2010    () => {{}};
2011    ($input:expr) => {{
2012        let x = &$input;
2013        debug_assert!(
2014            x.iter().all(|v| v.is_finite()),
2015            "Contract dropout_eval: precondition violated — x.iter().all(|v| v.is_finite())"
2016        );
2017        debug_assert!(
2018            x.len() > 0,
2019            "Contract dropout_eval: precondition violated — x.len() > 0"
2020        );
2021    }};
2022}
2023
2024/// Preconditions for equation `dropout_train`.
2025/// Domain-specific. Call: `contract_pre_dropout_train!(slice_expr)`
2026macro_rules! contract_pre_dropout_train {
2027    () => {{}};
2028    ($input:expr) => {{
2029        let x = &$input;
2030        debug_assert!(
2031            x.iter().all(|v| v.is_finite()),
2032            "Contract dropout_train: precondition violated — x.iter().all(|v| v.is_finite())"
2033        );
2034        debug_assert!(
2035            x.len() > 0,
2036            "Contract dropout_train: precondition violated — x.len() > 0"
2037        );
2038    }};
2039}
2040
2041// Auto-generated from contracts/embedding-algebra-v1.yaml — DO NOT EDIT
2042// Contract: embedding-algebra-v1
2043
2044/// Preconditions for equation `embedding_lookup`.
2045/// Domain-specific. Call: `contract_pre_embedding_lookup!(slice_expr)`
2046macro_rules! contract_pre_embedding_lookup {
2047    () => {{}};
2048    ($input:expr) => {{
2049        let indices = &$input;
2050        debug_assert!(
2051            indices.len() > 0,
2052            "Contract embedding_lookup: precondition violated — indices.len() > 0"
2053        );
2054    }};
2055}
2056
2057/// Preconditions for equation `embedding_norm`.
2058/// Domain-specific. Call: `contract_pre_embedding_norm!(slice_expr)`
2059macro_rules! contract_pre_embedding_norm {
2060    () => {{}};
2061    ($input:expr) => {{
2062        let input = &$input;
2063        debug_assert!(
2064            input.iter().all(|v| v.is_finite()),
2065            "Contract embedding_norm: precondition violated — input.iter().all(|v| v.is_finite())"
2066        );
2067        debug_assert!(
2068            input.len() > 0,
2069            "Contract embedding_norm: precondition violated — input.len() > 0"
2070        );
2071    }};
2072}
2073
2074/// Preconditions for equation `logit_temperature`.
2075/// Domain-specific. Call: `contract_pre_logit_temperature!(slice_expr)`
2076macro_rules! contract_pre_logit_temperature {
2077    () => {{}};
2078    ($input:expr) => {{
2079        let indices = &$input;
2080        debug_assert!(
2081            indices.len() > 0,
2082            "Contract logit_temperature: precondition violated — indices.len() > 0"
2083        );
2084    }};
2085}
2086
2087/// Preconditions for equation `tied_weights`.
2088/// Domain-specific. Call: `contract_pre_tied_weights!(slice_expr)`
2089macro_rules! contract_pre_tied_weights {
2090    () => {{}};
2091    ($input:expr) => {{
2092        let indices = &$input;
2093        debug_assert!(
2094            indices.len() > 0,
2095            "Contract tied_weights: precondition violated — indices.len() > 0"
2096        );
2097    }};
2098}
2099
2100/// Preconditions for equation `unembedding_projection`.
2101/// Domain-specific. Call: `contract_pre_unembedding_projection!(slice_expr)`
2102macro_rules! contract_pre_unembedding_projection {
2103    () => {{}};
2104    ($input:expr) => {{
2105        let indices = &$input;
2106        debug_assert!(
2107            indices.len() > 0,
2108            "Contract unembedding_projection: precondition violated — indices.len() > 0"
2109        );
2110    }};
2111}
2112
2113/// Preconditions for equation `vocabulary_bounds`.
2114/// Domain-specific. Call: `contract_pre_vocabulary_bounds!(slice_expr)`
2115macro_rules! contract_pre_vocabulary_bounds {
2116    () => {{}};
2117    ($input:expr) => {{
2118        let input = &$input;
2119        debug_assert!(
2120            input.len() > 0,
2121            "Contract vocabulary_bounds: precondition violated — input.len() > 0"
2122        );
2123    }};
2124}
2125
2126// Auto-generated from contracts/embedding-lookup-v1.yaml — DO NOT EDIT
2127// Contract: embedding-lookup-v1
2128
2129/// Preconditions for equation `embedding_lookup`.
2130/// Domain-specific. Call: `contract_pre_embedding_lookup!(slice_expr)`
2131macro_rules! contract_pre_embedding_lookup {
2132    () => {{}};
2133    ($input:expr) => {{
2134        let token_ids = &$input;
2135    }};
2136}
2137
2138/// Postconditions for equation `embedding_lookup`.
2139/// Call before return: `contract_post_embedding_lookup!(result_expr)`
2140macro_rules! contract_post_embedding_lookup {
2141    ($result:expr) => {{
2142        let _contract_result = &$result;
2143        debug_assert!(_contract_result.iter().all(|v| v.is_finite()), "Contract embedding_lookup: postcondition violated — result.iter().all(|v| v.is_finite())");
2144    }};
2145}
2146
2147/// Combined pre+post contract for equation `embedding_lookup`.
2148macro_rules! contract_embedding_lookup {
2149    ($input:expr, $body:expr) => {{
2150        contract_pre_embedding_lookup!($input);
2151        let _contract_result = $body;
2152        contract_post_embedding_lookup!(_contract_result);
2153        _contract_result
2154    }};
2155}
2156
2157// Auto-generated from contracts/encoder-forward-v1.yaml — DO NOT EDIT
2158// Contract: encoder-forward-v1
2159
2160/// Preconditions for equation `cls_pooling`.
2161/// Domain-specific. Call: `contract_pre_cls_pooling!(slice_expr)`
2162macro_rules! contract_pre_cls_pooling {
2163    () => {{}};
2164    ($input:expr) => {{
2165        let input = &$input;
2166        debug_assert!(
2167            input.len() > 0,
2168            "Contract cls_pooling: precondition violated — input.len() > 0"
2169        );
2170    }};
2171}
2172
2173/// Preconditions for equation `encoder_layer`.
2174/// Domain-specific. Call: `contract_pre_encoder_layer!(slice_expr)`
2175macro_rules! contract_pre_encoder_layer {
2176    () => {{}};
2177    ($input:expr) => {{
2178        let input = &$input;
2179        debug_assert!(
2180            input.len() > 0,
2181            "Contract encoder_layer: precondition violated — input.len() > 0"
2182        );
2183    }};
2184}
2185
2186// Auto-generated from contracts/encoder-roundtrip-v1.yaml — DO NOT EDIT
2187// Contract: encoder-roundtrip-v1
2188
2189/// Preconditions for equation `emit_posix`.
2190/// Call at function entry: `contract_pre_emit_posix!(input_expr)`
2191macro_rules! contract_pre_emit_posix {
2192    () => {{}};
2193    ($input:expr) => {{
2194        let _contract_input = &$input;
2195        debug_assert!(
2196            !_contract_input.is_empty(),
2197            "Contract emit_posix: precondition violated — !input.is_empty()"
2198        );
2199    }};
2200}
2201
2202/// Preconditions for equation `emit_purified`.
2203/// Call at function entry: `contract_pre_emit_purified!(input_expr)`
2204macro_rules! contract_pre_emit_purified {
2205    () => {{}};
2206    ($input:expr) => {{
2207        let _contract_input = &$input;
2208        debug_assert!(
2209            !_contract_input.is_empty(),
2210            "Contract emit_purified: precondition violated — !input.is_empty()"
2211        );
2212    }};
2213}
2214
2215/// Preconditions for equation `roundtrip`.
2216/// Call at function entry: `contract_pre_roundtrip!(input_expr)`
2217macro_rules! contract_pre_roundtrip {
2218    () => {{}};
2219    ($input:expr) => {{
2220        let _contract_input = &$input;
2221        debug_assert!(
2222            !_contract_input.is_empty(),
2223            "Contract roundtrip: precondition violated — !input.is_empty()"
2224        );
2225    }};
2226}
2227
2228// Auto-generated from contracts/error-handling-v1.yaml — DO NOT EDIT
2229// Contract: error-handling-v1
2230
2231/// Preconditions for equation `error_handling`.
2232/// Domain-specific. Call: `contract_pre_error_handling!(slice_expr)`
2233macro_rules! contract_pre_error_handling {
2234    () => {{}};
2235    ($input:expr) => {{
2236        let input = &$input;
2237        debug_assert!(
2238            input.len() > 0,
2239            "Contract error_handling: precondition violated — input.len() > 0"
2240        );
2241    }};
2242}
2243
2244/// Postconditions for equation `error_handling`.
2245/// Call before return: `contract_post_error_handling!(result_expr)`
2246macro_rules! contract_post_error_handling {
2247    ($result:expr) => {{
2248        let _contract_result = &$result;
2249        debug_assert!(
2250            _contract_result.len() > 0,
2251            "Contract error_handling: postcondition violated — result.len() > 0"
2252        );
2253    }};
2254}
2255
2256/// Combined pre+post contract for equation `error_handling`.
2257macro_rules! contract_error_handling {
2258    ($input:expr, $body:expr) => {{
2259        contract_pre_error_handling!($input);
2260        let _contract_result = $body;
2261        contract_post_error_handling!(_contract_result);
2262        _contract_result
2263    }};
2264}
2265
2266// Auto-generated from contracts/execution-safety-v1.yaml — DO NOT EDIT
2267// Contract: execution-safety-v1
2268
2269/// Preconditions for equation `atomic_write`.
2270/// Call at function entry: `contract_pre_atomic_write!(input_expr)`
2271macro_rules! contract_pre_atomic_write {
2272    () => {{}};
2273    ($input:expr) => {{
2274        let _contract_input = &$input;
2275    }};
2276}
2277
2278/// Preconditions for equation `jidoka_stop`.
2279/// Call at function entry: `contract_pre_jidoka_stop!(input_expr)`
2280macro_rules! contract_pre_jidoka_stop {
2281    () => {{}};
2282    ($input:expr) => {{
2283        let _contract_input = &$input;
2284    }};
2285}
2286
2287// Auto-generated from contracts/f16-conversion-v1.yaml — DO NOT EDIT
2288// Contract: f16-conversion-v1
2289
2290/// Preconditions for equation `f16_to_f32_bias`.
2291/// Domain-specific. Call: `contract_pre_f16_to_f32_bias!(slice_expr)`
2292macro_rules! contract_pre_f16_to_f32_bias {
2293    () => {{}};
2294    ($input:expr) => {{
2295        let input = &$input;
2296        debug_assert!(
2297            input.len() > 0,
2298            "Contract f16_to_f32_bias: precondition violated — input.len() > 0"
2299        );
2300    }};
2301}
2302
2303/// Preconditions for equation `roundtrip`.
2304/// Domain-specific. Call: `contract_pre_roundtrip!(slice_expr)`
2305macro_rules! contract_pre_roundtrip {
2306    () => {{}};
2307    ($input:expr) => {{
2308        let input = &$input;
2309        debug_assert!(
2310            input.len() > 0,
2311            "Contract roundtrip: precondition violated — input.len() > 0"
2312        );
2313    }};
2314}
2315
2316// Auto-generated from contracts/flash-attention-v1.yaml — DO NOT EDIT
2317// Contract: flash-attention-v1
2318
2319/// Preconditions for equation `flash_attention`.
2320/// Domain-specific. Call: `contract_pre_flash_attention!(slice_expr)`
2321macro_rules! contract_pre_flash_attention {
2322    () => {{}};
2323    ($input:expr) => {{
2324        let q = &$input;
2325        debug_assert!(
2326            q.len() > 0,
2327            "Contract flash_attention: precondition violated — q.len() > 0"
2328        );
2329    }};
2330}
2331
2332// Auto-generated from contracts/format-parity-v1.yaml — DO NOT EDIT
2333// Contract: format-parity-v1
2334
2335/// Preconditions for equation `element_count`.
2336/// Domain-specific. Call: `contract_pre_element_count!(slice_expr)`
2337macro_rules! contract_pre_element_count {
2338    () => {{}};
2339    ($input:expr) => {{
2340        let input = &$input;
2341        debug_assert!(
2342            input.len() > 0,
2343            "Contract element_count: precondition violated — input.len() > 0"
2344        );
2345    }};
2346}
2347
2348/// Preconditions for equation `identity_1d`.
2349/// Domain-specific. Call: `contract_pre_identity_1d!(slice_expr)`
2350macro_rules! contract_pre_identity_1d {
2351    () => {{}};
2352    ($input:expr) => {{
2353        let input = &$input;
2354        debug_assert!(
2355            input.len() > 0,
2356            "Contract identity_1d: precondition violated — input.len() > 0"
2357        );
2358        debug_assert!(
2359            input.iter().all(|v| v.is_finite()),
2360            "Contract identity_1d: precondition violated — input.iter().all(|v| v.is_finite())"
2361        );
2362    }};
2363}
2364
2365/// Preconditions for equation `name_bijection`.
2366/// Domain-specific. Call: `contract_pre_name_bijection!(slice_expr)`
2367macro_rules! contract_pre_name_bijection {
2368    () => {{}};
2369    ($input:expr) => {{
2370        let input = &$input;
2371        debug_assert!(
2372            input.len() > 0,
2373            "Contract name_bijection: precondition violated — input.len() > 0"
2374        );
2375    }};
2376}
2377
2378/// Preconditions for equation `transpose_involution`.
2379/// Domain-specific. Call: `contract_pre_transpose_involution!(slice_expr)`
2380macro_rules! contract_pre_transpose_involution {
2381    () => {{}};
2382    ($input:expr) => {{
2383        let a = &$input;
2384        debug_assert!(
2385            a.len() > 0,
2386            "Contract transpose_involution: precondition violated — a.len() > 0"
2387        );
2388    }};
2389}
2390
2391// Auto-generated from contracts/fp8-interchange-v1.yaml — DO NOT EDIT
2392// Contract: fp8-interchange-v1
2393
2394/// Preconditions for equation `e4m3_encode`.
2395/// Domain-specific. Call: `contract_pre_e4m3_encode!(slice_expr)`
2396macro_rules! contract_pre_e4m3_encode {
2397    () => {{}};
2398    ($input:expr) => {{
2399        let input = &$input;
2400        debug_assert!(
2401            input.len() > 0,
2402            "Contract e4m3_encode: precondition violated — input.len() > 0"
2403        );
2404    }};
2405}
2406
2407/// Preconditions for equation `e5m2_encode`.
2408/// Domain-specific. Call: `contract_pre_e5m2_encode!(slice_expr)`
2409macro_rules! contract_pre_e5m2_encode {
2410    () => {{}};
2411    ($input:expr) => {{
2412        let input = &$input;
2413        debug_assert!(
2414            input.len() > 0,
2415            "Contract e5m2_encode: precondition violated — input.len() > 0"
2416        );
2417    }};
2418}
2419
2420/// Preconditions for equation `roundtrip`.
2421/// Domain-specific. Call: `contract_pre_roundtrip!(slice_expr)`
2422macro_rules! contract_pre_roundtrip {
2423    () => {{}};
2424    ($input:expr) => {{
2425        let input = &$input;
2426        debug_assert!(
2427            input.len() > 0,
2428            "Contract roundtrip: precondition violated — input.len() > 0"
2429        );
2430    }};
2431}
2432
2433// Auto-generated from contracts/fused-qkv-projection-v1.yaml — DO NOT EDIT
2434// Contract: fused-qkv-projection-v1
2435
2436/// Preconditions for equation `fused_qkv`.
2437/// Domain-specific. Call: `contract_pre_fused_qkv!(slice_expr)`
2438macro_rules! contract_pre_fused_qkv {
2439    () => {{}};
2440    ($input:expr) => {{
2441        let a = &$input;
2442        debug_assert!(
2443            a.len() > 0,
2444            "Contract fused_qkv: precondition violated — a.len() > 0"
2445        );
2446    }};
2447}
2448
2449/// Preconditions for equation `separate_qkv`.
2450/// Domain-specific. Call: `contract_pre_separate_qkv!(slice_expr)`
2451macro_rules! contract_pre_separate_qkv {
2452    () => {{}};
2453    ($input:expr) => {{
2454        let a = &$input;
2455        debug_assert!(
2456            a.len() > 0,
2457            "Contract separate_qkv: precondition violated — a.len() > 0"
2458        );
2459    }};
2460}
2461
2462/// Preconditions for equation `shared_q8_qkv`.
2463/// Domain-specific. Call: `contract_pre_shared_q8_qkv!(slice_expr)`
2464macro_rules! contract_pre_shared_q8_qkv {
2465    () => {{}};
2466    ($input:expr) => {{
2467        let a = &$input;
2468        debug_assert!(
2469            a.len() > 0,
2470            "Contract shared_q8_qkv: precondition violated — a.len() > 0"
2471        );
2472    }};
2473}
2474
2475// Auto-generated from contracts/gated-delta-net-v1.yaml — DO NOT EDIT
2476// Contract: gated-delta-net-v1
2477
2478/// Preconditions for equation `decay`.
2479/// Domain-specific. Call: `contract_pre_decay!(slice_expr)`
2480macro_rules! contract_pre_decay {
2481    () => {{}};
2482    ($input:expr) => {{
2483        let x = &$input;
2484        debug_assert!(
2485            x.iter().all(|v| v.is_finite()),
2486            "Contract decay: precondition violated — x.iter().all(|v| v.is_finite())"
2487        );
2488        debug_assert!(
2489            x.len() > 0,
2490            "Contract decay: precondition violated — x.len() > 0"
2491        );
2492    }};
2493}
2494
2495/// Preconditions for equation `delta`.
2496/// Domain-specific. Call: `contract_pre_delta!(slice_expr)`
2497macro_rules! contract_pre_delta {
2498    () => {{}};
2499    ($input:expr) => {{
2500        let input = &$input;
2501        debug_assert!(
2502            input.len() > 0,
2503            "Contract delta: precondition violated — input.len() > 0"
2504        );
2505        debug_assert!(
2506            input.iter().all(|v| v.is_finite()),
2507            "Contract delta: precondition violated — input.iter().all(|v| v.is_finite())"
2508        );
2509    }};
2510}
2511
2512/// Preconditions for equation `output`.
2513/// Domain-specific. Call: `contract_pre_output!(slice_expr)`
2514macro_rules! contract_pre_output {
2515    () => {{}};
2516    ($input:expr) => {{
2517        let input = &$input;
2518        debug_assert!(
2519            input.len() > 0,
2520            "Contract output: precondition violated — input.len() > 0"
2521        );
2522        debug_assert!(
2523            input.iter().all(|v| v.is_finite()),
2524            "Contract output: precondition violated — input.iter().all(|v| v.is_finite())"
2525        );
2526    }};
2527}
2528
2529/// Preconditions for equation `read`.
2530/// Domain-specific. Call: `contract_pre_read!(slice_expr)`
2531macro_rules! contract_pre_read {
2532    () => {{}};
2533    ($input:expr) => {{
2534        let input = &$input;
2535        debug_assert!(
2536            input.len() > 0,
2537            "Contract read: precondition violated — input.len() > 0"
2538        );
2539        debug_assert!(
2540            input.iter().all(|v| v.is_finite()),
2541            "Contract read: precondition violated — input.iter().all(|v| v.is_finite())"
2542        );
2543    }};
2544}
2545
2546/// Preconditions for equation `write`.
2547/// Domain-specific. Call: `contract_pre_write!(slice_expr)`
2548macro_rules! contract_pre_write {
2549    () => {{}};
2550    ($input:expr) => {{
2551        let input = &$input;
2552        debug_assert!(
2553            input.len() > 0,
2554            "Contract write: precondition violated — input.len() > 0"
2555        );
2556        debug_assert!(
2557            input.iter().all(|v| v.is_finite()),
2558            "Contract write: precondition violated — input.iter().all(|v| v.is_finite())"
2559        );
2560    }};
2561}
2562
2563// Auto-generated from contracts/gbm-v1.yaml — DO NOT EDIT
2564// Contract: gbm-v1
2565
2566/// Preconditions for equation `gradient_boost`.
2567/// Domain-specific. Call: `contract_pre_gradient_boost!(slice_expr)`
2568macro_rules! contract_pre_gradient_boost {
2569    () => {{}};
2570    ($input:expr) => {{
2571        let grad_output = &$input;
2572        debug_assert!(grad_output.len() > 0,
2573            "Contract gradient_boost: precondition violated — grad_output.len() > 0");
2574        debug_assert!(grad_output.iter().all(|v| v.is_finite()),
2575            "Contract gradient_boost: precondition violated — grad_output.iter().all(|v| v.is_finite())");
2576    }};
2577}
2578
2579/// Preconditions for equation `negative_gradient`.
2580/// Domain-specific. Call: `contract_pre_negative_gradient!(slice_expr)`
2581macro_rules! contract_pre_negative_gradient {
2582    () => {{}};
2583    ($input:expr) => {{
2584        let grad_output = &$input;
2585        debug_assert!(grad_output.len() > 0,
2586            "Contract negative_gradient: precondition violated — grad_output.len() > 0");
2587        debug_assert!(grad_output.iter().all(|v| v.is_finite()),
2588            "Contract negative_gradient: precondition violated — grad_output.iter().all(|v| v.is_finite())");
2589    }};
2590}
2591
2592/// Preconditions for equation `predict`.
2593/// Domain-specific. Call: `contract_pre_predict!(slice_expr)`
2594macro_rules! contract_pre_predict {
2595    () => {{}};
2596    ($input:expr) => {{
2597        let input = &$input;
2598        debug_assert!(
2599            input.len() > 0,
2600            "Contract predict: precondition violated — input.len() > 0"
2601        );
2602        debug_assert!(
2603            input.iter().all(|v| v.is_finite()),
2604            "Contract predict: precondition violated — input.iter().all(|v| v.is_finite())"
2605        );
2606    }};
2607}
2608
2609/// Preconditions for equation `training_loss`.
2610/// Domain-specific. Call: `contract_pre_training_loss!(slice_expr)`
2611macro_rules! contract_pre_training_loss {
2612    () => {{}};
2613    ($input:expr) => {{
2614        let predicted = &$input;
2615        debug_assert!(
2616            predicted.len() > 0,
2617            "Contract training_loss: precondition violated — predicted.len() > 0"
2618        );
2619    }};
2620}
2621
2622// Auto-generated from contracts/gelu-kernel-v1.yaml — DO NOT EDIT
2623// Contract: gelu-kernel-v1
2624
2625/// Preconditions for equation `gelu`.
2626/// Domain-specific. Call: `contract_pre_gelu!(slice_expr)`
2627macro_rules! contract_pre_gelu {
2628    () => {{}};
2629    ($input:expr) => {{
2630        let x = &$input;
2631        debug_assert!(
2632            x.iter().all(|v| v.is_finite()),
2633            "Contract gelu: precondition violated — x.iter().all(|v| v.is_finite())"
2634        );
2635        debug_assert!(
2636            x.len() > 0,
2637            "Contract gelu: precondition violated — x.len() > 0"
2638        );
2639    }};
2640}
2641
2642/// Preconditions for equation `gelu_tanh_approx`.
2643/// Domain-specific. Call: `contract_pre_gelu_tanh_approx!(slice_expr)`
2644macro_rules! contract_pre_gelu_tanh_approx {
2645    () => {{}};
2646    ($input:expr) => {{
2647        let x = &$input;
2648        debug_assert!(
2649            x.iter().all(|v| v.is_finite()),
2650            "Contract gelu_tanh_approx: precondition violated — x.iter().all(|v| v.is_finite())"
2651        );
2652        debug_assert!(
2653            x.len() > 0,
2654            "Contract gelu_tanh_approx: precondition violated — x.len() > 0"
2655        );
2656    }};
2657}
2658
2659// Auto-generated from contracts/gemm-backward-tiled-v1.yaml — DO NOT EDIT
2660// Contract: gemm-backward-tiled-v1
2661
2662/// Preconditions for equation `backward_a_gemm`.
2663/// Domain-specific. Call: `contract_pre_backward_a_gemm!(slice_expr)`
2664macro_rules! contract_pre_backward_a_gemm {
2665    () => {{}};
2666    ($input:expr) => {{
2667        let a = &$input;
2668        debug_assert!(
2669            a.len() > 0,
2670            "Contract backward_a_gemm: precondition violated — a.len() > 0"
2671        );
2672    }};
2673}
2674
2675/// Preconditions for equation `backward_b_gemm`.
2676/// Domain-specific. Call: `contract_pre_backward_b_gemm!(slice_expr)`
2677macro_rules! contract_pre_backward_b_gemm {
2678    () => {{}};
2679    ($input:expr) => {{
2680        let a = &$input;
2681        debug_assert!(
2682            a.len() > 0,
2683            "Contract backward_b_gemm: precondition violated — a.len() > 0"
2684        );
2685    }};
2686}
2687
2688/// Preconditions for equation `shared_memory_per_tile`.
2689/// Domain-specific. Call: `contract_pre_shared_memory_per_tile!(slice_expr)`
2690macro_rules! contract_pre_shared_memory_per_tile {
2691    () => {{}};
2692    ($input:expr) => {{
2693        let a = &$input;
2694        debug_assert!(
2695            a.len() > 0,
2696            "Contract shared_memory_per_tile: precondition violated — a.len() > 0"
2697        );
2698    }};
2699}
2700
2701/// Preconditions for equation `tiled_gemm_arithmetic_intensity`.
2702/// Domain-specific. Call: `contract_pre_tiled_gemm_arithmetic_intensity!(slice_expr)`
2703macro_rules! contract_pre_tiled_gemm_arithmetic_intensity {
2704    () => {{}};
2705    ($input:expr) => {{
2706        let a = &$input;
2707        debug_assert!(
2708            a.len() > 0,
2709            "Contract tiled_gemm_arithmetic_intensity: precondition violated — a.len() > 0"
2710        );
2711    }};
2712}
2713
2714/// Preconditions for equation `unrolled_instruction_ratio`.
2715/// Domain-specific. Call: `contract_pre_unrolled_instruction_ratio!(slice_expr)`
2716macro_rules! contract_pre_unrolled_instruction_ratio {
2717    () => {{}};
2718    ($input:expr) => {{
2719        let a = &$input;
2720        debug_assert!(
2721            a.len() > 0,
2722            "Contract unrolled_instruction_ratio: precondition violated — a.len() > 0"
2723        );
2724    }};
2725}
2726
2727// Auto-generated from contracts/gguf-cpu-cache-v1.yaml — DO NOT EDIT
2728// Contract: gguf-cpu-cache-v1
2729
2730/// Preconditions for equation `autoregressive_generation`.
2731/// Call at function entry: `contract_pre_autoregressive_generation!(input_expr)`
2732macro_rules! contract_pre_autoregressive_generation {
2733    () => {{}};
2734    ($input:expr) => {{
2735        let _contract_input = &$input;
2736    }};
2737}
2738
2739// Auto-generated from contracts/glm-v1.yaml — DO NOT EDIT
2740// Contract: glm-v1
2741
2742/// Preconditions for equation `binomial_link`.
2743/// Domain-specific. Call: `contract_pre_binomial_link!(slice_expr)`
2744macro_rules! contract_pre_binomial_link {
2745    () => {{}};
2746    ($input:expr) => {{
2747        let input = &$input;
2748        debug_assert!(
2749            input.len() > 0,
2750            "Contract binomial_link: precondition violated — input.len() > 0"
2751        );
2752        debug_assert!(
2753            input.iter().all(|v| v.is_finite()),
2754            "Contract binomial_link: precondition violated — input.iter().all(|v| v.is_finite())"
2755        );
2756    }};
2757}
2758
2759/// Preconditions for equation `gamma_link`.
2760/// Domain-specific. Call: `contract_pre_gamma_link!(slice_expr)`
2761macro_rules! contract_pre_gamma_link {
2762    () => {{}};
2763    ($input:expr) => {{
2764        let input = &$input;
2765        debug_assert!(
2766            input.len() > 0,
2767            "Contract gamma_link: precondition violated — input.len() > 0"
2768        );
2769        debug_assert!(
2770            input.iter().all(|v| v.is_finite()),
2771            "Contract gamma_link: precondition violated — input.iter().all(|v| v.is_finite())"
2772        );
2773    }};
2774}
2775
2776/// Preconditions for equation `irls_fit`.
2777/// Domain-specific. Call: `contract_pre_irls_fit!(slice_expr)`
2778macro_rules! contract_pre_irls_fit {
2779    () => {{}};
2780    ($input:expr) => {{
2781        let input = &$input;
2782        debug_assert!(
2783            input.len() > 0,
2784            "Contract irls_fit: precondition violated — input.len() > 0"
2785        );
2786        debug_assert!(
2787            input.iter().all(|v| v.is_finite()),
2788            "Contract irls_fit: precondition violated — input.iter().all(|v| v.is_finite())"
2789        );
2790    }};
2791}
2792
2793/// Preconditions for equation `poisson_link`.
2794/// Domain-specific. Call: `contract_pre_poisson_link!(slice_expr)`
2795macro_rules! contract_pre_poisson_link {
2796    () => {{}};
2797    ($input:expr) => {{
2798        let input = &$input;
2799        debug_assert!(
2800            input.len() > 0,
2801            "Contract poisson_link: precondition violated — input.len() > 0"
2802        );
2803        debug_assert!(
2804            input.iter().all(|v| v.is_finite()),
2805            "Contract poisson_link: precondition violated — input.iter().all(|v| v.is_finite())"
2806        );
2807    }};
2808}
2809
2810// Auto-generated from contracts/gnn-v1.yaml — DO NOT EDIT
2811// Contract: gnn-v1
2812
2813/// Preconditions for equation `gcn_aggregate`.
2814/// Call at function entry: `contract_pre_gcn_aggregate!(input_expr)`
2815macro_rules! contract_pre_gcn_aggregate {
2816    () => {{}};
2817    ($input:expr) => {{
2818        let _contract_input = &$input;
2819    }};
2820}
2821
2822/// Preconditions for equation `global_max_pool`.
2823/// Call at function entry: `contract_pre_global_max_pool!(input_expr)`
2824macro_rules! contract_pre_global_max_pool {
2825    () => {{}};
2826    ($input:expr) => {{
2827        let _contract_input = &$input;
2828    }};
2829}
2830
2831/// Preconditions for equation `global_mean_pool`.
2832/// Call at function entry: `contract_pre_global_mean_pool!(input_expr)`
2833macro_rules! contract_pre_global_mean_pool {
2834    () => {{}};
2835    ($input:expr) => {{
2836        let _contract_input = &$input;
2837    }};
2838}
2839
2840/// Preconditions for equation `message_passing`.
2841/// Call at function entry: `contract_pre_message_passing!(input_expr)`
2842macro_rules! contract_pre_message_passing {
2843    () => {{}};
2844    ($input:expr) => {{
2845        let _contract_input = &$input;
2846    }};
2847}
2848
2849// Auto-generated from contracts/gpu-context-health-v1.yaml — DO NOT EDIT
2850// Contract: gpu-context-health-v1
2851
2852/// Preconditions for equation `context_health`.
2853/// Domain-specific. Call: `contract_pre_context_health!(slice_expr)`
2854macro_rules! contract_pre_context_health {
2855    () => {{}};
2856    ($input:expr) => {{
2857        let input = &$input;
2858        debug_assert!(
2859            input.len() > 0,
2860            "Contract context_health: precondition violated — input.len() > 0"
2861        );
2862    }};
2863}
2864
2865/// Preconditions for equation `cuda_graph_guard`.
2866/// Call at function entry: `contract_pre_cuda_graph_guard!(input_expr)`
2867macro_rules! contract_pre_cuda_graph_guard {
2868    () => {{}};
2869    ($input:expr) => {{
2870        let _contract_input = &$input;
2871    }};
2872}
2873
2874/// Preconditions for equation `culink_skip`.
2875/// Domain-specific. Call: `contract_pre_culink_skip!(slice_expr)`
2876macro_rules! contract_pre_culink_skip {
2877    () => {{}};
2878    ($input:expr) => {{
2879        let input = &$input;
2880        debug_assert!(
2881            input.len() > 0,
2882            "Contract culink_skip: precondition violated — input.len() > 0"
2883        );
2884    }};
2885}
2886
2887/// Preconditions for equation `fp8_architecture_guard`.
2888/// Domain-specific. Call: `contract_pre_fp8_architecture_guard!(slice_expr)`
2889macro_rules! contract_pre_fp8_architecture_guard {
2890    () => {{}};
2891    ($input:expr) => {{
2892        let input = &$input;
2893        debug_assert!(
2894            input.len() > 0,
2895            "Contract fp8_architecture_guard: precondition violated — input.len() > 0"
2896        );
2897    }};
2898}
2899
2900// Auto-generated from contracts/gpu-decode-profiling-v1.yaml — DO NOT EDIT
2901// Contract: gpu-decode-profiling-v1
2902
2903/// Preconditions for equation `brick_ordering`.
2904/// Domain-specific. Call: `contract_pre_brick_ordering!(slice_expr)`
2905macro_rules! contract_pre_brick_ordering {
2906    () => {{}};
2907    ($input:expr) => {{
2908        let input = &$input;
2909        debug_assert!(
2910            input.len() > 0,
2911            "Contract brick_ordering: precondition violated — input.len() > 0"
2912        );
2913    }};
2914}
2915
2916/// Preconditions for equation `graph_disable`.
2917/// Domain-specific. Call: `contract_pre_graph_disable!(slice_expr)`
2918macro_rules! contract_pre_graph_disable {
2919    () => {{}};
2920    ($input:expr) => {{
2921        let input = &$input;
2922        debug_assert!(
2923            input.len() > 0,
2924            "Contract graph_disable: precondition violated — input.len() > 0"
2925        );
2926    }};
2927}
2928
2929/// Preconditions for equation `report_completeness`.
2930/// Domain-specific. Call: `contract_pre_report_completeness!(slice_expr)`
2931macro_rules! contract_pre_report_completeness {
2932    () => {{}};
2933    ($input:expr) => {{
2934        let input = &$input;
2935        debug_assert!(
2936            input.len() > 0,
2937            "Contract report_completeness: precondition violated — input.len() > 0"
2938        );
2939    }};
2940}
2941
2942/// Preconditions for equation `report_denominator`.
2943/// Domain-specific. Call: `contract_pre_report_denominator!(slice_expr)`
2944macro_rules! contract_pre_report_denominator {
2945    () => {{}};
2946    ($input:expr) => {{
2947        let input = &$input;
2948        debug_assert!(
2949            input.len() > 0,
2950            "Contract report_denominator: precondition violated — input.len() > 0"
2951        );
2952    }};
2953}
2954
2955/// Preconditions for equation `report_fidelity`.
2956/// Domain-specific. Call: `contract_pre_report_fidelity!(slice_expr)`
2957macro_rules! contract_pre_report_fidelity {
2958    () => {{}};
2959    ($input:expr) => {{
2960        let input = &$input;
2961        debug_assert!(
2962            input.len() > 0,
2963            "Contract report_fidelity: precondition violated — input.len() > 0"
2964        );
2965    }};
2966}
2967
2968/// Preconditions for equation `report_metadata`.
2969/// Domain-specific. Call: `contract_pre_report_metadata!(slice_expr)`
2970macro_rules! contract_pre_report_metadata {
2971    () => {{}};
2972    ($input:expr) => {{
2973        let input = &$input;
2974        debug_assert!(
2975            input.len() > 0,
2976            "Contract report_metadata: precondition violated — input.len() > 0"
2977        );
2978    }};
2979}
2980
2981/// Preconditions for equation `sync_verification`.
2982/// Domain-specific. Call: `contract_pre_sync_verification!(slice_expr)`
2983macro_rules! contract_pre_sync_verification {
2984    () => {{}};
2985    ($input:expr) => {{
2986        let input = &$input;
2987        debug_assert!(
2988            input.len() > 0,
2989            "Contract sync_verification: precondition violated — input.len() > 0"
2990        );
2991    }};
2992}
2993
2994/// Preconditions for equation `token_accounting`.
2995/// Domain-specific. Call: `contract_pre_token_accounting!(slice_expr)`
2996macro_rules! contract_pre_token_accounting {
2997    () => {{}};
2998    ($input:expr) => {{
2999        let input = &$input;
3000        debug_assert!(
3001            input.len() > 0,
3002            "Contract token_accounting: precondition violated — input.len() > 0"
3003        );
3004    }};
3005}
3006
3007/// Preconditions for equation `wall_coverage`.
3008/// Domain-specific. Call: `contract_pre_wall_coverage!(slice_expr)`
3009macro_rules! contract_pre_wall_coverage {
3010    () => {{}};
3011    ($input:expr) => {{
3012        let input = &$input;
3013        debug_assert!(
3014            input.len() > 0,
3015            "Contract wall_coverage: precondition violated — input.len() > 0"
3016        );
3017    }};
3018}
3019
3020// Auto-generated from contracts/gpu-multi-backend-parity-v1.yaml — DO NOT EDIT
3021// Contract: gpu-multi-backend-parity-v1
3022
3023/// Preconditions for equation `backend_priority`.
3024/// Domain-specific. Call: `contract_pre_backend_priority!(slice_expr)`
3025macro_rules! contract_pre_backend_priority {
3026    () => {{}};
3027    ($input:expr) => {{
3028        let input = &$input;
3029        debug_assert!(
3030            input.len() > 0,
3031            "Contract backend_priority: precondition violated — input.len() > 0"
3032        );
3033    }};
3034}
3035
3036/// Preconditions for equation `bandwidth_bound_theorem`.
3037/// Domain-specific. Call: `contract_pre_bandwidth_bound_theorem!(slice_expr)`
3038macro_rules! contract_pre_bandwidth_bound_theorem {
3039    () => {{}};
3040    ($input:expr) => {{
3041        let input = &$input;
3042        debug_assert!(
3043            input.len() > 0,
3044            "Contract bandwidth_bound_theorem: precondition violated — input.len() > 0"
3045        );
3046    }};
3047}
3048
3049/// Preconditions for equation `jit_compilation_correctness`.
3050/// Domain-specific. Call: `contract_pre_jit_compilation_correctness!(slice_expr)`
3051macro_rules! contract_pre_jit_compilation_correctness {
3052    () => {{}};
3053    ($input:expr) => {{
3054        let input = &$input;
3055        debug_assert!(
3056            input.len() > 0,
3057            "Contract jit_compilation_correctness: precondition violated — input.len() > 0"
3058        );
3059    }};
3060}
3061
3062/// Preconditions for equation `multi_backend_parity`.
3063/// Domain-specific. Call: `contract_pre_multi_backend_parity!(slice_expr)`
3064macro_rules! contract_pre_multi_backend_parity {
3065    () => {{}};
3066    ($input:expr) => {{
3067        let input = &$input;
3068        debug_assert!(
3069            input.len() > 0,
3070            "Contract multi_backend_parity: precondition violated — input.len() > 0"
3071        );
3072    }};
3073}
3074
3075// Auto-generated from contracts/gpu-weight-residency-v1.yaml — DO NOT EDIT
3076// Contract: gpu-weight-residency-v1
3077
3078/// Preconditions for equation `pcie_overhead`.
3079/// Domain-specific. Call: `contract_pre_pcie_overhead!(slice_expr)`
3080macro_rules! contract_pre_pcie_overhead {
3081    () => {{}};
3082    ($input:expr) => {{
3083        let input = &$input;
3084        debug_assert!(
3085            input.len() > 0,
3086            "Contract pcie_overhead: precondition violated — input.len() > 0"
3087        );
3088    }};
3089}
3090
3091/// Preconditions for equation `throughput_target`.
3092/// Domain-specific. Call: `contract_pre_throughput_target!(slice_expr)`
3093macro_rules! contract_pre_throughput_target {
3094    () => {{}};
3095    ($input:expr) => {{
3096        let input = &$input;
3097        debug_assert!(
3098            input.len() > 0,
3099            "Contract throughput_target: precondition violated — input.len() > 0"
3100        );
3101    }};
3102}
3103
3104// Auto-generated from contracts/gqa-kernel-v1.yaml — DO NOT EDIT
3105// Contract: gqa-kernel-v1
3106
3107/// Preconditions for equation `gqa`.
3108/// Domain-specific. Call: `contract_pre_gqa!(slice_expr)`
3109macro_rules! contract_pre_gqa {
3110    () => {{}};
3111    ($input:expr) => {{
3112        let q = &$input;
3113        debug_assert!(
3114            q.len() > 0,
3115            "Contract gqa: precondition violated — q.len() > 0"
3116        );
3117    }};
3118}
3119
3120// Auto-generated from contracts/graph-centrality-v1.yaml — DO NOT EDIT
3121// Contract: graph-centrality-v1
3122
3123/// Preconditions for equation `betweenness`.
3124/// Call at function entry: `contract_pre_betweenness!(input_expr)`
3125macro_rules! contract_pre_betweenness {
3126    () => {{}};
3127    ($input:expr) => {{
3128        let _contract_input = &$input;
3129    }};
3130}
3131
3132/// Preconditions for equation `closeness`.
3133/// Call at function entry: `contract_pre_closeness!(input_expr)`
3134macro_rules! contract_pre_closeness {
3135    () => {{}};
3136    ($input:expr) => {{
3137        let _contract_input = &$input;
3138    }};
3139}
3140
3141/// Preconditions for equation `degree`.
3142/// Call at function entry: `contract_pre_degree!(input_expr)`
3143macro_rules! contract_pre_degree {
3144    () => {{}};
3145    ($input:expr) => {{
3146        let _contract_input = &$input;
3147    }};
3148}
3149
3150/// Preconditions for equation `eigenvector`.
3151/// Call at function entry: `contract_pre_eigenvector!(input_expr)`
3152macro_rules! contract_pre_eigenvector {
3153    () => {{}};
3154    ($input:expr) => {{
3155        let _contract_input = &$input;
3156    }};
3157}
3158
3159/// Preconditions for equation `harmonic`.
3160/// Call at function entry: `contract_pre_harmonic!(input_expr)`
3161macro_rules! contract_pre_harmonic {
3162    () => {{}};
3163    ($input:expr) => {{
3164        let _contract_input = &$input;
3165    }};
3166}
3167
3168/// Preconditions for equation `katz`.
3169/// Call at function entry: `contract_pre_katz!(input_expr)`
3170macro_rules! contract_pre_katz {
3171    () => {{}};
3172    ($input:expr) => {{
3173        let _contract_input = &$input;
3174    }};
3175}
3176
3177// Auto-generated from contracts/hybrid-layer-dispatch-v1.yaml — DO NOT EDIT
3178// Contract: hybrid-layer-dispatch-v1
3179
3180/// Preconditions for equation `conv1d_causal`.
3181/// Domain-specific. Call: `contract_pre_conv1d_causal!(slice_expr)`
3182macro_rules! contract_pre_conv1d_causal {
3183    () => {{}};
3184    ($input:expr) => {{
3185        let a = &$input;
3186        debug_assert!(
3187            a.len() > 0,
3188            "Contract conv1d_causal: precondition violated — a.len() > 0"
3189        );
3190    }};
3191}
3192
3193/// Preconditions for equation `head_grouping`.
3194/// Domain-specific. Call: `contract_pre_head_grouping!(slice_expr)`
3195macro_rules! contract_pre_head_grouping {
3196    () => {{}};
3197    ($input:expr) => {{
3198        let input = &$input;
3199        debug_assert!(
3200            input.len() > 0,
3201            "Contract head_grouping: precondition violated — input.len() > 0"
3202        );
3203        debug_assert!(
3204            input.iter().all(|v| v.is_finite()),
3205            "Contract head_grouping: precondition violated — input.iter().all(|v| v.is_finite())"
3206        );
3207    }};
3208}
3209
3210/// Preconditions for equation `hybrid_dispatch`.
3211/// Domain-specific. Call: `contract_pre_hybrid_dispatch!(slice_expr)`
3212macro_rules! contract_pre_hybrid_dispatch {
3213    () => {{}};
3214    ($input:expr) => {{
3215        let input = &$input;
3216        debug_assert!(input.len() > 0,
3217            "Contract hybrid_dispatch: precondition violated — input.len() > 0");
3218        debug_assert!(input.iter().all(|v| v.is_finite()),
3219            "Contract hybrid_dispatch: precondition violated — input.iter().all(|v| v.is_finite())");
3220    }};
3221}
3222
3223/// Preconditions for equation `linear_associativity`.
3224/// Domain-specific. Call: `contract_pre_linear_associativity!(slice_expr)`
3225macro_rules! contract_pre_linear_associativity {
3226    () => {{}};
3227    ($input:expr) => {{
3228        let input = &$input;
3229        debug_assert!(input.len() > 0,
3230            "Contract linear_associativity: precondition violated — input.len() > 0");
3231        debug_assert!(input.iter().all(|v| v.is_finite()),
3232            "Contract linear_associativity: precondition violated — input.iter().all(|v| v.is_finite())");
3233    }};
3234}
3235
3236/// Preconditions for equation `linear_no_softmax`.
3237/// Domain-specific. Call: `contract_pre_linear_no_softmax!(slice_expr)`
3238macro_rules! contract_pre_linear_no_softmax {
3239    () => {{}};
3240    ($input:expr) => {{
3241        let x = &$input;
3242        debug_assert!(
3243            x.iter().all(|v| v.is_finite()),
3244            "Contract linear_no_softmax: precondition violated — x.iter().all(|v| v.is_finite())"
3245        );
3246        debug_assert!(
3247            x.len() > 0,
3248            "Contract linear_no_softmax: precondition violated — x.len() > 0"
3249        );
3250    }};
3251}
3252
3253/// Preconditions for equation `linear_shapes`.
3254/// Domain-specific. Call: `contract_pre_linear_shapes!(slice_expr)`
3255macro_rules! contract_pre_linear_shapes {
3256    () => {{}};
3257    ($input:expr) => {{
3258        let input = &$input;
3259        debug_assert!(
3260            input.len() > 0,
3261            "Contract linear_shapes: precondition violated — input.len() > 0"
3262        );
3263        debug_assert!(
3264            input.iter().all(|v| v.is_finite()),
3265            "Contract linear_shapes: precondition violated — input.iter().all(|v| v.is_finite())"
3266        );
3267    }};
3268}
3269
3270// Auto-generated from contracts/ica-v1.yaml — DO NOT EDIT
3271// Contract: ica-v1
3272
3273/// Preconditions for equation `fastica`.
3274/// Domain-specific. Call: `contract_pre_fastica!(slice_expr)`
3275macro_rules! contract_pre_fastica {
3276    () => {{}};
3277    ($input:expr) => {{
3278        let a = &$input;
3279        debug_assert!(
3280            a.len() > 0,
3281            "Contract fastica: precondition violated — a.len() > 0"
3282        );
3283    }};
3284}
3285
3286/// Preconditions for equation `mixing`.
3287/// Domain-specific. Call: `contract_pre_mixing!(slice_expr)`
3288macro_rules! contract_pre_mixing {
3289    () => {{}};
3290    ($input:expr) => {{
3291        let a = &$input;
3292        debug_assert!(
3293            a.len() > 0,
3294            "Contract mixing: precondition violated — a.len() > 0"
3295        );
3296    }};
3297}
3298
3299/// Preconditions for equation `unmixing`.
3300/// Domain-specific. Call: `contract_pre_unmixing!(slice_expr)`
3301macro_rules! contract_pre_unmixing {
3302    () => {{}};
3303    ($input:expr) => {{
3304        let a = &$input;
3305        debug_assert!(
3306            a.len() > 0,
3307            "Contract unmixing: precondition violated — a.len() > 0"
3308        );
3309    }};
3310}
3311
3312// Auto-generated from contracts/inference-pipeline-v1.yaml — DO NOT EDIT
3313// Contract: inference-pipeline-v1
3314
3315/// Preconditions for equation `decode_step`.
3316/// Domain-specific. Call: `contract_pre_decode_step!(slice_expr)`
3317macro_rules! contract_pre_decode_step {
3318    () => {{}};
3319    ($input:expr) => {{
3320        let input = &$input;
3321        debug_assert!(
3322            input.len() > 0,
3323            "Contract decode_step: precondition violated — input.len() > 0"
3324        );
3325    }};
3326}
3327
3328/// Preconditions for equation `hybrid_layer_schedule`.
3329/// Call at function entry: `contract_pre_hybrid_layer_schedule!(input_expr)`
3330macro_rules! contract_pre_hybrid_layer_schedule {
3331    () => {{}};
3332    ($input:expr) => {{
3333        let _contract_input = &$input;
3334    }};
3335}
3336
3337/// Preconditions for equation `kv_cache_growth`.
3338/// Domain-specific. Call: `contract_pre_kv_cache_growth!(slice_expr)`
3339macro_rules! contract_pre_kv_cache_growth {
3340    () => {{}};
3341    ($input:expr) => {{
3342        let q = &$input;
3343        debug_assert!(
3344            q.len() > 0,
3345            "Contract kv_cache_growth: precondition violated — q.len() > 0"
3346        );
3347    }};
3348}
3349
3350/// Preconditions for equation `layer_composition`.
3351/// Domain-specific. Call: `contract_pre_layer_composition!(slice_expr)`
3352macro_rules! contract_pre_layer_composition {
3353    () => {{}};
3354    ($input:expr) => {{
3355        let indices = &$input;
3356        debug_assert!(
3357            indices.len() > 0,
3358            "Contract layer_composition: precondition violated — indices.len() > 0"
3359        );
3360    }};
3361}
3362
3363/// Preconditions for equation `prefill_phase`.
3364/// Call at function entry: `contract_pre_prefill_phase!(input_expr)`
3365macro_rules! contract_pre_prefill_phase {
3366    () => {{}};
3367    ($input:expr) => {{
3368        let _contract_input = &$input;
3369    }};
3370}
3371
3372/// Preconditions for equation `residual_stream`.
3373/// Call at function entry: `contract_pre_residual_stream!(input_expr)`
3374macro_rules! contract_pre_residual_stream {
3375    () => {{}};
3376    ($input:expr) => {{
3377        let _contract_input = &$input;
3378    }};
3379}
3380
3381// Auto-generated from contracts/int8-symmetric-quant-v1.yaml — DO NOT EDIT
3382// Contract: int8-symmetric-quant-v1
3383
3384/// Preconditions for equation `dequant_dot`.
3385/// Domain-specific. Call: `contract_pre_dequant_dot!(slice_expr)`
3386macro_rules! contract_pre_dequant_dot {
3387    () => {{}};
3388    ($input:expr) => {{
3389        let a = &$input;
3390        debug_assert!(
3391            a.len() > 0,
3392            "Contract dequant_dot: precondition violated — a.len() > 0"
3393        );
3394    }};
3395}
3396
3397/// Preconditions for equation `per_row_scale`.
3398/// Domain-specific. Call: `contract_pre_per_row_scale!(slice_expr)`
3399macro_rules! contract_pre_per_row_scale {
3400    () => {{}};
3401    ($input:expr) => {{
3402        let input = &$input;
3403        debug_assert!(
3404            input.len() > 0,
3405            "Contract per_row_scale: precondition violated — input.len() > 0"
3406        );
3407    }};
3408}
3409
3410/// Preconditions for equation `quantize`.
3411/// Domain-specific. Call: `contract_pre_quantize!(slice_expr)`
3412macro_rules! contract_pre_quantize {
3413    () => {{}};
3414    ($input:expr) => {{
3415        let input = &$input;
3416        debug_assert!(
3417            input.len() > 0,
3418            "Contract quantize: precondition violated — input.len() > 0"
3419        );
3420    }};
3421}
3422
3423// Auto-generated from contracts/iterator-v1.yaml — DO NOT EDIT
3424// Contract: iterator-v1
3425
3426/// Preconditions for equation `iterator`.
3427/// Domain-specific. Call: `contract_pre_iterator!(slice_expr)`
3428macro_rules! contract_pre_iterator {
3429    () => {{}};
3430    ($input:expr) => {{
3431        let input = &$input;
3432        debug_assert!(
3433            input.len() > 0,
3434            "Contract iterator: precondition violated — input.len() > 0"
3435        );
3436    }};
3437}
3438
3439// Auto-generated from contracts/kernel-fusion-v1.yaml — DO NOT EDIT
3440// Contract: kernel-fusion-v1
3441
3442/// Preconditions for equation `identity`.
3443/// Domain-specific. Call: `contract_pre_identity!(slice_expr)`
3444macro_rules! contract_pre_identity {
3445    () => {{}};
3446    ($input:expr) => {{
3447        let q = &$input;
3448        debug_assert!(
3449            q.len() > 0,
3450            "Contract identity: precondition violated — q.len() > 0"
3451        );
3452    }};
3453}
3454
3455// Auto-generated from contracts/kernel-launch-budget-v1.yaml — DO NOT EDIT
3456// Contract: kernel-launch-budget-v1
3457
3458/// Preconditions for equation `bsum_budget`.
3459/// Domain-specific. Call: `contract_pre_bsum_budget!(slice_expr)`
3460macro_rules! contract_pre_bsum_budget {
3461    () => {{}};
3462    ($input:expr) => {{
3463        let input = &$input;
3464        debug_assert!(
3465            input.len() > 0,
3466            "Contract bsum_budget: precondition violated — input.len() > 0"
3467        );
3468    }};
3469}
3470
3471/// Preconditions for equation `per_layer_decomposition`.
3472/// Domain-specific. Call: `contract_pre_per_layer_decomposition!(slice_expr)`
3473macro_rules! contract_pre_per_layer_decomposition {
3474    () => {{}};
3475    ($input:expr) => {{
3476        let indices = &$input;
3477        debug_assert!(
3478            indices.len() > 0,
3479            "Contract per_layer_decomposition: precondition violated — indices.len() > 0"
3480        );
3481    }};
3482}
3483
3484/// Preconditions for equation `per_token_launches`.
3485/// Domain-specific. Call: `contract_pre_per_token_launches!(slice_expr)`
3486macro_rules! contract_pre_per_token_launches {
3487    () => {{}};
3488    ($input:expr) => {{
3489        let input = &$input;
3490        debug_assert!(
3491            input.len() > 0,
3492            "Contract per_token_launches: precondition violated — input.len() > 0"
3493        );
3494    }};
3495}
3496
3497// Auto-generated from contracts/kmeans-kernel-v1.yaml — DO NOT EDIT
3498// Contract: kmeans-kernel-v1
3499
3500/// Preconditions for equation `assignment`.
3501/// Domain-specific. Call: `contract_pre_assignment!(slice_expr)`
3502macro_rules! contract_pre_assignment {
3503    () => {{}};
3504    ($input:expr) => {{
3505        let input = &$input;
3506        debug_assert!(
3507            input.len() > 0,
3508            "Contract assignment: precondition violated — input.len() > 0"
3509        );
3510        debug_assert!(
3511            input.iter().all(|v| v.is_finite()),
3512            "Contract assignment: precondition violated — input.iter().all(|v| v.is_finite())"
3513        );
3514    }};
3515}
3516
3517/// Preconditions for equation `objective`.
3518/// Domain-specific. Call: `contract_pre_objective!(slice_expr)`
3519macro_rules! contract_pre_objective {
3520    () => {{}};
3521    ($input:expr) => {{
3522        let input = &$input;
3523        debug_assert!(
3524            input.len() > 0,
3525            "Contract objective: precondition violated — input.len() > 0"
3526        );
3527        debug_assert!(
3528            input.iter().all(|v| v.is_finite()),
3529            "Contract objective: precondition violated — input.iter().all(|v| v.is_finite())"
3530        );
3531    }};
3532}
3533
3534/// Preconditions for equation `update`.
3535/// Domain-specific. Call: `contract_pre_update!(slice_expr)`
3536macro_rules! contract_pre_update {
3537    () => {{}};
3538    ($input:expr) => {{
3539        let input = &$input;
3540        debug_assert!(
3541            input.len() > 0,
3542            "Contract update: precondition violated — input.len() > 0"
3543        );
3544        debug_assert!(
3545            input.iter().all(|v| v.is_finite()),
3546            "Contract update: precondition violated — input.iter().all(|v| v.is_finite())"
3547        );
3548    }};
3549}
3550
3551// Auto-generated from contracts/kv-cache-equivalence-v1.yaml — DO NOT EDIT
3552// Contract: kv-cache-equivalence-v1
3553
3554/// Preconditions for equation `batched_serial_equivalence`.
3555/// Call at function entry: `contract_pre_batched_serial_equivalence!(input_expr)`
3556macro_rules! contract_pre_batched_serial_equivalence {
3557    () => {{}};
3558    ($input:expr) => {{
3559        let _contract_input = &$input;
3560    }};
3561}
3562
3563/// Preconditions for equation `fused_kernel`.
3564/// Call at function entry: `contract_pre_fused_kernel!(input_expr)`
3565macro_rules! contract_pre_fused_kernel {
3566    () => {{}};
3567    ($input:expr) => {{
3568        let _contract_input = &$input;
3569    }};
3570}
3571
3572/// Preconditions for equation `page_shape`.
3573/// Call at function entry: `contract_pre_page_shape!(input_expr)`
3574macro_rules! contract_pre_page_shape {
3575    () => {{}};
3576    ($input:expr) => {{
3577        let _contract_input = &$input;
3578    }};
3579}
3580
3581/// Preconditions for equation `prefill_incremental`.
3582/// Call at function entry: `contract_pre_prefill_incremental!(input_expr)`
3583macro_rules! contract_pre_prefill_incremental {
3584    () => {{}};
3585    ($input:expr) => {{
3586        let _contract_input = &$input;
3587    }};
3588}
3589
3590// Auto-generated from contracts/kv-cache-sizing-v1.yaml — DO NOT EDIT
3591// Contract: kv-cache-sizing-v1
3592
3593/// Preconditions for equation `bias_absence`.
3594/// Call at function entry: `contract_pre_bias_absence!(input_expr)`
3595macro_rules! contract_pre_bias_absence {
3596    () => {{}};
3597    ($input:expr) => {{
3598        let _contract_input = &$input;
3599    }};
3600}
3601
3602/// Preconditions for equation `hybrid_accounting`.
3603/// Call at function entry: `contract_pre_hybrid_accounting!(input_expr)`
3604macro_rules! contract_pre_hybrid_accounting {
3605    () => {{}};
3606    ($input:expr) => {{
3607        let _contract_input = &$input;
3608    }};
3609}
3610
3611/// Preconditions for equation `per_token_per_layer`.
3612/// Domain-specific. Call: `contract_pre_per_token_per_layer!(slice_expr)`
3613macro_rules! contract_pre_per_token_per_layer {
3614    () => {{}};
3615    ($input:expr) => {{
3616        let input = &$input;
3617        debug_assert!(
3618            input.len() > 0,
3619            "Contract per_token_per_layer: precondition violated — input.len() > 0"
3620        );
3621    }};
3622}
3623
3624/// Preconditions for equation `total_kv_memory`.
3625/// Call at function entry: `contract_pre_total_kv_memory!(input_expr)`
3626macro_rules! contract_pre_total_kv_memory {
3627    () => {{}};
3628    ($input:expr) => {{
3629        let _contract_input = &$input;
3630    }};
3631}
3632
3633/// Preconditions for equation `zero_input_identity`.
3634/// Call at function entry: `contract_pre_zero_input_identity!(input_expr)`
3635macro_rules! contract_pre_zero_input_identity {
3636    () => {{}};
3637    ($input:expr) => {{
3638        let _contract_input = &$input;
3639    }};
3640}
3641
3642// Auto-generated from contracts/layer-parity-v1.yaml — DO NOT EDIT
3643// Contract: layer-parity-v1
3644
3645/// Preconditions for equation `identity`.
3646/// Domain-specific. Call: `contract_pre_identity!(slice_expr)`
3647macro_rules! contract_pre_identity {
3648    () => {{}};
3649    ($input:expr) => {{
3650        let x = &$input;
3651    }};
3652}
3653
3654// Auto-generated from contracts/layernorm-kernel-v1.yaml — DO NOT EDIT
3655// Contract: layernorm-kernel-v1
3656
3657/// Preconditions for equation `layernorm`.
3658/// Domain-specific. Call: `contract_pre_layernorm!(slice_expr)`
3659macro_rules! contract_pre_layernorm {
3660    () => {{}};
3661    ($input:expr) => {{
3662        let x = &$input;
3663        debug_assert!(
3664            x.len() > 0,
3665            "Contract layernorm: precondition violated — x.len() > 0"
3666        );
3667        debug_assert!(
3668            x.iter().all(|v| v.is_finite()),
3669            "Contract layernorm: precondition violated — x.iter().all(|v| v.is_finite())"
3670        );
3671    }};
3672}
3673
3674/// Postconditions for equation `layernorm`.
3675/// Call before return: `contract_post_layernorm!(result_expr)`
3676macro_rules! contract_post_layernorm {
3677    ($result:expr) => {{
3678        let _contract_result = &$result;
3679        debug_assert!(
3680            _contract_result.iter().all(|v| v.is_finite()),
3681            "Contract layernorm: postcondition violated — result.iter().all(|v| v.is_finite())"
3682        );
3683    }};
3684}
3685
3686/// Combined pre+post contract for equation `layernorm`.
3687macro_rules! contract_layernorm {
3688    ($input:expr, $body:expr) => {{
3689        contract_pre_layernorm!($input);
3690        let _contract_result = $body;
3691        contract_post_layernorm!(_contract_result);
3692        _contract_result
3693    }};
3694}
3695
3696/// Preconditions for equation `statistics`.
3697/// Domain-specific. Call: `contract_pre_statistics!(slice_expr)`
3698macro_rules! contract_pre_statistics {
3699    () => {{}};
3700    ($input:expr) => {{
3701        let input = &$input;
3702        debug_assert!(
3703            input.iter().all(|v| v.is_finite()),
3704            "Contract statistics: precondition violated — input.iter().all(|v| v.is_finite())"
3705        );
3706        debug_assert!(
3707            input.len() > 0,
3708            "Contract statistics: precondition violated — input.len() > 0"
3709        );
3710    }};
3711}
3712
3713// Auto-generated from contracts/lbfgs-kernel-v1.yaml — DO NOT EDIT
3714// Contract: lbfgs-kernel-v1
3715
3716/// Preconditions for equation `line_search`.
3717/// Domain-specific. Call: `contract_pre_line_search!(slice_expr)`
3718macro_rules! contract_pre_line_search {
3719    () => {{}};
3720    ($input:expr) => {{
3721        let params = &$input;
3722        debug_assert!(
3723            params.len() > 0,
3724            "Contract line_search: precondition violated — params.len() > 0"
3725        );
3726    }};
3727}
3728
3729/// Preconditions for equation `secant_condition`.
3730/// Domain-specific. Call: `contract_pre_secant_condition!(slice_expr)`
3731macro_rules! contract_pre_secant_condition {
3732    () => {{}};
3733    ($input:expr) => {{
3734        let params = &$input;
3735        debug_assert!(
3736            params.len() > 0,
3737            "Contract secant_condition: precondition violated — params.len() > 0"
3738        );
3739    }};
3740}
3741
3742/// Preconditions for equation `two_loop_recursion`.
3743/// Domain-specific. Call: `contract_pre_two_loop_recursion!(slice_expr)`
3744macro_rules! contract_pre_two_loop_recursion {
3745    () => {{}};
3746    ($input:expr) => {{
3747        let params = &$input;
3748        debug_assert!(
3749            params.len() > 0,
3750            "Contract two_loop_recursion: precondition violated — params.len() > 0"
3751        );
3752    }};
3753}
3754
3755// Auto-generated from contracts/learned-position-embedding-v1.yaml — DO NOT EDIT
3756// Contract: learned-position-embedding-v1
3757
3758/// Preconditions for equation `position_embedding`.
3759/// Domain-specific. Call: `contract_pre_position_embedding!(slice_expr)`
3760macro_rules! contract_pre_position_embedding {
3761    () => {{}};
3762    ($input:expr) => {{
3763        let indices = &$input;
3764        debug_assert!(
3765            indices.len() > 0,
3766            "Contract position_embedding: precondition violated — indices.len() > 0"
3767        );
3768    }};
3769}
3770
3771// Auto-generated from contracts/linear-models-v1.yaml — DO NOT EDIT
3772// Contract: linear-models-v1
3773
3774/// Preconditions for equation `logistic_predict_proba`.
3775/// Domain-specific. Call: `contract_pre_logistic_predict_proba!(slice_expr)`
3776macro_rules! contract_pre_logistic_predict_proba {
3777    () => {{}};
3778    ($input:expr) => {{
3779        let input = &$input;
3780        debug_assert!(input.len() > 0,
3781            "Contract logistic_predict_proba: precondition violated — input.len() > 0");
3782        debug_assert!(input.iter().all(|v| v.is_finite()),
3783            "Contract logistic_predict_proba: precondition violated — input.iter().all(|v| v.is_finite())");
3784    }};
3785}
3786
3787/// Preconditions for equation `ols_fit`.
3788/// Domain-specific. Call: `contract_pre_ols_fit!(slice_expr)`
3789macro_rules! contract_pre_ols_fit {
3790    () => {{}};
3791    ($input:expr) => {{
3792        let input = &$input;
3793        debug_assert!(
3794            input.len() > 0,
3795            "Contract ols_fit: precondition violated — input.len() > 0"
3796        );
3797        debug_assert!(
3798            input.iter().all(|v| v.is_finite()),
3799            "Contract ols_fit: precondition violated — input.iter().all(|v| v.is_finite())"
3800        );
3801    }};
3802}
3803
3804/// Preconditions for equation `ols_predict`.
3805/// Domain-specific. Call: `contract_pre_ols_predict!(slice_expr)`
3806macro_rules! contract_pre_ols_predict {
3807    () => {{}};
3808    ($input:expr) => {{
3809        let input = &$input;
3810        debug_assert!(
3811            input.len() > 0,
3812            "Contract ols_predict: precondition violated — input.len() > 0"
3813        );
3814        debug_assert!(
3815            input.iter().all(|v| v.is_finite()),
3816            "Contract ols_predict: precondition violated — input.iter().all(|v| v.is_finite())"
3817        );
3818    }};
3819}
3820
3821/// Preconditions for equation `r_squared_training`.
3822/// Domain-specific. Call: `contract_pre_r_squared_training!(slice_expr)`
3823macro_rules! contract_pre_r_squared_training {
3824    () => {{}};
3825    ($input:expr) => {{
3826        let input = &$input;
3827        debug_assert!(input.len() > 0,
3828            "Contract r_squared_training: precondition violated — input.len() > 0");
3829        debug_assert!(input.iter().all(|v| v.is_finite()),
3830            "Contract r_squared_training: precondition violated — input.iter().all(|v| v.is_finite())");
3831    }};
3832}
3833
3834// Auto-generated from contracts/linear-probe-classifier-v1.yaml — DO NOT EDIT
3835// Contract: linear-probe-classifier-v1
3836
3837/// Preconditions for equation `linear_probe`.
3838/// Domain-specific. Call: `contract_pre_linear_probe!(slice_expr)`
3839macro_rules! contract_pre_linear_probe {
3840    () => {{}};
3841    ($input:expr) => {{
3842        let input = &$input;
3843        debug_assert!(
3844            input.len() > 0,
3845            "Contract linear_probe: precondition violated — input.len() > 0"
3846        );
3847    }};
3848}
3849
3850// Auto-generated from contracts/linear-projection-v1.yaml — DO NOT EDIT
3851// Contract: linear-projection-v1
3852
3853/// Preconditions for equation `linear_forward`.
3854/// Domain-specific. Call: `contract_pre_linear_forward!(slice_expr)`
3855macro_rules! contract_pre_linear_forward {
3856    () => {{}};
3857    ($input:expr) => {{
3858        let a = &$input;
3859        debug_assert!(
3860            a.len() > 0,
3861            "Contract linear_forward: precondition violated — a.len() > 0"
3862        );
3863    }};
3864}
3865
3866/// Preconditions for equation `linear_no_bias`.
3867/// Domain-specific. Call: `contract_pre_linear_no_bias!(slice_expr)`
3868macro_rules! contract_pre_linear_no_bias {
3869    () => {{}};
3870    ($input:expr) => {{
3871        let a = &$input;
3872        debug_assert!(
3873            a.len() > 0,
3874            "Contract linear_no_bias: precondition violated — a.len() > 0"
3875        );
3876    }};
3877}
3878
3879// Auto-generated from contracts/lora-algebra-v1.yaml — DO NOT EDIT
3880// Contract: lora-algebra-v1
3881
3882/// Preconditions for equation `dare_unbiased`.
3883/// Domain-specific. Call: `contract_pre_dare_unbiased!(slice_expr)`
3884macro_rules! contract_pre_dare_unbiased {
3885    () => {{}};
3886    ($input:expr) => {{
3887        let input = &$input;
3888        debug_assert!(
3889            input.len() > 0,
3890            "Contract dare_unbiased: precondition violated — input.len() > 0"
3891        );
3892        debug_assert!(
3893            input.iter().all(|v| v.is_finite()),
3894            "Contract dare_unbiased: precondition violated — input.iter().all(|v| v.is_finite())"
3895        );
3896    }};
3897}
3898
3899/// Preconditions for equation `eckart_young`.
3900/// Domain-specific. Call: `contract_pre_eckart_young!(slice_expr)`
3901macro_rules! contract_pre_eckart_young {
3902    () => {{}};
3903    ($input:expr) => {{
3904        let input = &$input;
3905        debug_assert!(
3906            input.len() > 0,
3907            "Contract eckart_young: precondition violated — input.len() > 0"
3908        );
3909        debug_assert!(
3910            input.iter().all(|v| v.is_finite()),
3911            "Contract eckart_young: precondition violated — input.iter().all(|v| v.is_finite())"
3912        );
3913    }};
3914}
3915
3916/// Preconditions for equation `lora_shape`.
3917/// Domain-specific. Call: `contract_pre_lora_shape!(slice_expr)`
3918macro_rules! contract_pre_lora_shape {
3919    () => {{}};
3920    ($input:expr) => {{
3921        let input = &$input;
3922        debug_assert!(
3923            input.len() > 0,
3924            "Contract lora_shape: precondition violated — input.len() > 0"
3925        );
3926        debug_assert!(
3927            input.iter().all(|v| v.is_finite()),
3928            "Contract lora_shape: precondition violated — input.iter().all(|v| v.is_finite())"
3929        );
3930    }};
3931}
3932
3933/// Preconditions for equation `shape_preservation`.
3934/// Domain-specific. Call: `contract_pre_shape_preservation!(slice_expr)`
3935macro_rules! contract_pre_shape_preservation {
3936    () => {{}};
3937    ($input:expr) => {{
3938        let input = &$input;
3939        debug_assert!(input.len() > 0,
3940            "Contract shape_preservation: precondition violated — input.len() > 0");
3941        debug_assert!(input.iter().all(|v| v.is_finite()),
3942            "Contract shape_preservation: precondition violated — input.iter().all(|v| v.is_finite())");
3943    }};
3944}
3945
3946/// Preconditions for equation `task_vector`.
3947/// Domain-specific. Call: `contract_pre_task_vector!(slice_expr)`
3948macro_rules! contract_pre_task_vector {
3949    () => {{}};
3950    ($input:expr) => {{
3951        let input = &$input;
3952        debug_assert!(
3953            input.len() > 0,
3954            "Contract task_vector: precondition violated — input.len() > 0"
3955        );
3956        debug_assert!(
3957            input.iter().all(|v| v.is_finite()),
3958            "Contract task_vector: precondition violated — input.iter().all(|v| v.is_finite())"
3959        );
3960    }};
3961}
3962
3963// Auto-generated from contracts/lora-gradient-flow-v1.yaml — DO NOT EDIT
3964// Contract: lora-gradient-flow-v1
3965
3966/// Preconditions for equation `identity`.
3967/// Domain-specific. Call: `contract_pre_identity!(slice_expr)`
3968macro_rules! contract_pre_identity {
3969    () => {{}};
3970    ($input:expr) => {{
3971        let x = &$input;
3972    }};
3973}
3974
3975// Auto-generated from contracts/loss-functions-v1.yaml — DO NOT EDIT
3976// Contract: loss-functions-v1
3977
3978/// Preconditions for equation `bce`.
3979/// Domain-specific. Call: `contract_pre_bce!(slice_expr)`
3980macro_rules! contract_pre_bce {
3981    () => {{}};
3982    ($input:expr) => {{
3983        let predicted = &$input;
3984        debug_assert!(
3985            predicted.len() > 0,
3986            "Contract bce: precondition violated — predicted.len() > 0"
3987        );
3988    }};
3989}
3990
3991/// Preconditions for equation `huber`.
3992/// Domain-specific. Call: `contract_pre_huber!(slice_expr)`
3993macro_rules! contract_pre_huber {
3994    () => {{}};
3995    ($input:expr) => {{
3996        let predicted = &$input;
3997        debug_assert!(
3998            predicted.len() > 0,
3999            "Contract huber: precondition violated — predicted.len() > 0"
4000        );
4001    }};
4002}
4003
4004/// Preconditions for equation `l1_loss`.
4005/// Domain-specific. Call: `contract_pre_l1_loss!(slice_expr)`
4006macro_rules! contract_pre_l1_loss {
4007    () => {{}};
4008    ($input:expr) => {{
4009        let predicted = &$input;
4010        debug_assert!(
4011            predicted.len() > 0,
4012            "Contract l1_loss: precondition violated — predicted.len() > 0"
4013        );
4014    }};
4015}
4016
4017/// Preconditions for equation `mse_loss`.
4018/// Domain-specific. Call: `contract_pre_mse_loss!(slice_expr)`
4019macro_rules! contract_pre_mse_loss {
4020    () => {{}};
4021    ($input:expr) => {{
4022        let predicted = &$input;
4023        debug_assert!(
4024            predicted.len() > 0,
4025            "Contract mse_loss: precondition violated — predicted.len() > 0"
4026        );
4027    }};
4028}
4029
4030/// Preconditions for equation `nll`.
4031/// Domain-specific. Call: `contract_pre_nll!(slice_expr)`
4032macro_rules! contract_pre_nll {
4033    () => {{}};
4034    ($input:expr) => {{
4035        let predicted = &$input;
4036        debug_assert!(
4037            predicted.len() > 0,
4038            "Contract nll: precondition violated — predicted.len() > 0"
4039        );
4040    }};
4041}
4042
4043/// Preconditions for equation `smooth_l1`.
4044/// Domain-specific. Call: `contract_pre_smooth_l1!(slice_expr)`
4045macro_rules! contract_pre_smooth_l1 {
4046    () => {{}};
4047    ($input:expr) => {{
4048        let predicted = &$input;
4049        debug_assert!(
4050            predicted.len() > 0,
4051            "Contract smooth_l1: precondition violated — predicted.len() > 0"
4052        );
4053    }};
4054}
4055
4056// Auto-generated from contracts/matmul-kernel-v1.yaml — DO NOT EDIT
4057// Contract: matmul-kernel-v1
4058
4059/// Preconditions for equation `matmul`.
4060/// Domain-specific. Call: `contract_pre_matmul!(slice_expr)`
4061macro_rules! contract_pre_matmul {
4062    () => {{}};
4063    ($input:expr) => {{
4064        let a = &$input;
4065    }};
4066}
4067
4068/// Postconditions for equation `matmul`.
4069/// Call before return: `contract_post_matmul!(result_expr)`
4070macro_rules! contract_post_matmul {
4071    ($result:expr) => {{
4072        let _contract_result = &$result;
4073        debug_assert!(
4074            _contract_result.iter().all(|v| v.is_finite()),
4075            "Contract matmul: postcondition violated — result.iter().all(|v| v.is_finite())"
4076        );
4077    }};
4078}
4079
4080/// Combined pre+post contract for equation `matmul`.
4081macro_rules! contract_matmul {
4082    ($input:expr, $body:expr) => {{
4083        contract_pre_matmul!($input);
4084        let _contract_result = $body;
4085        contract_post_matmul!(_contract_result);
4086        _contract_result
4087    }};
4088}
4089
4090/// Preconditions for equation `quantized_dot`.
4091/// Domain-specific. Call: `contract_pre_quantized_dot!(slice_expr)`
4092macro_rules! contract_pre_quantized_dot {
4093    () => {{}};
4094    ($input:expr) => {{
4095        let input = &$input;
4096        debug_assert!(
4097            input.len() > 0,
4098            "Contract quantized_dot: precondition violated — input.len() > 0"
4099        );
4100    }};
4101}
4102
4103// Auto-generated from contracts/memory-safety-v1.yaml — DO NOT EDIT
4104// Contract: memory-safety-v1
4105
4106/// Preconditions for equation `bounds_safety`.
4107/// Domain-specific. Call: `contract_pre_bounds_safety!(slice_expr)`
4108macro_rules! contract_pre_bounds_safety {
4109    () => {{}};
4110    ($input:expr) => {{
4111        let input = &$input;
4112        debug_assert!(
4113            input.len() > 0,
4114            "Contract bounds_safety: precondition violated — input.len() > 0"
4115        );
4116    }};
4117}
4118
4119/// Preconditions for equation `drop_safety`.
4120/// Domain-specific. Call: `contract_pre_drop_safety!(slice_expr)`
4121macro_rules! contract_pre_drop_safety {
4122    () => {{}};
4123    ($input:expr) => {{
4124        let input = &$input;
4125        debug_assert!(
4126            input.len() > 0,
4127            "Contract drop_safety: precondition violated — input.len() > 0"
4128        );
4129    }};
4130}
4131
4132/// Preconditions for equation `escape_analysis`.
4133/// Domain-specific. Call: `contract_pre_escape_analysis!(slice_expr)`
4134macro_rules! contract_pre_escape_analysis {
4135    () => {{}};
4136    ($input:expr) => {{
4137        let input = &$input;
4138        debug_assert!(
4139            input.len() > 0,
4140            "Contract escape_analysis: precondition violated — input.len() > 0"
4141        );
4142    }};
4143}
4144
4145/// Preconditions for equation `lifetime_safety`.
4146/// Domain-specific. Call: `contract_pre_lifetime_safety!(slice_expr)`
4147macro_rules! contract_pre_lifetime_safety {
4148    () => {{}};
4149    ($input:expr) => {{
4150        let input = &$input;
4151        debug_assert!(
4152            input.len() > 0,
4153            "Contract lifetime_safety: precondition violated — input.len() > 0"
4154        );
4155    }};
4156}
4157
4158/// Preconditions for equation `ownership_invariant`.
4159/// Domain-specific. Call: `contract_pre_ownership_invariant!(slice_expr)`
4160macro_rules! contract_pre_ownership_invariant {
4161    () => {{}};
4162    ($input:expr) => {{
4163        let input = &$input;
4164        debug_assert!(
4165            input.len() > 0,
4166            "Contract ownership_invariant: precondition violated — input.len() > 0"
4167        );
4168    }};
4169}
4170
4171/// Preconditions for equation `use_after_move`.
4172/// Domain-specific. Call: `contract_pre_use_after_move!(slice_expr)`
4173macro_rules! contract_pre_use_after_move {
4174    () => {{}};
4175    ($input:expr) => {{
4176        let input = &$input;
4177        debug_assert!(
4178            input.len() > 0,
4179            "Contract use_after_move: precondition violated — input.len() > 0"
4180        );
4181    }};
4182}
4183
4184// Auto-generated from contracts/metaheuristics-v1.yaml — DO NOT EDIT
4185// Contract: metaheuristics-v1
4186
4187/// Preconditions for equation `best_monotone`.
4188/// Domain-specific. Call: `contract_pre_best_monotone!(slice_expr)`
4189macro_rules! contract_pre_best_monotone {
4190    () => {{}};
4191    ($input:expr) => {{
4192        let params = &$input;
4193        debug_assert!(
4194            params.len() > 0,
4195            "Contract best_monotone: precondition violated — params.len() > 0"
4196        );
4197    }};
4198}
4199
4200/// Preconditions for equation `ga_crossover`.
4201/// Domain-specific. Call: `contract_pre_ga_crossover!(slice_expr)`
4202macro_rules! contract_pre_ga_crossover {
4203    () => {{}};
4204    ($input:expr) => {{
4205        let params = &$input;
4206        debug_assert!(
4207            params.len() > 0,
4208            "Contract ga_crossover: precondition violated — params.len() > 0"
4209        );
4210    }};
4211}
4212
4213/// Preconditions for equation `pso_velocity`.
4214/// Domain-specific. Call: `contract_pre_pso_velocity!(slice_expr)`
4215macro_rules! contract_pre_pso_velocity {
4216    () => {{}};
4217    ($input:expr) => {{
4218        let params = &$input;
4219        debug_assert!(
4220            params.len() > 0,
4221            "Contract pso_velocity: precondition violated — params.len() > 0"
4222        );
4223    }};
4224}
4225
4226/// Preconditions for equation `sa_acceptance`.
4227/// Domain-specific. Call: `contract_pre_sa_acceptance!(slice_expr)`
4228macro_rules! contract_pre_sa_acceptance {
4229    () => {{}};
4230    ($input:expr) => {{
4231        let params = &$input;
4232        debug_assert!(
4233            params.len() > 0,
4234            "Contract sa_acceptance: precondition violated — params.len() > 0"
4235        );
4236    }};
4237}
4238
4239// Auto-generated from contracts/metrics-classification-v1.yaml — DO NOT EDIT
4240// Contract: metrics-classification-v1
4241
4242/// Preconditions for equation `accuracy`.
4243/// Domain-specific. Call: `contract_pre_accuracy!(slice_expr)`
4244macro_rules! contract_pre_accuracy {
4245    () => {{}};
4246    ($input:expr) => {{
4247        let input = &$input;
4248        debug_assert!(
4249            input.len() > 0,
4250            "Contract accuracy: precondition violated — input.len() > 0"
4251        );
4252        debug_assert!(
4253            input.iter().all(|v| v.is_finite()),
4254            "Contract accuracy: precondition violated — input.iter().all(|v| v.is_finite())"
4255        );
4256    }};
4257}
4258
4259/// Preconditions for equation `confusion_matrix`.
4260/// Domain-specific. Call: `contract_pre_confusion_matrix!(slice_expr)`
4261macro_rules! contract_pre_confusion_matrix {
4262    () => {{}};
4263    ($input:expr) => {{
4264        let input = &$input;
4265        debug_assert!(input.len() > 0,
4266            "Contract confusion_matrix: precondition violated — input.len() > 0");
4267        debug_assert!(input.iter().all(|v| v.is_finite()),
4268            "Contract confusion_matrix: precondition violated — input.iter().all(|v| v.is_finite())");
4269    }};
4270}
4271
4272/// Preconditions for equation `f1_score`.
4273/// Domain-specific. Call: `contract_pre_f1_score!(slice_expr)`
4274macro_rules! contract_pre_f1_score {
4275    () => {{}};
4276    ($input:expr) => {{
4277        let input = &$input;
4278        debug_assert!(
4279            input.len() > 0,
4280            "Contract f1_score: precondition violated — input.len() > 0"
4281        );
4282        debug_assert!(
4283            input.iter().all(|v| v.is_finite()),
4284            "Contract f1_score: precondition violated — input.iter().all(|v| v.is_finite())"
4285        );
4286    }};
4287}
4288
4289/// Preconditions for equation `precision`.
4290/// Domain-specific. Call: `contract_pre_precision!(slice_expr)`
4291macro_rules! contract_pre_precision {
4292    () => {{}};
4293    ($input:expr) => {{
4294        let input = &$input;
4295        debug_assert!(
4296            input.len() > 0,
4297            "Contract precision: precondition violated — input.len() > 0"
4298        );
4299        debug_assert!(
4300            input.iter().all(|v| v.is_finite()),
4301            "Contract precision: precondition violated — input.iter().all(|v| v.is_finite())"
4302        );
4303    }};
4304}
4305
4306/// Preconditions for equation `recall`.
4307/// Domain-specific. Call: `contract_pre_recall!(slice_expr)`
4308macro_rules! contract_pre_recall {
4309    () => {{}};
4310    ($input:expr) => {{
4311        let input = &$input;
4312        debug_assert!(
4313            input.len() > 0,
4314            "Contract recall: precondition violated — input.len() > 0"
4315        );
4316        debug_assert!(
4317            input.iter().all(|v| v.is_finite()),
4318            "Contract recall: precondition violated — input.iter().all(|v| v.is_finite())"
4319        );
4320    }};
4321}
4322
4323// Auto-generated from contracts/metrics-clustering-v1.yaml — DO NOT EDIT
4324// Contract: metrics-clustering-v1
4325
4326/// Preconditions for equation `inertia`.
4327/// Call at function entry: `contract_pre_inertia!(input_expr)`
4328macro_rules! contract_pre_inertia {
4329    () => {{}};
4330    ($input:expr) => {{
4331        let _contract_input = &$input;
4332    }};
4333}
4334
4335/// Preconditions for equation `silhouette_coefficient`.
4336/// Call at function entry: `contract_pre_silhouette_coefficient!(input_expr)`
4337macro_rules! contract_pre_silhouette_coefficient {
4338    () => {{}};
4339    ($input:expr) => {{
4340        let _contract_input = &$input;
4341    }};
4342}
4343
4344/// Preconditions for equation `silhouette_score`.
4345/// Call at function entry: `contract_pre_silhouette_score!(input_expr)`
4346macro_rules! contract_pre_silhouette_score {
4347    () => {{}};
4348    ($input:expr) => {{
4349        let _contract_input = &$input;
4350    }};
4351}
4352
4353// Auto-generated from contracts/metrics-ranking-v1.yaml — DO NOT EDIT
4354// Contract: metrics-ranking-v1
4355
4356/// Preconditions for equation `hit_at_k`.
4357/// Domain-specific. Call: `contract_pre_hit_at_k!(slice_expr)`
4358macro_rules! contract_pre_hit_at_k {
4359    () => {{}};
4360    ($input:expr) => {{
4361        let input = &$input;
4362        debug_assert!(
4363            input.len() > 0,
4364            "Contract hit_at_k: precondition violated — input.len() > 0"
4365        );
4366    }};
4367}
4368
4369/// Preconditions for equation `mrr`.
4370/// Domain-specific. Call: `contract_pre_mrr!(slice_expr)`
4371macro_rules! contract_pre_mrr {
4372    () => {{}};
4373    ($input:expr) => {{
4374        let input = &$input;
4375        debug_assert!(
4376            input.len() > 0,
4377            "Contract mrr: precondition violated — input.len() > 0"
4378        );
4379    }};
4380}
4381
4382/// Preconditions for equation `ndcg_at_k`.
4383/// Domain-specific. Call: `contract_pre_ndcg_at_k!(slice_expr)`
4384macro_rules! contract_pre_ndcg_at_k {
4385    () => {{}};
4386    ($input:expr) => {{
4387        let input = &$input;
4388        debug_assert!(
4389            input.len() > 0,
4390            "Contract ndcg_at_k: precondition violated — input.len() > 0"
4391        );
4392    }};
4393}
4394
4395/// Preconditions for equation `reciprocal_rank`.
4396/// Domain-specific. Call: `contract_pre_reciprocal_rank!(slice_expr)`
4397macro_rules! contract_pre_reciprocal_rank {
4398    () => {{}};
4399    ($input:expr) => {{
4400        let input = &$input;
4401        debug_assert!(
4402            input.len() > 0,
4403            "Contract reciprocal_rank: precondition violated — input.len() > 0"
4404        );
4405    }};
4406}
4407
4408// Auto-generated from contracts/metrics-regression-v1.yaml — DO NOT EDIT
4409// Contract: metrics-regression-v1
4410
4411/// Preconditions for equation `mae`.
4412/// Domain-specific. Call: `contract_pre_mae!(slice_expr)`
4413macro_rules! contract_pre_mae {
4414    () => {{}};
4415    ($input:expr) => {{
4416        let predicted = &$input;
4417        debug_assert!(
4418            predicted.len() > 0,
4419            "Contract mae: precondition violated — predicted.len() > 0"
4420        );
4421    }};
4422}
4423
4424/// Preconditions for equation `mse`.
4425/// Domain-specific. Call: `contract_pre_mse!(slice_expr)`
4426macro_rules! contract_pre_mse {
4427    () => {{}};
4428    ($input:expr) => {{
4429        let input = &$input;
4430        debug_assert!(
4431            input.len() > 0,
4432            "Contract mse: precondition violated — input.len() > 0"
4433        );
4434        debug_assert!(
4435            input.iter().all(|v| v.is_finite()),
4436            "Contract mse: precondition violated — input.iter().all(|v| v.is_finite())"
4437        );
4438    }};
4439}
4440
4441/// Preconditions for equation `r_squared`.
4442/// Domain-specific. Call: `contract_pre_r_squared!(slice_expr)`
4443macro_rules! contract_pre_r_squared {
4444    () => {{}};
4445    ($input:expr) => {{
4446        let input = &$input;
4447        debug_assert!(
4448            input.len() > 0,
4449            "Contract r_squared: precondition violated — input.len() > 0"
4450        );
4451        debug_assert!(
4452            input.iter().all(|v| v.is_finite()),
4453            "Contract r_squared: precondition violated — input.iter().all(|v| v.is_finite())"
4454        );
4455    }};
4456}
4457
4458/// Preconditions for equation `rmse`.
4459/// Domain-specific. Call: `contract_pre_rmse!(slice_expr)`
4460macro_rules! contract_pre_rmse {
4461    () => {{}};
4462    ($input:expr) => {{
4463        let input = &$input;
4464        debug_assert!(
4465            input.len() > 0,
4466            "Contract rmse: precondition violated — input.len() > 0"
4467        );
4468        debug_assert!(
4469            input.iter().all(|v| v.is_finite()),
4470            "Contract rmse: precondition violated — input.iter().all(|v| v.is_finite())"
4471        );
4472    }};
4473}
4474
4475// Auto-generated from contracts/model-config-algebra-v1.yaml — DO NOT EDIT
4476// Contract: model-config-algebra-v1
4477
4478/// Preconditions for equation `bounds`.
4479/// Domain-specific. Call: `contract_pre_bounds!(slice_expr)`
4480macro_rules! contract_pre_bounds {
4481    () => {{}};
4482    ($input:expr) => {{
4483        let input = &$input;
4484        debug_assert!(
4485            input.len() > 0,
4486            "Contract bounds: precondition violated — input.len() > 0"
4487        );
4488    }};
4489}
4490
4491/// Preconditions for equation `cross_constraint`.
4492/// Domain-specific. Call: `contract_pre_cross_constraint!(slice_expr)`
4493macro_rules! contract_pre_cross_constraint {
4494    () => {{}};
4495    ($input:expr) => {{
4496        let input = &$input;
4497        debug_assert!(
4498            input.len() > 0,
4499            "Contract cross_constraint: precondition violated — input.len() > 0"
4500        );
4501    }};
4502}
4503
4504/// Preconditions for equation `divisibility`.
4505/// Domain-specific. Call: `contract_pre_divisibility!(slice_expr)`
4506macro_rules! contract_pre_divisibility {
4507    () => {{}};
4508    ($input:expr) => {{
4509        let input = &$input;
4510        debug_assert!(
4511            input.len() > 0,
4512            "Contract divisibility: precondition violated — input.len() > 0"
4513        );
4514    }};
4515}
4516
4517/// Preconditions for equation `non_degeneracy`.
4518/// Domain-specific. Call: `contract_pre_non_degeneracy!(slice_expr)`
4519macro_rules! contract_pre_non_degeneracy {
4520    () => {{}};
4521    ($input:expr) => {{
4522        let input = &$input;
4523        debug_assert!(
4524            input.len() > 0,
4525            "Contract non_degeneracy: precondition violated — input.len() > 0"
4526        );
4527    }};
4528}
4529
4530/// Preconditions for equation `ordering`.
4531/// Domain-specific. Call: `contract_pre_ordering!(slice_expr)`
4532macro_rules! contract_pre_ordering {
4533    () => {{}};
4534    ($input:expr) => {{
4535        let input = &$input;
4536        debug_assert!(
4537            input.len() > 0,
4538            "Contract ordering: precondition violated — input.len() > 0"
4539        );
4540    }};
4541}
4542
4543// Auto-generated from contracts/model-metadata-bounds-v1.yaml — DO NOT EDIT
4544// Contract: model-metadata-bounds-v1
4545
4546/// Preconditions for equation `config_bounds_check`.
4547/// Domain-specific. Call: `contract_pre_config_bounds_check!(slice_expr)`
4548macro_rules! contract_pre_config_bounds_check {
4549    () => {{}};
4550    ($input:expr) => {{
4551        let input = &$input;
4552        debug_assert!(
4553            input.len() > 0,
4554            "Contract config_bounds_check: precondition violated — input.len() > 0"
4555        );
4556    }};
4557}
4558
4559// Auto-generated from contracts/mqs-scoring-v1.yaml — DO NOT EDIT
4560// Contract: mqs-scoring-v1
4561
4562/// Preconditions for equation `mqs_composite`.
4563/// Domain-specific. Call: `contract_pre_mqs_composite!(slice_expr)`
4564macro_rules! contract_pre_mqs_composite {
4565    () => {{}};
4566    ($input:expr) => {{
4567        let input = &$input;
4568        debug_assert!(
4569            input.len() > 0,
4570            "Contract mqs_composite: precondition violated — input.len() > 0"
4571        );
4572        debug_assert!(
4573            input.iter().all(|v| v.is_finite()),
4574            "Contract mqs_composite: precondition violated — input.iter().all(|v| v.is_finite())"
4575        );
4576    }};
4577}
4578
4579/// Preconditions for equation `mqs_deterministic`.
4580/// Domain-specific. Call: `contract_pre_mqs_deterministic!(slice_expr)`
4581macro_rules! contract_pre_mqs_deterministic {
4582    () => {{}};
4583    ($input:expr) => {{
4584        let input = &$input;
4585        debug_assert!(input.len() > 0,
4586            "Contract mqs_deterministic: precondition violated — input.len() > 0");
4587        debug_assert!(input.iter().all(|v| v.is_finite()),
4588            "Contract mqs_deterministic: precondition violated — input.iter().all(|v| v.is_finite())");
4589    }};
4590}
4591
4592/// Preconditions for equation `mqs_grade`.
4593/// Domain-specific. Call: `contract_pre_mqs_grade!(slice_expr)`
4594macro_rules! contract_pre_mqs_grade {
4595    () => {{}};
4596    ($input:expr) => {{
4597        let grad_output = &$input;
4598        debug_assert!(grad_output.len() > 0,
4599            "Contract mqs_grade: precondition violated — grad_output.len() > 0");
4600        debug_assert!(grad_output.iter().all(|v| v.is_finite()),
4601            "Contract mqs_grade: precondition violated — grad_output.iter().all(|v| v.is_finite())");
4602    }};
4603}
4604
4605/// Preconditions for equation `mqs_pass_rate`.
4606/// Domain-specific. Call: `contract_pre_mqs_pass_rate!(slice_expr)`
4607macro_rules! contract_pre_mqs_pass_rate {
4608    () => {{}};
4609    ($input:expr) => {{
4610        let input = &$input;
4611        debug_assert!(
4612            input.len() > 0,
4613            "Contract mqs_pass_rate: precondition violated — input.len() > 0"
4614        );
4615        debug_assert!(
4616            input.iter().all(|v| v.is_finite()),
4617            "Contract mqs_pass_rate: precondition violated — input.iter().all(|v| v.is_finite())"
4618        );
4619    }};
4620}
4621
4622// Auto-generated from contracts/naive-bayes-v1.yaml — DO NOT EDIT
4623// Contract: naive-bayes-v1
4624
4625/// Preconditions for equation `class_prior`.
4626/// Domain-specific. Call: `contract_pre_class_prior!(slice_expr)`
4627macro_rules! contract_pre_class_prior {
4628    () => {{}};
4629    ($input:expr) => {{
4630        let input = &$input;
4631        debug_assert!(
4632            input.len() > 0,
4633            "Contract class_prior: precondition violated — input.len() > 0"
4634        );
4635        debug_assert!(
4636            input.iter().all(|v| v.is_finite()),
4637            "Contract class_prior: precondition violated — input.iter().all(|v| v.is_finite())"
4638        );
4639    }};
4640}
4641
4642/// Preconditions for equation `gaussian_likelihood`.
4643/// Domain-specific. Call: `contract_pre_gaussian_likelihood!(slice_expr)`
4644macro_rules! contract_pre_gaussian_likelihood {
4645    () => {{}};
4646    ($input:expr) => {{
4647        let input = &$input;
4648        debug_assert!(input.len() > 0,
4649            "Contract gaussian_likelihood: precondition violated — input.len() > 0");
4650        debug_assert!(input.iter().all(|v| v.is_finite()),
4651            "Contract gaussian_likelihood: precondition violated — input.iter().all(|v| v.is_finite())");
4652    }};
4653}
4654
4655/// Preconditions for equation `log_posterior`.
4656/// Domain-specific. Call: `contract_pre_log_posterior!(slice_expr)`
4657macro_rules! contract_pre_log_posterior {
4658    () => {{}};
4659    ($input:expr) => {{
4660        let input = &$input;
4661        debug_assert!(
4662            input.len() > 0,
4663            "Contract log_posterior: precondition violated — input.len() > 0"
4664        );
4665        debug_assert!(
4666            input.iter().all(|v| v.is_finite()),
4667            "Contract log_posterior: precondition violated — input.iter().all(|v| v.is_finite())"
4668        );
4669    }};
4670}
4671
4672// Auto-generated from contracts/online-softmax-v1.yaml — DO NOT EDIT
4673// Contract: online-softmax-v1
4674
4675/// Preconditions for equation `online_normalizer`.
4676/// Domain-specific. Call: `contract_pre_online_normalizer!(slice_expr)`
4677macro_rules! contract_pre_online_normalizer {
4678    () => {{}};
4679    ($input:expr) => {{
4680        let x = &$input;
4681        debug_assert!(
4682            x.iter().all(|v| v.is_finite()),
4683            "Contract online_normalizer: precondition violated — x.iter().all(|v| v.is_finite())"
4684        );
4685        debug_assert!(
4686            x.len() > 0,
4687            "Contract online_normalizer: precondition violated — x.len() > 0"
4688        );
4689    }};
4690}
4691
4692/// Preconditions for equation `standard_softmax`.
4693/// Domain-specific. Call: `contract_pre_standard_softmax!(slice_expr)`
4694macro_rules! contract_pre_standard_softmax {
4695    () => {{}};
4696    ($input:expr) => {{
4697        let x = &$input;
4698        debug_assert!(
4699            x.iter().all(|v| v.is_finite()),
4700            "Contract standard_softmax: precondition violated — x.iter().all(|v| v.is_finite())"
4701        );
4702        debug_assert!(
4703            x.len() > 0,
4704            "Contract standard_softmax: precondition violated — x.len() > 0"
4705        );
4706    }};
4707}
4708
4709// Auto-generated from contracts/optimization-v1.yaml — DO NOT EDIT
4710// Contract: optimization-v1
4711
4712/// Preconditions for equation `cg_minimize`.
4713/// Domain-specific. Call: `contract_pre_cg_minimize!(slice_expr)`
4714macro_rules! contract_pre_cg_minimize {
4715    () => {{}};
4716    ($input:expr) => {{
4717        let params = &$input;
4718        debug_assert!(
4719            params.len() > 0,
4720            "Contract cg_minimize: precondition violated — params.len() > 0"
4721        );
4722    }};
4723}
4724
4725/// Preconditions for equation `convergence`.
4726/// Domain-specific. Call: `contract_pre_convergence!(slice_expr)`
4727macro_rules! contract_pre_convergence {
4728    () => {{}};
4729    ($input:expr) => {{
4730        let params = &$input;
4731        debug_assert!(
4732            params.len() > 0,
4733            "Contract convergence: precondition violated — params.len() > 0"
4734        );
4735    }};
4736}
4737
4738/// Preconditions for equation `line_search`.
4739/// Domain-specific. Call: `contract_pre_line_search!(slice_expr)`
4740macro_rules! contract_pre_line_search {
4741    () => {{}};
4742    ($input:expr) => {{
4743        let params = &$input;
4744        debug_assert!(
4745            params.len() > 0,
4746            "Contract line_search: precondition violated — params.len() > 0"
4747        );
4748    }};
4749}
4750
4751// Auto-generated from contracts/paged-attention-v1.yaml — DO NOT EDIT
4752// Contract: paged-attention-v1
4753
4754/// Preconditions for equation `block_allocation`.
4755/// Domain-specific. Call: `contract_pre_block_allocation!(slice_expr)`
4756macro_rules! contract_pre_block_allocation {
4757    () => {{}};
4758    ($input:expr) => {{
4759        let q = &$input;
4760        debug_assert!(
4761            q.len() > 0,
4762            "Contract block_allocation: precondition violated — q.len() > 0"
4763        );
4764    }};
4765}
4766
4767/// Preconditions for equation `block_table_lookup`.
4768/// Domain-specific. Call: `contract_pre_block_table_lookup!(slice_expr)`
4769macro_rules! contract_pre_block_table_lookup {
4770    () => {{}};
4771    ($input:expr) => {{
4772        let q = &$input;
4773        debug_assert!(
4774            q.len() > 0,
4775            "Contract block_table_lookup: precondition violated — q.len() > 0"
4776        );
4777    }};
4778}
4779
4780/// Preconditions for equation `copy_on_write`.
4781/// Domain-specific. Call: `contract_pre_copy_on_write!(slice_expr)`
4782macro_rules! contract_pre_copy_on_write {
4783    () => {{}};
4784    ($input:expr) => {{
4785        let q = &$input;
4786        debug_assert!(
4787            q.len() > 0,
4788            "Contract copy_on_write: precondition violated — q.len() > 0"
4789        );
4790    }};
4791}
4792
4793// Auto-generated from contracts/paged-kv-cache-v1.yaml — DO NOT EDIT
4794// Contract: paged-kv-cache-v1
4795
4796/// Preconditions for equation `block_allocation`.
4797/// Domain-specific. Call: `contract_pre_block_allocation!(slice_expr)`
4798macro_rules! contract_pre_block_allocation {
4799    () => {{}};
4800    ($input:expr) => {{
4801        let q = &$input;
4802        debug_assert!(
4803            q.len() > 0,
4804            "Contract block_allocation: precondition violated — q.len() > 0"
4805        );
4806    }};
4807}
4808
4809/// Preconditions for equation `block_table_invariant`.
4810/// Domain-specific. Call: `contract_pre_block_table_invariant!(slice_expr)`
4811macro_rules! contract_pre_block_table_invariant {
4812    () => {{}};
4813    ($input:expr) => {{
4814        let q = &$input;
4815        debug_assert!(
4816            q.len() > 0,
4817            "Contract block_table_invariant: precondition violated — q.len() > 0"
4818        );
4819    }};
4820}
4821
4822/// Preconditions for equation `fragmentation_free`.
4823/// Domain-specific. Call: `contract_pre_fragmentation_free!(slice_expr)`
4824macro_rules! contract_pre_fragmentation_free {
4825    () => {{}};
4826    ($input:expr) => {{
4827        let q = &$input;
4828        debug_assert!(
4829            q.len() > 0,
4830            "Contract fragmentation_free: precondition violated — q.len() > 0"
4831        );
4832    }};
4833}
4834
4835/// Preconditions for equation `graph_compatibility`.
4836/// Call at function entry: `contract_pre_graph_compatibility!(input_expr)`
4837macro_rules! contract_pre_graph_compatibility {
4838    () => {{}};
4839    ($input:expr) => {{
4840        let _contract_input = &$input;
4841    }};
4842}
4843
4844/// Preconditions for equation `paged_contiguous_equivalence`.
4845/// Call at function entry: `contract_pre_paged_contiguous_equivalence!(input_expr)`
4846macro_rules! contract_pre_paged_contiguous_equivalence {
4847    () => {{}};
4848    ($input:expr) => {{
4849        let _contract_input = &$input;
4850    }};
4851}
4852
4853/// Preconditions for equation `slot_mapping`.
4854/// Domain-specific. Call: `contract_pre_slot_mapping!(slice_expr)`
4855macro_rules! contract_pre_slot_mapping {
4856    () => {{}};
4857    ($input:expr) => {{
4858        let q = &$input;
4859        debug_assert!(
4860            q.len() > 0,
4861            "Contract slot_mapping: precondition violated — q.len() > 0"
4862        );
4863    }};
4864}
4865
4866// Auto-generated from contracts/pagerank-kernel-v1.yaml — DO NOT EDIT
4867// Contract: pagerank-kernel-v1
4868
4869/// Preconditions for equation `pagerank`.
4870/// Call at function entry: `contract_pre_pagerank!(input_expr)`
4871macro_rules! contract_pre_pagerank {
4872    () => {{}};
4873    ($input:expr) => {{
4874        let _contract_input = &$input;
4875    }};
4876}
4877
4878/// Preconditions for equation `power_iteration`.
4879/// Call at function entry: `contract_pre_power_iteration!(input_expr)`
4880macro_rules! contract_pre_power_iteration {
4881    () => {{}};
4882    ($input:expr) => {{
4883        let _contract_input = &$input;
4884    }};
4885}
4886
4887// Auto-generated from contracts/parser-soundness-v1.yaml — DO NOT EDIT
4888// Contract: parser-soundness-v1
4889
4890/// Preconditions for equation `lex`.
4891/// Domain-specific. Call: `contract_pre_lex!(slice_expr)`
4892macro_rules! contract_pre_lex {
4893    () => {{}};
4894    ($input:expr) => {{
4895        let input = &$input;
4896        debug_assert!(
4897            input.len() > 0,
4898            "Contract lex: precondition violated — input.len() > 0"
4899        );
4900    }};
4901}
4902
4903/// Preconditions for equation `parse`.
4904/// Domain-specific. Call: `contract_pre_parse!(slice_expr)`
4905macro_rules! contract_pre_parse {
4906    () => {{}};
4907    ($input:expr) => {{
4908        let input = &$input;
4909        debug_assert!(
4910            input.len() > 0,
4911            "Contract parse: precondition violated — input.len() > 0"
4912        );
4913    }};
4914}
4915
4916/// Preconditions for equation `semantic_analyze`.
4917/// Domain-specific. Call: `contract_pre_semantic_analyze!(slice_expr)`
4918macro_rules! contract_pre_semantic_analyze {
4919    () => {{}};
4920    ($input:expr) => {{
4921        let input = &$input;
4922        debug_assert!(
4923            input.len() > 0,
4924            "Contract semantic_analyze: precondition violated — input.len() > 0"
4925        );
4926    }};
4927}
4928
4929// Auto-generated from contracts/pca-v1.yaml — DO NOT EDIT
4930// Contract: pca-v1
4931
4932/// Preconditions for equation `explained_variance`.
4933/// Domain-specific. Call: `contract_pre_explained_variance!(slice_expr)`
4934macro_rules! contract_pre_explained_variance {
4935    () => {{}};
4936    ($input:expr) => {{
4937        let input = &$input;
4938        debug_assert!(input.len() > 0,
4939            "Contract explained_variance: precondition violated — input.len() > 0");
4940        debug_assert!(input.iter().all(|v| v.is_finite()),
4941            "Contract explained_variance: precondition violated — input.iter().all(|v| v.is_finite())");
4942    }};
4943}
4944
4945/// Preconditions for equation `pca_transform`.
4946/// Domain-specific. Call: `contract_pre_pca_transform!(slice_expr)`
4947macro_rules! contract_pre_pca_transform {
4948    () => {{}};
4949    ($input:expr) => {{
4950        let a = &$input;
4951        debug_assert!(
4952            a.len() > 0,
4953            "Contract pca_transform: precondition violated — a.len() > 0"
4954        );
4955    }};
4956}
4957
4958/// Preconditions for equation `reconstruction`.
4959/// Domain-specific. Call: `contract_pre_reconstruction!(slice_expr)`
4960macro_rules! contract_pre_reconstruction {
4961    () => {{}};
4962    ($input:expr) => {{
4963        let a = &$input;
4964        debug_assert!(
4965            a.len() > 0,
4966            "Contract reconstruction: precondition violated — a.len() > 0"
4967        );
4968    }};
4969}
4970
4971// Auto-generated from contracts/performance-grading-v1.yaml — DO NOT EDIT
4972// Contract: performance-grading-v1
4973
4974/// Preconditions for equation `concrete_instance`.
4975/// Domain-specific. Call: `contract_pre_concrete_instance!(slice_expr)`
4976macro_rules! contract_pre_concrete_instance {
4977    () => {{}};
4978    ($input:expr) => {{
4979        let grad_output = &$input;
4980        debug_assert!(grad_output.len() > 0,
4981            "Contract concrete_instance: precondition violated — grad_output.len() > 0");
4982        debug_assert!(grad_output.iter().all(|v| v.is_finite()),
4983            "Contract concrete_instance: precondition violated — grad_output.iter().all(|v| v.is_finite())");
4984    }};
4985}
4986
4987/// Preconditions for equation `efficiency_grade`.
4988/// Domain-specific. Call: `contract_pre_efficiency_grade!(slice_expr)`
4989macro_rules! contract_pre_efficiency_grade {
4990    () => {{}};
4991    ($input:expr) => {{
4992        let grad_output = &$input;
4993        debug_assert!(grad_output.len() > 0,
4994            "Contract efficiency_grade: precondition violated — grad_output.len() > 0");
4995        debug_assert!(grad_output.iter().all(|v| v.is_finite()),
4996            "Contract efficiency_grade: precondition violated — grad_output.iter().all(|v| v.is_finite())");
4997    }};
4998}
4999
5000/// Preconditions for equation `llamacpp_parity`.
5001/// Domain-specific. Call: `contract_pre_llamacpp_parity!(slice_expr)`
5002macro_rules! contract_pre_llamacpp_parity {
5003    () => {{}};
5004    ($input:expr) => {{
5005        let grad_output = &$input;
5006        debug_assert!(grad_output.len() > 0,
5007            "Contract llamacpp_parity: precondition violated — grad_output.len() > 0");
5008        debug_assert!(grad_output.iter().all(|v| v.is_finite()),
5009            "Contract llamacpp_parity: precondition violated — grad_output.iter().all(|v| v.is_finite())");
5010    }};
5011}
5012
5013/// Preconditions for equation `ollama_parity`.
5014/// Domain-specific. Call: `contract_pre_ollama_parity!(slice_expr)`
5015macro_rules! contract_pre_ollama_parity {
5016    () => {{}};
5017    ($input:expr) => {{
5018        let grad_output = &$input;
5019        debug_assert!(grad_output.len() > 0,
5020            "Contract ollama_parity: precondition violated — grad_output.len() > 0");
5021        debug_assert!(grad_output.iter().all(|v| v.is_finite()),
5022            "Contract ollama_parity: precondition violated — grad_output.iter().all(|v| v.is_finite())");
5023    }};
5024}
5025
5026/// Preconditions for equation `vllm_parity`.
5027/// Domain-specific. Call: `contract_pre_vllm_parity!(slice_expr)`
5028macro_rules! contract_pre_vllm_parity {
5029    () => {{}};
5030    ($input:expr) => {{
5031        let grad_output = &$input;
5032        debug_assert!(grad_output.len() > 0,
5033            "Contract vllm_parity: precondition violated — grad_output.len() > 0");
5034        debug_assert!(grad_output.iter().all(|v| v.is_finite()),
5035            "Contract vllm_parity: precondition violated — grad_output.iter().all(|v| v.is_finite())");
5036    }};
5037}
5038
5039// Auto-generated from contracts/pipeline-cache-v1.yaml — DO NOT EDIT
5040// Contract: pipeline-cache-v1
5041
5042/// Preconditions for equation `identity`.
5043/// Call at function entry: `contract_pre_identity!(input_expr)`
5044macro_rules! contract_pre_identity {
5045    () => {{}};
5046    ($input:expr) => {{
5047        let _contract_input = &$input;
5048    }};
5049}
5050
5051// Auto-generated from contracts/preprocessing-normalization-v1.yaml — DO NOT EDIT
5052// Contract: preprocessing-normalization-v1
5053
5054/// Preconditions for equation `minmax_scaler`.
5055/// Domain-specific. Call: `contract_pre_minmax_scaler!(slice_expr)`
5056macro_rules! contract_pre_minmax_scaler {
5057    () => {{}};
5058    ($input:expr) => {{
5059        let input = &$input;
5060        debug_assert!(
5061            input.iter().all(|v| v.is_finite()),
5062            "Contract minmax_scaler: precondition violated — input.iter().all(|v| v.is_finite())"
5063        );
5064        debug_assert!(
5065            input.len() > 0,
5066            "Contract minmax_scaler: precondition violated — input.len() > 0"
5067        );
5068    }};
5069}
5070
5071/// Preconditions for equation `robust_scaler`.
5072/// Domain-specific. Call: `contract_pre_robust_scaler!(slice_expr)`
5073macro_rules! contract_pre_robust_scaler {
5074    () => {{}};
5075    ($input:expr) => {{
5076        let input = &$input;
5077        debug_assert!(
5078            input.iter().all(|v| v.is_finite()),
5079            "Contract robust_scaler: precondition violated — input.iter().all(|v| v.is_finite())"
5080        );
5081        debug_assert!(
5082            input.len() > 0,
5083            "Contract robust_scaler: precondition violated — input.len() > 0"
5084        );
5085    }};
5086}
5087
5088/// Preconditions for equation `standard_scaler`.
5089/// Domain-specific. Call: `contract_pre_standard_scaler!(slice_expr)`
5090macro_rules! contract_pre_standard_scaler {
5091    () => {{}};
5092    ($input:expr) => {{
5093        let input = &$input;
5094        debug_assert!(input.iter().all(|v| v.is_finite()),
5095            "Contract standard_scaler: precondition violated — input.iter().all(|v| v.is_finite())");
5096        debug_assert!(input.len() > 0,
5097            "Contract standard_scaler: precondition violated — input.len() > 0");
5098    }};
5099}
5100
5101// Auto-generated from contracts/ptx-target-parity-v1.yaml — DO NOT EDIT
5102// Contract: ptx-target-parity-v1
5103
5104/// Preconditions for equation `jit_compilation_success`.
5105/// Domain-specific. Call: `contract_pre_jit_compilation_success!(slice_expr)`
5106macro_rules! contract_pre_jit_compilation_success {
5107    () => {{}};
5108    ($input:expr) => {{
5109        let input = &$input;
5110        debug_assert!(input.len() > 0,
5111            "Contract jit_compilation_success: precondition violated — input.len() > 0");
5112        debug_assert!(input.iter().all(|v| v.is_finite()),
5113            "Contract jit_compilation_success: precondition violated — input.iter().all(|v| v.is_finite())");
5114    }};
5115}
5116
5117/// Preconditions for equation `no_hardcoded_targets`.
5118/// Domain-specific. Call: `contract_pre_no_hardcoded_targets!(slice_expr)`
5119macro_rules! contract_pre_no_hardcoded_targets {
5120    () => {{}};
5121    ($input:expr) => {{
5122        let input = &$input;
5123        debug_assert!(input.len() > 0,
5124            "Contract no_hardcoded_targets: precondition violated — input.len() > 0");
5125        debug_assert!(input.iter().all(|v| v.is_finite()),
5126            "Contract no_hardcoded_targets: precondition violated — input.iter().all(|v| v.is_finite())");
5127    }};
5128}
5129
5130/// Preconditions for equation `target_parity`.
5131/// Domain-specific. Call: `contract_pre_target_parity!(slice_expr)`
5132macro_rules! contract_pre_target_parity {
5133    () => {{}};
5134    ($input:expr) => {{
5135        let input = &$input;
5136        debug_assert!(
5137            input.len() > 0,
5138            "Contract target_parity: precondition violated — input.len() > 0"
5139        );
5140        debug_assert!(
5141            input.iter().all(|v| v.is_finite()),
5142            "Contract target_parity: precondition violated — input.iter().all(|v| v.is_finite())"
5143        );
5144    }};
5145}
5146
5147// Auto-generated from contracts/q4k-q6k-superblock-v1.yaml — DO NOT EDIT
5148// Contract: q4k-q6k-superblock-v1
5149
5150/// Preconditions for equation `bsum`.
5151/// Domain-specific. Call: `contract_pre_bsum!(slice_expr)`
5152macro_rules! contract_pre_bsum {
5153    () => {{}};
5154    ($input:expr) => {{
5155        let input = &$input;
5156        debug_assert!(
5157            input.len() > 0,
5158            "Contract bsum: precondition violated — input.len() > 0"
5159        );
5160    }};
5161}
5162
5163/// Preconditions for equation `dequantization`.
5164/// Domain-specific. Call: `contract_pre_dequantization!(slice_expr)`
5165macro_rules! contract_pre_dequantization {
5166    () => {{}};
5167    ($input:expr) => {{
5168        let input = &$input;
5169        debug_assert!(
5170            input.len() > 0,
5171            "Contract dequantization: precondition violated — input.len() > 0"
5172        );
5173    }};
5174}
5175
5176/// Preconditions for equation `q4k_superblock`.
5177/// Domain-specific. Call: `contract_pre_q4k_superblock!(slice_expr)`
5178macro_rules! contract_pre_q4k_superblock {
5179    () => {{}};
5180    ($input:expr) => {{
5181        let input = &$input;
5182        debug_assert!(
5183            input.len() > 0,
5184            "Contract q4k_superblock: precondition violated — input.len() > 0"
5185        );
5186    }};
5187}
5188
5189/// Preconditions for equation `q6k_superblock`.
5190/// Domain-specific. Call: `contract_pre_q6k_superblock!(slice_expr)`
5191macro_rules! contract_pre_q6k_superblock {
5192    () => {{}};
5193    ($input:expr) => {{
5194        let input = &$input;
5195        debug_assert!(
5196            input.len() > 0,
5197            "Contract q6k_superblock: precondition violated — input.len() > 0"
5198        );
5199    }};
5200}
5201
5202/// Preconditions for equation `total_bytes`.
5203/// Domain-specific. Call: `contract_pre_total_bytes!(slice_expr)`
5204macro_rules! contract_pre_total_bytes {
5205    () => {{}};
5206    ($input:expr) => {{
5207        let input = &$input;
5208        debug_assert!(
5209            input.len() > 0,
5210            "Contract total_bytes: precondition violated — input.len() > 0"
5211        );
5212    }};
5213}
5214
5215// Auto-generated from contracts/qk-norm-apr-loader-v1.yaml — DO NOT EDIT
5216// Contract: qk-norm-apr-loader-v1
5217
5218/// Preconditions for equation `qk_norm_load`.
5219/// Domain-specific. Call: `contract_pre_qk_norm_load!(slice_expr)`
5220macro_rules! contract_pre_qk_norm_load {
5221    () => {{}};
5222    ($input:expr) => {{
5223        let input = &$input;
5224        debug_assert!(
5225            input.iter().all(|v| v.is_finite()),
5226            "Contract qk_norm_load: precondition violated — input.iter().all(|v| v.is_finite())"
5227        );
5228        debug_assert!(
5229            input.len() > 0,
5230            "Contract qk_norm_load: precondition violated — input.len() > 0"
5231        );
5232    }};
5233}
5234
5235// Auto-generated from contracts/qk-norm-v1.yaml — DO NOT EDIT
5236// Contract: qk-norm-v1
5237
5238/// Preconditions for equation `qk_rmsnorm`.
5239/// Domain-specific. Call: `contract_pre_qk_rmsnorm!(slice_expr)`
5240macro_rules! contract_pre_qk_rmsnorm {
5241    () => {{}};
5242    ($input:expr) => {{
5243        let input = &$input;
5244        debug_assert!(
5245            input.iter().all(|v| v.is_finite()),
5246            "Contract qk_rmsnorm: precondition violated — input.iter().all(|v| v.is_finite())"
5247        );
5248        debug_assert!(
5249            input.len() > 0,
5250            "Contract qk_rmsnorm: precondition violated — input.len() > 0"
5251        );
5252    }};
5253}
5254
5255// Auto-generated from contracts/qlora-hyperparameters-v1.yaml — DO NOT EDIT
5256// Contract: qlora-hyperparameters-v1
5257
5258/// Preconditions for equation `effective_batch_size`.
5259/// Domain-specific. Call: `contract_pre_effective_batch_size!(slice_expr)`
5260macro_rules! contract_pre_effective_batch_size {
5261    () => {{}};
5262    ($input:expr) => {{
5263        let params = &$input;
5264        debug_assert!(
5265            params.len() > 0,
5266            "Contract effective_batch_size: precondition violated — params.len() > 0"
5267        );
5268    }};
5269}
5270
5271/// Preconditions for equation `epoch_count_imbalanced`.
5272/// Domain-specific. Call: `contract_pre_epoch_count_imbalanced!(slice_expr)`
5273macro_rules! contract_pre_epoch_count_imbalanced {
5274    () => {{}};
5275    ($input:expr) => {{
5276        let params = &$input;
5277        debug_assert!(
5278            params.len() > 0,
5279            "Contract epoch_count_imbalanced: precondition violated — params.len() > 0"
5280        );
5281    }};
5282}
5283
5284/// Preconditions for equation `gradient_clip_bound`.
5285/// Domain-specific. Call: `contract_pre_gradient_clip_bound!(slice_expr)`
5286macro_rules! contract_pre_gradient_clip_bound {
5287    () => {{}};
5288    ($input:expr) => {{
5289        let params = &$input;
5290        debug_assert!(
5291            params.len() > 0,
5292            "Contract gradient_clip_bound: precondition violated — params.len() > 0"
5293        );
5294    }};
5295}
5296
5297/// Preconditions for equation `learning_rate_scaling`.
5298/// Domain-specific. Call: `contract_pre_learning_rate_scaling!(slice_expr)`
5299macro_rules! contract_pre_learning_rate_scaling {
5300    () => {{}};
5301    ($input:expr) => {{
5302        let params = &$input;
5303        debug_assert!(
5304            params.len() > 0,
5305            "Contract learning_rate_scaling: precondition violated — params.len() > 0"
5306        );
5307    }};
5308}
5309
5310/// Preconditions for equation `lora_alpha_ratio`.
5311/// Domain-specific. Call: `contract_pre_lora_alpha_ratio!(slice_expr)`
5312macro_rules! contract_pre_lora_alpha_ratio {
5313    () => {{}};
5314    ($input:expr) => {{
5315        let params = &$input;
5316        debug_assert!(
5317            params.len() > 0,
5318            "Contract lora_alpha_ratio: precondition violated — params.len() > 0"
5319        );
5320    }};
5321}
5322
5323/// Preconditions for equation `seq_len_from_data`.
5324/// Domain-specific. Call: `contract_pre_seq_len_from_data!(slice_expr)`
5325macro_rules! contract_pre_seq_len_from_data {
5326    () => {{}};
5327    ($input:expr) => {{
5328        let params = &$input;
5329        debug_assert!(
5330            params.len() > 0,
5331            "Contract seq_len_from_data: precondition violated — params.len() > 0"
5332        );
5333    }};
5334}
5335
5336/// Preconditions for equation `warmup_fraction`.
5337/// Domain-specific. Call: `contract_pre_warmup_fraction!(slice_expr)`
5338macro_rules! contract_pre_warmup_fraction {
5339    () => {{}};
5340    ($input:expr) => {{
5341        let params = &$input;
5342        debug_assert!(
5343            params.len() > 0,
5344            "Contract warmup_fraction: precondition violated — params.len() > 0"
5345        );
5346    }};
5347}
5348
5349// Auto-generated from contracts/quantization-ordering-v1.yaml — DO NOT EDIT
5350// Contract: quantization-ordering-v1
5351
5352/// Preconditions for equation `alpha_scaling`.
5353/// Domain-specific. Call: `contract_pre_alpha_scaling!(slice_expr)`
5354macro_rules! contract_pre_alpha_scaling {
5355    () => {{}};
5356    ($input:expr) => {{
5357        let input = &$input;
5358        debug_assert!(
5359            input.len() > 0,
5360            "Contract alpha_scaling: precondition violated — input.len() > 0"
5361        );
5362    }};
5363}
5364
5365/// Preconditions for equation `bytes_per_param`.
5366/// Domain-specific. Call: `contract_pre_bytes_per_param!(slice_expr)`
5367macro_rules! contract_pre_bytes_per_param {
5368    () => {{}};
5369    ($input:expr) => {{
5370        let input = &$input;
5371        debug_assert!(
5372            input.len() > 0,
5373            "Contract bytes_per_param: precondition violated — input.len() > 0"
5374        );
5375    }};
5376}
5377
5378/// Preconditions for equation `dropout_expectation`.
5379/// Domain-specific. Call: `contract_pre_dropout_expectation!(slice_expr)`
5380macro_rules! contract_pre_dropout_expectation {
5381    () => {{}};
5382    ($input:expr) => {{
5383        let x = &$input;
5384        debug_assert!(x.iter().all(|v| v.is_finite()),
5385            "Contract dropout_expectation: precondition violated — x.iter().all(|v| v.is_finite())");
5386        debug_assert!(x.len() > 0,
5387            "Contract dropout_expectation: precondition violated — x.len() > 0");
5388    }};
5389}
5390
5391/// Preconditions for equation `size_ordering`.
5392/// Domain-specific. Call: `contract_pre_size_ordering!(slice_expr)`
5393macro_rules! contract_pre_size_ordering {
5394    () => {{}};
5395    ($input:expr) => {{
5396        let input = &$input;
5397        debug_assert!(
5398            input.len() > 0,
5399            "Contract size_ordering: precondition violated — input.len() > 0"
5400        );
5401    }};
5402}
5403
5404// Auto-generated from contracts/quantized-dot-product-v1.yaml — DO NOT EDIT
5405// Contract: quantized-dot-product-v1
5406
5407/// Preconditions for equation `identity`.
5408/// Domain-specific. Call: `contract_pre_identity!(slice_expr)`
5409macro_rules! contract_pre_identity {
5410    () => {{}};
5411    ($input:expr) => {{
5412        let input = &$input;
5413        debug_assert!(
5414            input.len() > 0,
5415            "Contract identity: precondition violated — input.len() > 0"
5416        );
5417    }};
5418}
5419
5420// Auto-generated from contracts/qwen2-e2e-verification-v1.yaml — DO NOT EDIT
5421// Contract: qwen2-e2e-verification-v1
5422
5423/// Preconditions for equation `contract_composition`.
5424/// Domain-specific. Call: `contract_pre_contract_composition!(slice_expr)`
5425macro_rules! contract_pre_contract_composition {
5426    () => {{}};
5427    ($input:expr) => {{
5428        let indices = &$input;
5429        debug_assert!(
5430            indices.len() > 0,
5431            "Contract contract_composition: precondition violated — indices.len() > 0"
5432        );
5433    }};
5434}
5435
5436/// Preconditions for equation `flops_per_token`.
5437/// Domain-specific. Call: `contract_pre_flops_per_token!(slice_expr)`
5438macro_rules! contract_pre_flops_per_token {
5439    () => {{}};
5440    ($input:expr) => {{
5441        let input = &$input;
5442        debug_assert!(
5443            input.len() > 0,
5444            "Contract flops_per_token: precondition violated — input.len() > 0"
5445        );
5446    }};
5447}
5448
5449/// Preconditions for equation `memory_breakdown`.
5450/// Domain-specific. Call: `contract_pre_memory_breakdown!(slice_expr)`
5451macro_rules! contract_pre_memory_breakdown {
5452    () => {{}};
5453    ($input:expr) => {{
5454        let input = &$input;
5455        debug_assert!(
5456            input.len() > 0,
5457            "Contract memory_breakdown: precondition violated — input.len() > 0"
5458        );
5459    }};
5460}
5461
5462/// Preconditions for equation `model_parameter_count`.
5463/// Domain-specific. Call: `contract_pre_model_parameter_count!(slice_expr)`
5464macro_rules! contract_pre_model_parameter_count {
5465    () => {{}};
5466    ($input:expr) => {{
5467        let input = &$input;
5468        debug_assert!(
5469            input.len() > 0,
5470            "Contract model_parameter_count: precondition violated — input.len() > 0"
5471        );
5472    }};
5473}
5474
5475/// Preconditions for equation `throughput_model`.
5476/// Domain-specific. Call: `contract_pre_throughput_model!(slice_expr)`
5477macro_rules! contract_pre_throughput_model {
5478    () => {{}};
5479    ($input:expr) => {{
5480        let input = &$input;
5481        debug_assert!(
5482            input.len() > 0,
5483            "Contract throughput_model: precondition violated — input.len() > 0"
5484        );
5485    }};
5486}
5487
5488/// Preconditions for equation `verification_ladder`.
5489/// Domain-specific. Call: `contract_pre_verification_ladder!(slice_expr)`
5490macro_rules! contract_pre_verification_ladder {
5491    () => {{}};
5492    ($input:expr) => {{
5493        let input = &$input;
5494        debug_assert!(
5495            input.len() > 0,
5496            "Contract verification_ladder: precondition violated — input.len() > 0"
5497        );
5498    }};
5499}
5500
5501// Auto-generated from contracts/qwen2-shapes-v1.yaml — DO NOT EDIT
5502// Contract: qwen2-shapes-v1
5503
5504/// Preconditions for equation `head_dim_consistency`.
5505/// Domain-specific. Call: `contract_pre_head_dim_consistency!(slice_expr)`
5506macro_rules! contract_pre_head_dim_consistency {
5507    () => {{}};
5508    ($input:expr) => {{
5509        let input = &$input;
5510        debug_assert!(
5511            input.len() > 0,
5512            "Contract head_dim_consistency: precondition violated — input.len() > 0"
5513        );
5514    }};
5515}
5516
5517/// Preconditions for equation `kv_projection_shape`.
5518/// Domain-specific. Call: `contract_pre_kv_projection_shape!(slice_expr)`
5519macro_rules! contract_pre_kv_projection_shape {
5520    () => {{}};
5521    ($input:expr) => {{
5522        let input = &$input;
5523        debug_assert!(
5524            input.len() > 0,
5525            "Contract kv_projection_shape: precondition violated — input.len() > 0"
5526        );
5527    }};
5528}
5529
5530/// Preconditions for equation `o_projection_transpose`.
5531/// Domain-specific. Call: `contract_pre_o_projection_transpose!(slice_expr)`
5532macro_rules! contract_pre_o_projection_transpose {
5533    () => {{}};
5534    ($input:expr) => {{
5535        let a = &$input;
5536        debug_assert!(
5537            a.len() > 0,
5538            "Contract o_projection_transpose: precondition violated — a.len() > 0"
5539        );
5540    }};
5541}
5542
5543/// Preconditions for equation `q_projection_shape`.
5544/// Domain-specific. Call: `contract_pre_q_projection_shape!(slice_expr)`
5545macro_rules! contract_pre_q_projection_shape {
5546    () => {{}};
5547    ($input:expr) => {{
5548        let input = &$input;
5549        debug_assert!(
5550            input.len() > 0,
5551            "Contract q_projection_shape: precondition violated — input.len() > 0"
5552        );
5553    }};
5554}
5555
5556/// Preconditions for equation `rope_frequency`.
5557/// Domain-specific. Call: `contract_pre_rope_frequency!(slice_expr)`
5558macro_rules! contract_pre_rope_frequency {
5559    () => {{}};
5560    ($input:expr) => {{
5561        let indices = &$input;
5562        debug_assert!(
5563            indices.len() > 0,
5564            "Contract rope_frequency: precondition violated — indices.len() > 0"
5565        );
5566    }};
5567}
5568
5569/// Preconditions for equation `swiglu_ratio`.
5570/// Domain-specific. Call: `contract_pre_swiglu_ratio!(slice_expr)`
5571macro_rules! contract_pre_swiglu_ratio {
5572    () => {{}};
5573    ($input:expr) => {{
5574        let input = &$input;
5575        debug_assert!(
5576            input.len() > 0,
5577            "Contract swiglu_ratio: precondition violated — input.len() > 0"
5578        );
5579    }};
5580}
5581
5582// Auto-generated from contracts/qwen2-weight-loading-v1.yaml — DO NOT EDIT
5583// Contract: qwen2-weight-loading-v1
5584
5585/// Preconditions for equation `kv_projection`.
5586/// Call at function entry: `contract_pre_kv_projection!(input_expr)`
5587macro_rules! contract_pre_kv_projection {
5588    () => {{}};
5589    ($input:expr) => {{
5590        let _contract_input = &$input;
5591    }};
5592}
5593
5594/// Preconditions for equation `q_projection`.
5595/// Call at function entry: `contract_pre_q_projection!(input_expr)`
5596macro_rules! contract_pre_q_projection {
5597    () => {{}};
5598    ($input:expr) => {{
5599        let _contract_input = &$input;
5600    }};
5601}
5602
5603/// Preconditions for equation `swiglu_expansion`.
5604/// Call at function entry: `contract_pre_swiglu_expansion!(input_expr)`
5605macro_rules! contract_pre_swiglu_expansion {
5606    () => {{}};
5607    ($input:expr) => {{
5608        let _contract_input = &$input;
5609    }};
5610}
5611
5612/// Preconditions for equation `total_parameters`.
5613/// Call at function entry: `contract_pre_total_parameters!(input_expr)`
5614macro_rules! contract_pre_total_parameters {
5615    () => {{}};
5616    ($input:expr) => {{
5617        let _contract_input = &$input;
5618    }};
5619}
5620
5621// Auto-generated from contracts/qwen3-e2e-verification-v1.yaml — DO NOT EDIT
5622// Contract: qwen3-e2e-verification-v1
5623
5624/// Preconditions for equation `contract_composition`.
5625/// Domain-specific. Call: `contract_pre_contract_composition!(slice_expr)`
5626macro_rules! contract_pre_contract_composition {
5627    () => {{}};
5628    ($input:expr) => {{
5629        let indices = &$input;
5630        debug_assert!(
5631            indices.len() > 0,
5632            "Contract contract_composition: precondition violated — indices.len() > 0"
5633        );
5634    }};
5635}
5636
5637/// Preconditions for equation `flops_per_token`.
5638/// Domain-specific. Call: `contract_pre_flops_per_token!(slice_expr)`
5639macro_rules! contract_pre_flops_per_token {
5640    () => {{}};
5641    ($input:expr) => {{
5642        let input = &$input;
5643        debug_assert!(
5644            input.len() > 0,
5645            "Contract flops_per_token: precondition violated — input.len() > 0"
5646        );
5647    }};
5648}
5649
5650/// Preconditions for equation `memory_breakdown`.
5651/// Domain-specific. Call: `contract_pre_memory_breakdown!(slice_expr)`
5652macro_rules! contract_pre_memory_breakdown {
5653    () => {{}};
5654    ($input:expr) => {{
5655        let input = &$input;
5656        debug_assert!(
5657            input.len() > 0,
5658            "Contract memory_breakdown: precondition violated — input.len() > 0"
5659        );
5660    }};
5661}
5662
5663/// Preconditions for equation `model_parameter_count`.
5664/// Domain-specific. Call: `contract_pre_model_parameter_count!(slice_expr)`
5665macro_rules! contract_pre_model_parameter_count {
5666    () => {{}};
5667    ($input:expr) => {{
5668        let input = &$input;
5669        debug_assert!(
5670            input.len() > 0,
5671            "Contract model_parameter_count: precondition violated — input.len() > 0"
5672        );
5673    }};
5674}
5675
5676/// Preconditions for equation `throughput_model`.
5677/// Domain-specific. Call: `contract_pre_throughput_model!(slice_expr)`
5678macro_rules! contract_pre_throughput_model {
5679    () => {{}};
5680    ($input:expr) => {{
5681        let input = &$input;
5682        debug_assert!(
5683            input.len() > 0,
5684            "Contract throughput_model: precondition violated — input.len() > 0"
5685        );
5686    }};
5687}
5688
5689/// Preconditions for equation `verification_ladder`.
5690/// Domain-specific. Call: `contract_pre_verification_ladder!(slice_expr)`
5691macro_rules! contract_pre_verification_ladder {
5692    () => {{}};
5693    ($input:expr) => {{
5694        let input = &$input;
5695        debug_assert!(
5696            input.len() > 0,
5697            "Contract verification_ladder: precondition violated — input.len() > 0"
5698        );
5699    }};
5700}
5701
5702// Auto-generated from contracts/qwen3-shapes-v1.yaml — DO NOT EDIT
5703// Contract: qwen3-shapes-v1
5704
5705/// Preconditions for equation `head_dim_consistency`.
5706/// Domain-specific. Call: `contract_pre_head_dim_consistency!(slice_expr)`
5707macro_rules! contract_pre_head_dim_consistency {
5708    () => {{}};
5709    ($input:expr) => {{
5710        let input = &$input;
5711        debug_assert!(
5712            input.len() > 0,
5713            "Contract head_dim_consistency: precondition violated — input.len() > 0"
5714        );
5715    }};
5716}
5717
5718/// Preconditions for equation `kv_projection_shape`.
5719/// Domain-specific. Call: `contract_pre_kv_projection_shape!(slice_expr)`
5720macro_rules! contract_pre_kv_projection_shape {
5721    () => {{}};
5722    ($input:expr) => {{
5723        let input = &$input;
5724        debug_assert!(
5725            input.len() > 0,
5726            "Contract kv_projection_shape: precondition violated — input.len() > 0"
5727        );
5728    }};
5729}
5730
5731/// Preconditions for equation `o_projection_transpose`.
5732/// Domain-specific. Call: `contract_pre_o_projection_transpose!(slice_expr)`
5733macro_rules! contract_pre_o_projection_transpose {
5734    () => {{}};
5735    ($input:expr) => {{
5736        let a = &$input;
5737        debug_assert!(
5738            a.len() > 0,
5739            "Contract o_projection_transpose: precondition violated — a.len() > 0"
5740        );
5741    }};
5742}
5743
5744/// Preconditions for equation `q_projection_shape`.
5745/// Domain-specific. Call: `contract_pre_q_projection_shape!(slice_expr)`
5746macro_rules! contract_pre_q_projection_shape {
5747    () => {{}};
5748    ($input:expr) => {{
5749        let input = &$input;
5750        debug_assert!(
5751            input.len() > 0,
5752            "Contract q_projection_shape: precondition violated — input.len() > 0"
5753        );
5754    }};
5755}
5756
5757/// Preconditions for equation `rope_frequency`.
5758/// Domain-specific. Call: `contract_pre_rope_frequency!(slice_expr)`
5759macro_rules! contract_pre_rope_frequency {
5760    () => {{}};
5761    ($input:expr) => {{
5762        let indices = &$input;
5763        debug_assert!(
5764            indices.len() > 0,
5765            "Contract rope_frequency: precondition violated — indices.len() > 0"
5766        );
5767    }};
5768}
5769
5770/// Preconditions for equation `swiglu_ratio`.
5771/// Domain-specific. Call: `contract_pre_swiglu_ratio!(slice_expr)`
5772macro_rules! contract_pre_swiglu_ratio {
5773    () => {{}};
5774    ($input:expr) => {{
5775        let input = &$input;
5776        debug_assert!(
5777            input.len() > 0,
5778            "Contract swiglu_ratio: precondition violated — input.len() > 0"
5779        );
5780    }};
5781}
5782
5783// Auto-generated from contracts/qwen35-e2e-verification-v1.yaml — DO NOT EDIT
5784// Contract: qwen35-e2e-verification-v1
5785
5786/// Preconditions for equation `contract_composition`.
5787/// Domain-specific. Call: `contract_pre_contract_composition!(slice_expr)`
5788macro_rules! contract_pre_contract_composition {
5789    () => {{}};
5790    ($input:expr) => {{
5791        let indices = &$input;
5792        debug_assert!(
5793            indices.len() > 0,
5794            "Contract contract_composition: precondition violated — indices.len() > 0"
5795        );
5796    }};
5797}
5798
5799/// Preconditions for equation `flops_per_token`.
5800/// Domain-specific. Call: `contract_pre_flops_per_token!(slice_expr)`
5801macro_rules! contract_pre_flops_per_token {
5802    () => {{}};
5803    ($input:expr) => {{
5804        let input = &$input;
5805        debug_assert!(
5806            input.len() > 0,
5807            "Contract flops_per_token: precondition violated — input.len() > 0"
5808        );
5809    }};
5810}
5811
5812/// Preconditions for equation `memory_breakdown`.
5813/// Domain-specific. Call: `contract_pre_memory_breakdown!(slice_expr)`
5814macro_rules! contract_pre_memory_breakdown {
5815    () => {{}};
5816    ($input:expr) => {{
5817        let input = &$input;
5818        debug_assert!(
5819            input.len() > 0,
5820            "Contract memory_breakdown: precondition violated — input.len() > 0"
5821        );
5822    }};
5823}
5824
5825/// Preconditions for equation `model_parameter_count`.
5826/// Domain-specific. Call: `contract_pre_model_parameter_count!(slice_expr)`
5827macro_rules! contract_pre_model_parameter_count {
5828    () => {{}};
5829    ($input:expr) => {{
5830        let input = &$input;
5831        debug_assert!(
5832            input.len() > 0,
5833            "Contract model_parameter_count: precondition violated — input.len() > 0"
5834        );
5835    }};
5836}
5837
5838/// Preconditions for equation `throughput_model`.
5839/// Domain-specific. Call: `contract_pre_throughput_model!(slice_expr)`
5840macro_rules! contract_pre_throughput_model {
5841    () => {{}};
5842    ($input:expr) => {{
5843        let input = &$input;
5844        debug_assert!(
5845            input.len() > 0,
5846            "Contract throughput_model: precondition violated — input.len() > 0"
5847        );
5848    }};
5849}
5850
5851/// Preconditions for equation `verification_ladder`.
5852/// Domain-specific. Call: `contract_pre_verification_ladder!(slice_expr)`
5853macro_rules! contract_pre_verification_ladder {
5854    () => {{}};
5855    ($input:expr) => {{
5856        let input = &$input;
5857        debug_assert!(
5858            input.len() > 0,
5859            "Contract verification_ladder: precondition violated — input.len() > 0"
5860        );
5861    }};
5862}
5863
5864// Auto-generated from contracts/qwen35-hybrid-forward-v1.yaml — DO NOT EDIT
5865// Contract: qwen35-hybrid-forward-v1
5866
5867/// Preconditions for equation `activation_magnitude`.
5868/// Domain-specific. Call: `contract_pre_activation_magnitude!(slice_expr)`
5869macro_rules! contract_pre_activation_magnitude {
5870    () => {{}};
5871    ($input:expr) => {{
5872        let x = &$input;
5873        debug_assert!(x.iter().all(|v| v.is_finite()),
5874            "Contract activation_magnitude: precondition violated — x.iter().all(|v| v.is_finite())");
5875        debug_assert!(x.len() > 0,
5876            "Contract activation_magnitude: precondition violated — x.len() > 0");
5877    }};
5878}
5879
5880/// Preconditions for equation `attention_sublayer`.
5881/// Domain-specific. Call: `contract_pre_attention_sublayer!(slice_expr)`
5882macro_rules! contract_pre_attention_sublayer {
5883    () => {{}};
5884    ($input:expr) => {{
5885        let q = &$input;
5886        debug_assert!(
5887            q.len() > 0,
5888            "Contract attention_sublayer: precondition violated — q.len() > 0"
5889        );
5890    }};
5891}
5892
5893/// Preconditions for equation `ffn_sublayer`.
5894/// Domain-specific. Call: `contract_pre_ffn_sublayer!(slice_expr)`
5895macro_rules! contract_pre_ffn_sublayer {
5896    () => {{}};
5897    ($input:expr) => {{
5898        let input = &$input;
5899        debug_assert!(
5900            input.len() > 0,
5901            "Contract ffn_sublayer: precondition violated — input.len() > 0"
5902        );
5903    }};
5904}
5905
5906/// Preconditions for equation `gdn_sublayer`.
5907/// Domain-specific. Call: `contract_pre_gdn_sublayer!(slice_expr)`
5908macro_rules! contract_pre_gdn_sublayer {
5909    () => {{}};
5910    ($input:expr) => {{
5911        let input = &$input;
5912        debug_assert!(
5913            input.len() > 0,
5914            "Contract gdn_sublayer: precondition violated — input.len() > 0"
5915        );
5916    }};
5917}
5918
5919/// Preconditions for equation `gradient_flow`.
5920/// Domain-specific. Call: `contract_pre_gradient_flow!(slice_expr)`
5921macro_rules! contract_pre_gradient_flow {
5922    () => {{}};
5923    ($input:expr) => {{
5924        let grad_output = &$input;
5925        debug_assert!(grad_output.len() > 0,
5926            "Contract gradient_flow: precondition violated — grad_output.len() > 0");
5927        debug_assert!(grad_output.iter().all(|v| v.is_finite()),
5928            "Contract gradient_flow: precondition violated — grad_output.iter().all(|v| v.is_finite())");
5929    }};
5930}
5931
5932/// Preconditions for equation `hybrid_block`.
5933/// Domain-specific. Call: `contract_pre_hybrid_block!(slice_expr)`
5934macro_rules! contract_pre_hybrid_block {
5935    () => {{}};
5936    ($input:expr) => {{
5937        let input = &$input;
5938        debug_assert!(
5939            input.len() > 0,
5940            "Contract hybrid_block: precondition violated — input.len() > 0"
5941        );
5942    }};
5943}
5944
5945// Auto-generated from contracts/qwen35-shapes-v1.yaml — DO NOT EDIT
5946// Contract: qwen35-shapes-v1
5947
5948/// Preconditions for equation `kv_projection_shape`.
5949/// Domain-specific. Call: `contract_pre_kv_projection_shape!(slice_expr)`
5950macro_rules! contract_pre_kv_projection_shape {
5951    () => {{}};
5952    ($input:expr) => {{
5953        let input = &$input;
5954        debug_assert!(
5955            input.len() > 0,
5956            "Contract kv_projection_shape: precondition violated — input.len() > 0"
5957        );
5958    }};
5959}
5960
5961/// Preconditions for equation `o_projection_transpose`.
5962/// Domain-specific. Call: `contract_pre_o_projection_transpose!(slice_expr)`
5963macro_rules! contract_pre_o_projection_transpose {
5964    () => {{}};
5965    ($input:expr) => {{
5966        let a = &$input;
5967        debug_assert!(
5968            a.len() > 0,
5969            "Contract o_projection_transpose: precondition violated — a.len() > 0"
5970        );
5971    }};
5972}
5973
5974/// Preconditions for equation `q_projection_shape`.
5975/// Domain-specific. Call: `contract_pre_q_projection_shape!(slice_expr)`
5976macro_rules! contract_pre_q_projection_shape {
5977    () => {{}};
5978    ($input:expr) => {{
5979        let input = &$input;
5980        debug_assert!(
5981            input.len() > 0,
5982            "Contract q_projection_shape: precondition violated — input.len() > 0"
5983        );
5984    }};
5985}
5986
5987/// Preconditions for equation `rope_frequency`.
5988/// Domain-specific. Call: `contract_pre_rope_frequency!(slice_expr)`
5989macro_rules! contract_pre_rope_frequency {
5990    () => {{}};
5991    ($input:expr) => {{
5992        let indices = &$input;
5993        debug_assert!(
5994            indices.len() > 0,
5995            "Contract rope_frequency: precondition violated — indices.len() > 0"
5996        );
5997    }};
5998}
5999
6000/// Preconditions for equation `swiglu_ratio`.
6001/// Domain-specific. Call: `contract_pre_swiglu_ratio!(slice_expr)`
6002macro_rules! contract_pre_swiglu_ratio {
6003    () => {{}};
6004    ($input:expr) => {{
6005        let input = &$input;
6006        debug_assert!(
6007            input.len() > 0,
6008            "Contract swiglu_ratio: precondition violated — input.len() > 0"
6009        );
6010    }};
6011}
6012
6013// Auto-generated from contracts/qwen3moe-e2e-verification-v1.yaml — DO NOT EDIT
6014// Contract: qwen3moe-e2e-verification-v1
6015
6016/// Preconditions for equation `active_parameter_count`.
6017/// Domain-specific. Call: `contract_pre_active_parameter_count!(slice_expr)`
6018macro_rules! contract_pre_active_parameter_count {
6019    () => {{}};
6020    ($input:expr) => {{
6021        let input = &$input;
6022        debug_assert!(
6023            input.len() > 0,
6024            "Contract active_parameter_count: precondition violated — input.len() > 0"
6025        );
6026    }};
6027}
6028
6029/// Preconditions for equation `contract_composition`.
6030/// Domain-specific. Call: `contract_pre_contract_composition!(slice_expr)`
6031macro_rules! contract_pre_contract_composition {
6032    () => {{}};
6033    ($input:expr) => {{
6034        let indices = &$input;
6035        debug_assert!(
6036            indices.len() > 0,
6037            "Contract contract_composition: precondition violated — indices.len() > 0"
6038        );
6039    }};
6040}
6041
6042/// Preconditions for equation `flops_per_token`.
6043/// Domain-specific. Call: `contract_pre_flops_per_token!(slice_expr)`
6044macro_rules! contract_pre_flops_per_token {
6045    () => {{}};
6046    ($input:expr) => {{
6047        let input = &$input;
6048        debug_assert!(
6049            input.len() > 0,
6050            "Contract flops_per_token: precondition violated — input.len() > 0"
6051        );
6052    }};
6053}
6054
6055/// Preconditions for equation `memory_breakdown`.
6056/// Domain-specific. Call: `contract_pre_memory_breakdown!(slice_expr)`
6057macro_rules! contract_pre_memory_breakdown {
6058    () => {{}};
6059    ($input:expr) => {{
6060        let input = &$input;
6061        debug_assert!(
6062            input.len() > 0,
6063            "Contract memory_breakdown: precondition violated — input.len() > 0"
6064        );
6065    }};
6066}
6067
6068/// Preconditions for equation `model_parameter_count`.
6069/// Domain-specific. Call: `contract_pre_model_parameter_count!(slice_expr)`
6070macro_rules! contract_pre_model_parameter_count {
6071    () => {{}};
6072    ($input:expr) => {{
6073        let input = &$input;
6074        debug_assert!(
6075            input.len() > 0,
6076            "Contract model_parameter_count: precondition violated — input.len() > 0"
6077        );
6078    }};
6079}
6080
6081/// Preconditions for equation `throughput_model`.
6082/// Domain-specific. Call: `contract_pre_throughput_model!(slice_expr)`
6083macro_rules! contract_pre_throughput_model {
6084    () => {{}};
6085    ($input:expr) => {{
6086        let input = &$input;
6087        debug_assert!(
6088            input.len() > 0,
6089            "Contract throughput_model: precondition violated — input.len() > 0"
6090        );
6091    }};
6092}
6093
6094/// Preconditions for equation `verification_ladder`.
6095/// Domain-specific. Call: `contract_pre_verification_ladder!(slice_expr)`
6096macro_rules! contract_pre_verification_ladder {
6097    () => {{}};
6098    ($input:expr) => {{
6099        let input = &$input;
6100        debug_assert!(
6101            input.len() > 0,
6102            "Contract verification_ladder: precondition violated — input.len() > 0"
6103        );
6104    }};
6105}
6106
6107// Auto-generated from contracts/qwen3moe-shapes-v1.yaml — DO NOT EDIT
6108// Contract: qwen3moe-shapes-v1
6109
6110/// Preconditions for equation `kv_projection_shape`.
6111/// Domain-specific. Call: `contract_pre_kv_projection_shape!(slice_expr)`
6112macro_rules! contract_pre_kv_projection_shape {
6113    () => {{}};
6114    ($input:expr) => {{
6115        let input = &$input;
6116        debug_assert!(
6117            input.len() > 0,
6118            "Contract kv_projection_shape: precondition violated — input.len() > 0"
6119        );
6120    }};
6121}
6122
6123/// Preconditions for equation `moe_expert_shape`.
6124/// Domain-specific. Call: `contract_pre_moe_expert_shape!(slice_expr)`
6125macro_rules! contract_pre_moe_expert_shape {
6126    () => {{}};
6127    ($input:expr) => {{
6128        let input = &$input;
6129        debug_assert!(
6130            input.len() > 0,
6131            "Contract moe_expert_shape: precondition violated — input.len() > 0"
6132        );
6133    }};
6134}
6135
6136/// Preconditions for equation `moe_router_shape`.
6137/// Domain-specific. Call: `contract_pre_moe_router_shape!(slice_expr)`
6138macro_rules! contract_pre_moe_router_shape {
6139    () => {{}};
6140    ($input:expr) => {{
6141        let a = &$input;
6142        debug_assert!(
6143            a.len() > 0,
6144            "Contract moe_router_shape: precondition violated — a.len() > 0"
6145        );
6146    }};
6147}
6148
6149/// Preconditions for equation `o_projection_transpose`.
6150/// Domain-specific. Call: `contract_pre_o_projection_transpose!(slice_expr)`
6151macro_rules! contract_pre_o_projection_transpose {
6152    () => {{}};
6153    ($input:expr) => {{
6154        let a = &$input;
6155        debug_assert!(
6156            a.len() > 0,
6157            "Contract o_projection_transpose: precondition violated — a.len() > 0"
6158        );
6159    }};
6160}
6161
6162/// Preconditions for equation `q_projection_shape`.
6163/// Domain-specific. Call: `contract_pre_q_projection_shape!(slice_expr)`
6164macro_rules! contract_pre_q_projection_shape {
6165    () => {{}};
6166    ($input:expr) => {{
6167        let input = &$input;
6168        debug_assert!(
6169            input.len() > 0,
6170            "Contract q_projection_shape: precondition violated — input.len() > 0"
6171        );
6172    }};
6173}
6174
6175/// Preconditions for equation `rope_frequency`.
6176/// Domain-specific. Call: `contract_pre_rope_frequency!(slice_expr)`
6177macro_rules! contract_pre_rope_frequency {
6178    () => {{}};
6179    ($input:expr) => {{
6180        let indices = &$input;
6181        debug_assert!(
6182            indices.len() > 0,
6183            "Contract rope_frequency: precondition violated — indices.len() > 0"
6184        );
6185    }};
6186}
6187
6188/// Preconditions for equation `swiglu_ratio`.
6189/// Domain-specific. Call: `contract_pre_swiglu_ratio!(slice_expr)`
6190macro_rules! contract_pre_swiglu_ratio {
6191    () => {{}};
6192    ($input:expr) => {{
6193        let input = &$input;
6194        debug_assert!(
6195            input.len() > 0,
6196            "Contract swiglu_ratio: precondition violated — input.len() > 0"
6197        );
6198    }};
6199}
6200
6201// Auto-generated from contracts/random-forest-v1.yaml — DO NOT EDIT
6202// Contract: random-forest-v1
6203
6204/// Preconditions for equation `bootstrap_sample`.
6205/// Domain-specific. Call: `contract_pre_bootstrap_sample!(slice_expr)`
6206macro_rules! contract_pre_bootstrap_sample {
6207    () => {{}};
6208    ($input:expr) => {{
6209        let params = &$input;
6210        debug_assert!(
6211            params.len() > 0,
6212            "Contract bootstrap_sample: precondition violated — params.len() > 0"
6213        );
6214    }};
6215}
6216
6217/// Preconditions for equation `ensemble_size`.
6218/// Domain-specific. Call: `contract_pre_ensemble_size!(slice_expr)`
6219macro_rules! contract_pre_ensemble_size {
6220    () => {{}};
6221    ($input:expr) => {{
6222        let input = &$input;
6223        debug_assert!(
6224            input.len() > 0,
6225            "Contract ensemble_size: precondition violated — input.len() > 0"
6226        );
6227        debug_assert!(
6228            input.iter().all(|v| v.is_finite()),
6229            "Contract ensemble_size: precondition violated — input.iter().all(|v| v.is_finite())"
6230        );
6231    }};
6232}
6233
6234/// Preconditions for equation `majority_vote`.
6235/// Domain-specific. Call: `contract_pre_majority_vote!(slice_expr)`
6236macro_rules! contract_pre_majority_vote {
6237    () => {{}};
6238    ($input:expr) => {{
6239        let input = &$input;
6240        debug_assert!(
6241            input.len() > 0,
6242            "Contract majority_vote: precondition violated — input.len() > 0"
6243        );
6244        debug_assert!(
6245            input.iter().all(|v| v.is_finite()),
6246            "Contract majority_vote: precondition violated — input.iter().all(|v| v.is_finite())"
6247        );
6248    }};
6249}
6250
6251/// Preconditions for equation `predict`.
6252/// Domain-specific. Call: `contract_pre_predict!(slice_expr)`
6253macro_rules! contract_pre_predict {
6254    () => {{}};
6255    ($input:expr) => {{
6256        let input = &$input;
6257        debug_assert!(
6258            input.len() > 0,
6259            "Contract predict: precondition violated — input.len() > 0"
6260        );
6261        debug_assert!(
6262            input.iter().all(|v| v.is_finite()),
6263            "Contract predict: precondition violated — input.iter().all(|v| v.is_finite())"
6264        );
6265    }};
6266}
6267
6268// Auto-generated from contracts/recipe-determinism-v1.yaml — DO NOT EDIT
6269// Contract: recipe-determinism-v1
6270
6271/// Preconditions for equation `expand_recipe`.
6272/// Call at function entry: `contract_pre_expand_recipe!(input_expr)`
6273macro_rules! contract_pre_expand_recipe {
6274    () => {{}};
6275    ($input:expr) => {{
6276        let _contract_input = &$input;
6277    }};
6278}
6279
6280/// Preconditions for equation `validate_input_type`.
6281/// Call at function entry: `contract_pre_validate_input_type!(input_expr)`
6282macro_rules! contract_pre_validate_input_type {
6283    () => {{}};
6284    ($input:expr) => {{
6285        let _contract_input = &$input;
6286    }};
6287}
6288
6289/// Preconditions for equation `validate_inputs`.
6290/// Domain-specific. Call: `contract_pre_validate_inputs!(slice_expr)`
6291macro_rules! contract_pre_validate_inputs {
6292    () => {{}};
6293    ($input:expr) => {{
6294        let inputs = &$input;
6295        debug_assert!(
6296            inputs.len() > 0,
6297            "Contract validate_inputs: precondition violated — inputs.len() > 0"
6298        );
6299    }};
6300}
6301
6302// Auto-generated from contracts/rmsnorm-kernel-v1.yaml — DO NOT EDIT
6303// Contract: rmsnorm-kernel-v1
6304
6305/// Preconditions for equation `rmsnorm`.
6306/// Domain-specific. Call: `contract_pre_rmsnorm!(slice_expr)`
6307macro_rules! contract_pre_rmsnorm {
6308    () => {{}};
6309    ($input:expr) => {{
6310        let x = &$input;
6311        debug_assert!(
6312            x.len() > 0,
6313            "Contract rmsnorm: precondition violated — x.len() > 0"
6314        );
6315        debug_assert!(
6316            x.iter().all(|v| v.is_finite()),
6317            "Contract rmsnorm: precondition violated — x.iter().all(|v| v.is_finite())"
6318        );
6319    }};
6320}
6321
6322/// Postconditions for equation `rmsnorm`.
6323/// Call before return: `contract_post_rmsnorm!(result_expr)`
6324macro_rules! contract_post_rmsnorm {
6325    ($result:expr) => {{
6326        let _contract_result = &$result;
6327        debug_assert!(
6328            _contract_result.iter().all(|v| v.is_finite()),
6329            "Contract rmsnorm: postcondition violated — result.iter().all(|v| v.is_finite())"
6330        );
6331    }};
6332}
6333
6334/// Combined pre+post contract for equation `rmsnorm`.
6335macro_rules! contract_rmsnorm {
6336    ($input:expr, $body:expr) => {{
6337        contract_pre_rmsnorm!($input);
6338        let _contract_result = $body;
6339        contract_post_rmsnorm!(_contract_result);
6340        _contract_result
6341    }};
6342}
6343
6344// Auto-generated from contracts/roofline-model-v1.yaml — DO NOT EDIT
6345// Contract: roofline-model-v1
6346
6347/// Preconditions for equation `bandwidth_ceiling`.
6348/// Domain-specific. Call: `contract_pre_bandwidth_ceiling!(slice_expr)`
6349macro_rules! contract_pre_bandwidth_ceiling {
6350    () => {{}};
6351    ($input:expr) => {{
6352        let input = &$input;
6353        debug_assert!(
6354            input.len() > 0,
6355            "Contract bandwidth_ceiling: precondition violated — input.len() > 0"
6356        );
6357    }};
6358}
6359
6360/// Preconditions for equation `compute_ceiling`.
6361/// Domain-specific. Call: `contract_pre_compute_ceiling!(slice_expr)`
6362macro_rules! contract_pre_compute_ceiling {
6363    () => {{}};
6364    ($input:expr) => {{
6365        let input = &$input;
6366        debug_assert!(
6367            input.len() > 0,
6368            "Contract compute_ceiling: precondition violated — input.len() > 0"
6369        );
6370    }};
6371}
6372
6373/// Preconditions for equation `model_bytes`.
6374/// Domain-specific. Call: `contract_pre_model_bytes!(slice_expr)`
6375macro_rules! contract_pre_model_bytes {
6376    () => {{}};
6377    ($input:expr) => {{
6378        let input = &$input;
6379        debug_assert!(
6380            input.len() > 0,
6381            "Contract model_bytes: precondition violated — input.len() > 0"
6382        );
6383    }};
6384}
6385
6386/// Preconditions for equation `throughput_bound`.
6387/// Domain-specific. Call: `contract_pre_throughput_bound!(slice_expr)`
6388macro_rules! contract_pre_throughput_bound {
6389    () => {{}};
6390    ($input:expr) => {{
6391        let input = &$input;
6392        debug_assert!(
6393            input.len() > 0,
6394            "Contract throughput_bound: precondition violated — input.len() > 0"
6395        );
6396    }};
6397}
6398
6399// Auto-generated from contracts/rope-extrapolation-v1.yaml — DO NOT EDIT
6400// Contract: rope-extrapolation-v1
6401
6402/// Preconditions for equation `base_frequency`.
6403/// Domain-specific. Call: `contract_pre_base_frequency!(slice_expr)`
6404macro_rules! contract_pre_base_frequency {
6405    () => {{}};
6406    ($input:expr) => {{
6407        let indices = &$input;
6408        debug_assert!(
6409            indices.len() > 0,
6410            "Contract base_frequency: precondition violated — indices.len() > 0"
6411        );
6412    }};
6413}
6414
6415/// Preconditions for equation `linear_interpolation`.
6416/// Domain-specific. Call: `contract_pre_linear_interpolation!(slice_expr)`
6417macro_rules! contract_pre_linear_interpolation {
6418    () => {{}};
6419    ($input:expr) => {{
6420        let indices = &$input;
6421        debug_assert!(
6422            indices.len() > 0,
6423            "Contract linear_interpolation: precondition violated — indices.len() > 0"
6424        );
6425    }};
6426}
6427
6428/// Preconditions for equation `ntk_scaled_base`.
6429/// Domain-specific. Call: `contract_pre_ntk_scaled_base!(slice_expr)`
6430macro_rules! contract_pre_ntk_scaled_base {
6431    () => {{}};
6432    ($input:expr) => {{
6433        let indices = &$input;
6434        debug_assert!(
6435            indices.len() > 0,
6436            "Contract ntk_scaled_base: precondition violated — indices.len() > 0"
6437        );
6438    }};
6439}
6440
6441/// Preconditions for equation `rotation_matrix`.
6442/// Domain-specific. Call: `contract_pre_rotation_matrix!(slice_expr)`
6443macro_rules! contract_pre_rotation_matrix {
6444    () => {{}};
6445    ($input:expr) => {{
6446        let indices = &$input;
6447        debug_assert!(
6448            indices.len() > 0,
6449            "Contract rotation_matrix: precondition violated — indices.len() > 0"
6450        );
6451    }};
6452}
6453
6454/// Preconditions for equation `yarn_mixed_frequency`.
6455/// Domain-specific. Call: `contract_pre_yarn_mixed_frequency!(slice_expr)`
6456macro_rules! contract_pre_yarn_mixed_frequency {
6457    () => {{}};
6458    ($input:expr) => {{
6459        let indices = &$input;
6460        debug_assert!(
6461            indices.len() > 0,
6462            "Contract yarn_mixed_frequency: precondition violated — indices.len() > 0"
6463        );
6464    }};
6465}
6466
6467/// Preconditions for equation `yarn_ramp`.
6468/// Domain-specific. Call: `contract_pre_yarn_ramp!(slice_expr)`
6469macro_rules! contract_pre_yarn_ramp {
6470    () => {{}};
6471    ($input:expr) => {{
6472        let indices = &$input;
6473        debug_assert!(
6474            indices.len() > 0,
6475            "Contract yarn_ramp: precondition violated — indices.len() > 0"
6476        );
6477    }};
6478}
6479
6480// Auto-generated from contracts/rope-kernel-v1.yaml — DO NOT EDIT
6481// Contract: rope-kernel-v1
6482
6483/// Preconditions for equation `rope`.
6484/// Domain-specific. Call: `contract_pre_rope!(slice_expr)`
6485macro_rules! contract_pre_rope {
6486    () => {{}};
6487    ($input:expr) => {{
6488        let x = &$input;
6489        debug_assert!(
6490            x.len() > 0,
6491            "Contract rope: precondition violated — x.len() > 0"
6492        );
6493        debug_assert!(
6494            x.len() % 2 == 0,
6495            "Contract rope: precondition violated — x.len() % 2 == 0"
6496        );
6497    }};
6498}
6499
6500/// Postconditions for equation `rope`.
6501/// Call before return: `contract_post_rope!(result_expr)`
6502macro_rules! contract_post_rope {
6503    ($result:expr) => {{
6504        let _contract_result = &$result;
6505        debug_assert!(
6506            _contract_result.iter().all(|v| v.is_finite()),
6507            "Contract rope: postcondition violated — result.iter().all(|v| v.is_finite())"
6508        );
6509    }};
6510}
6511
6512/// Combined pre+post contract for equation `rope`.
6513macro_rules! contract_rope {
6514    ($input:expr, $body:expr) => {{
6515        contract_pre_rope!($input);
6516        let _contract_result = $body;
6517        contract_post_rope!(_contract_result);
6518        _contract_result
6519    }};
6520}
6521
6522// Auto-generated from contracts/safetensors-cpu-dispatch-v1.yaml — DO NOT EDIT
6523// Contract: safetensors-cpu-dispatch-v1
6524
6525/// Preconditions for equation `format_parity`.
6526/// Domain-specific. Call: `contract_pre_format_parity!(slice_expr)`
6527macro_rules! contract_pre_format_parity {
6528    () => {{}};
6529    ($input:expr) => {{
6530        let input = &$input;
6531        debug_assert!(
6532            input.len() > 0,
6533            "Contract format_parity: precondition violated — input.len() > 0"
6534        );
6535    }};
6536}
6537
6538// Auto-generated from contracts/safety-classifier-v1.yaml — DO NOT EDIT
6539// Contract: safety-classifier-v1
6540
6541/// Preconditions for equation `classify_filesystem`.
6542/// Domain-specific. Call: `contract_pre_classify_filesystem!(slice_expr)`
6543macro_rules! contract_pre_classify_filesystem {
6544    () => {{}};
6545    ($input:expr) => {{
6546        let source = &$input;
6547        debug_assert!(
6548            !source.is_empty(),
6549            "Contract classify_filesystem: precondition violated — !source.is_empty()"
6550        );
6551        debug_assert!(
6552            source.len() <= 1_000_000,
6553            "Contract classify_filesystem: precondition violated — source.len() <= 1_000_000"
6554        );
6555    }};
6556}
6557
6558/// Preconditions for equation `classify_injection`.
6559/// Domain-specific. Call: `contract_pre_classify_injection!(slice_expr)`
6560macro_rules! contract_pre_classify_injection {
6561    () => {{}};
6562    ($input:expr) => {{
6563        let source = &$input;
6564        debug_assert!(
6565            !source.is_empty(),
6566            "Contract classify_injection: precondition violated — !source.is_empty()"
6567        );
6568        debug_assert!(
6569            source.len() <= 1_000_000,
6570            "Contract classify_injection: precondition violated — source.len() <= 1_000_000"
6571        );
6572    }};
6573}
6574
6575/// Preconditions for equation `classify_secrets`.
6576/// Domain-specific. Call: `contract_pre_classify_secrets!(slice_expr)`
6577macro_rules! contract_pre_classify_secrets {
6578    () => {{}};
6579    ($input:expr) => {{
6580        let source = &$input;
6581        debug_assert!(
6582            !source.is_empty(),
6583            "Contract classify_secrets: precondition violated — !source.is_empty()"
6584        );
6585        debug_assert!(
6586            source.len() <= 1_000_000,
6587            "Contract classify_secrets: precondition violated — source.len() <= 1_000_000"
6588        );
6589    }};
6590}
6591
6592/// Preconditions for equation `lint_shell`.
6593/// Call at function entry: `contract_pre_lint_shell!(input_expr)`
6594macro_rules! contract_pre_lint_shell {
6595    () => {{}};
6596    ($input:expr) => {{
6597        let _contract_input = &$input;
6598    }};
6599}
6600
6601// Auto-generated from contracts/sampling-algorithms-v1.yaml — DO NOT EDIT
6602// Contract: sampling-algorithms-v1
6603
6604/// Preconditions for equation `greedy`.
6605/// Domain-specific. Call: `contract_pre_greedy!(slice_expr)`
6606macro_rules! contract_pre_greedy {
6607    () => {{}};
6608    ($input:expr) => {{
6609        let input = &$input;
6610        debug_assert!(
6611            input.len() > 0,
6612            "Contract greedy: precondition violated — input.len() > 0"
6613        );
6614    }};
6615}
6616
6617/// Preconditions for equation `temperature`.
6618/// Domain-specific. Call: `contract_pre_temperature!(slice_expr)`
6619macro_rules! contract_pre_temperature {
6620    () => {{}};
6621    ($input:expr) => {{
6622        let input = &$input;
6623        debug_assert!(
6624            input.len() > 0,
6625            "Contract temperature: precondition violated — input.len() > 0"
6626        );
6627    }};
6628}
6629
6630/// Preconditions for equation `top_k`.
6631/// Domain-specific. Call: `contract_pre_top_k!(slice_expr)`
6632macro_rules! contract_pre_top_k {
6633    () => {{}};
6634    ($input:expr) => {{
6635        let input = &$input;
6636        debug_assert!(
6637            input.len() > 0,
6638            "Contract top_k: precondition violated — input.len() > 0"
6639        );
6640    }};
6641}
6642
6643/// Preconditions for equation `top_p`.
6644/// Domain-specific. Call: `contract_pre_top_p!(slice_expr)`
6645macro_rules! contract_pre_top_p {
6646    () => {{}};
6647    ($input:expr) => {{
6648        let input = &$input;
6649        debug_assert!(
6650            input.len() > 0,
6651            "Contract top_p: precondition violated — input.len() > 0"
6652        );
6653    }};
6654}
6655
6656// Auto-generated from contracts/score-composite-v1.yaml — DO NOT EDIT
6657// Contract: score-composite-v1
6658
6659/// Preconditions for equation `geometric_mean`.
6660/// Domain-specific. Call: `contract_pre_geometric_mean!(slice_expr)`
6661macro_rules! contract_pre_geometric_mean {
6662    () => {{}};
6663    ($input:expr) => {{
6664        let input = &$input;
6665        debug_assert!(
6666            input.len() > 0,
6667            "Contract geometric_mean: precondition violated — input.len() > 0"
6668        );
6669        debug_assert!(
6670            input.iter().all(|v| v.is_finite()),
6671            "Contract geometric_mean: precondition violated — input.iter().all(|v| v.is_finite())"
6672        );
6673    }};
6674}
6675
6676/// Preconditions for equation `grade_from_score`.
6677/// Domain-specific. Call: `contract_pre_grade_from_score!(slice_expr)`
6678macro_rules! contract_pre_grade_from_score {
6679    () => {{}};
6680    ($input:expr) => {{
6681        let grad_output = &$input;
6682        debug_assert!(grad_output.len() > 0,
6683            "Contract grade_from_score: precondition violated — grad_output.len() > 0");
6684        debug_assert!(grad_output.iter().all(|v| v.is_finite()),
6685            "Contract grade_from_score: precondition violated — grad_output.iter().all(|v| v.is_finite())");
6686    }};
6687}
6688
6689// Auto-generated from contracts/semantic-equivalence-v1.yaml — DO NOT EDIT
6690// Contract: semantic-equivalence-v1
6691
6692/// Preconditions for equation `comprehension_equivalence`.
6693/// Domain-specific. Call: `contract_pre_comprehension_equivalence!(slice_expr)`
6694macro_rules! contract_pre_comprehension_equivalence {
6695    () => {{}};
6696    ($input:expr) => {{
6697        let input = &$input;
6698        debug_assert!(
6699            input.len() > 0,
6700            "Contract comprehension_equivalence: precondition violated — input.len() > 0"
6701        );
6702    }};
6703}
6704
6705/// Preconditions for equation `control_flow_equivalence`.
6706/// Domain-specific. Call: `contract_pre_control_flow_equivalence!(slice_expr)`
6707macro_rules! contract_pre_control_flow_equivalence {
6708    () => {{}};
6709    ($input:expr) => {{
6710        let input = &$input;
6711        debug_assert!(
6712            input.len() > 0,
6713            "Contract control_flow_equivalence: precondition violated — input.len() > 0"
6714        );
6715    }};
6716}
6717
6718/// Preconditions for equation `expression_equivalence`.
6719/// Domain-specific. Call: `contract_pre_expression_equivalence!(slice_expr)`
6720macro_rules! contract_pre_expression_equivalence {
6721    () => {{}};
6722    ($input:expr) => {{
6723        let input = &$input;
6724        debug_assert!(
6725            input.len() > 0,
6726            "Contract expression_equivalence: precondition violated — input.len() > 0"
6727        );
6728    }};
6729}
6730
6731/// Preconditions for equation `observational_equivalence`.
6732/// Domain-specific. Call: `contract_pre_observational_equivalence!(slice_expr)`
6733macro_rules! contract_pre_observational_equivalence {
6734    () => {{}};
6735    ($input:expr) => {{
6736        let input = &$input;
6737        debug_assert!(
6738            input.len() > 0,
6739            "Contract observational_equivalence: precondition violated — input.len() > 0"
6740        );
6741    }};
6742}
6743
6744/// Preconditions for equation `statement_equivalence`.
6745/// Domain-specific. Call: `contract_pre_statement_equivalence!(slice_expr)`
6746macro_rules! contract_pre_statement_equivalence {
6747    () => {{}};
6748    ($input:expr) => {{
6749        let input = &$input;
6750        debug_assert!(
6751            input.len() > 0,
6752            "Contract statement_equivalence: precondition violated — input.len() > 0"
6753        );
6754    }};
6755}
6756
6757// Auto-generated from contracts/serialization-v1.yaml — DO NOT EDIT
6758// Contract: serialization-v1
6759
6760/// Preconditions for equation `serialization`.
6761/// Domain-specific. Call: `contract_pre_serialization!(slice_expr)`
6762macro_rules! contract_pre_serialization {
6763    () => {{}};
6764    ($input:expr) => {{
6765        let input = &$input;
6766        debug_assert!(
6767            input.len() > 0,
6768            "Contract serialization: precondition violated — input.len() > 0"
6769        );
6770        debug_assert!(
6771            input.iter().all(|v| v.is_finite()),
6772            "Contract serialization: precondition violated — input.iter().all(|v| v.is_finite())"
6773        );
6774    }};
6775}
6776
6777// Auto-generated from contracts/shannon-entropy-v1.yaml — DO NOT EDIT
6778// Contract: shannon-entropy-v1
6779
6780/// Preconditions for equation `entropy`.
6781/// Domain-specific. Call: `contract_pre_entropy!(slice_expr)`
6782macro_rules! contract_pre_entropy {
6783    () => {{}};
6784    ($input:expr) => {{
6785        let input = &$input;
6786        debug_assert!(
6787            input.len() > 0,
6788            "Contract entropy: precondition violated — input.len() > 0"
6789        );
6790        debug_assert!(
6791            input.iter().all(|v| v.is_finite()),
6792            "Contract entropy: precondition violated — input.iter().all(|v| v.is_finite())"
6793        );
6794    }};
6795}
6796
6797/// Preconditions for equation `uniform_entropy`.
6798/// Domain-specific. Call: `contract_pre_uniform_entropy!(slice_expr)`
6799macro_rules! contract_pre_uniform_entropy {
6800    () => {{}};
6801    ($input:expr) => {{
6802        let input = &$input;
6803        debug_assert!(input.len() > 0,
6804            "Contract uniform_entropy: precondition violated — input.len() > 0");
6805        debug_assert!(input.iter().all(|v| v.is_finite()),
6806            "Contract uniform_entropy: precondition violated — input.iter().all(|v| v.is_finite())");
6807    }};
6808}
6809
6810// Auto-generated from contracts/silu-kernel-v1.yaml — DO NOT EDIT
6811// Contract: silu-kernel-v1
6812
6813/// Preconditions for equation `sigmoid`.
6814/// Domain-specific. Call: `contract_pre_sigmoid!(slice_expr)`
6815macro_rules! contract_pre_sigmoid {
6816    () => {{}};
6817    ($input:expr) => {{
6818        let x = &$input;
6819        debug_assert!(
6820            x.iter().all(|v| v.is_finite()),
6821            "Contract sigmoid: precondition violated — x.iter().all(|v| v.is_finite())"
6822        );
6823        debug_assert!(
6824            x.len() > 0,
6825            "Contract sigmoid: precondition violated — x.len() > 0"
6826        );
6827    }};
6828}
6829
6830/// Preconditions for equation `silu`.
6831/// Domain-specific. Call: `contract_pre_silu!(slice_expr)`
6832macro_rules! contract_pre_silu {
6833    () => {{}};
6834    ($input:expr) => {{
6835        let x = &$input;
6836        debug_assert!(
6837            x.iter().all(|v| v.is_finite()),
6838            "Contract silu: precondition violated — x.iter().all(|v| v.is_finite())"
6839        );
6840        debug_assert!(
6841            x.len() > 0,
6842            "Contract silu: precondition violated — x.len() > 0"
6843        );
6844    }};
6845}
6846
6847// Auto-generated from contracts/sliding-window-attention-v1.yaml — DO NOT EDIT
6848// Contract: sliding-window-attention-v1
6849
6850/// Preconditions for equation `attention_sparsity`.
6851/// Domain-specific. Call: `contract_pre_attention_sparsity!(slice_expr)`
6852macro_rules! contract_pre_attention_sparsity {
6853    () => {{}};
6854    ($input:expr) => {{
6855        let q = &$input;
6856        debug_assert!(
6857            q.len() > 0,
6858            "Contract attention_sparsity: precondition violated — q.len() > 0"
6859        );
6860    }};
6861}
6862
6863/// Preconditions for equation `causal_window_mask`.
6864/// Domain-specific. Call: `contract_pre_causal_window_mask!(slice_expr)`
6865macro_rules! contract_pre_causal_window_mask {
6866    () => {{}};
6867    ($input:expr) => {{
6868        let q = &$input;
6869        debug_assert!(
6870            q.len() > 0,
6871            "Contract causal_window_mask: precondition violated — q.len() > 0"
6872        );
6873    }};
6874}
6875
6876/// Preconditions for equation `effective_context`.
6877/// Domain-specific. Call: `contract_pre_effective_context!(slice_expr)`
6878macro_rules! contract_pre_effective_context {
6879    () => {{}};
6880    ($input:expr) => {{
6881        let q = &$input;
6882        debug_assert!(
6883            q.len() > 0,
6884            "Contract effective_context: precondition violated — q.len() > 0"
6885        );
6886    }};
6887}
6888
6889/// Preconditions for equation `multi_layer_receptive_field`.
6890/// Domain-specific. Call: `contract_pre_multi_layer_receptive_field!(slice_expr)`
6891macro_rules! contract_pre_multi_layer_receptive_field {
6892    () => {{}};
6893    ($input:expr) => {{
6894        let q = &$input;
6895        debug_assert!(
6896            q.len() > 0,
6897            "Contract multi_layer_receptive_field: precondition violated — q.len() > 0"
6898        );
6899    }};
6900}
6901
6902/// Preconditions for equation `window_mask`.
6903/// Domain-specific. Call: `contract_pre_window_mask!(slice_expr)`
6904macro_rules! contract_pre_window_mask {
6905    () => {{}};
6906    ($input:expr) => {{
6907        let q = &$input;
6908        debug_assert!(
6909            q.len() > 0,
6910            "Contract window_mask: precondition violated — q.len() > 0"
6911        );
6912    }};
6913}
6914
6915// Auto-generated from contracts/softmax-kernel-v1.yaml — DO NOT EDIT
6916// Contract: softmax-kernel-v1
6917
6918/// Preconditions for equation `softmax`.
6919/// Domain-specific. Call: `contract_pre_softmax!(slice_expr)`
6920macro_rules! contract_pre_softmax {
6921    () => {{}};
6922    ($input:expr) => {{
6923        let x = &$input;
6924        debug_assert!(
6925            x.len() > 0,
6926            "Contract softmax: precondition violated — x.len() > 0"
6927        );
6928        debug_assert!(
6929            x.iter().all(|v| v.is_finite()),
6930            "Contract softmax: precondition violated — x.iter().all(|v| v.is_finite())"
6931        );
6932    }};
6933}
6934
6935/// Postconditions for equation `softmax`.
6936/// Call before return: `contract_post_softmax!(result_expr)`
6937macro_rules! contract_post_softmax {
6938    ($result:expr) => {{
6939        let _contract_result = &$result;
6940        debug_assert!(_contract_result.iter().all(|v| *v > 0.0), "Contract softmax: postcondition violated — result.iter().all(|v| *v > 0.0)");
6941        debug_assert!((_contract_result.iter().sum::<f32>() - 1.0).abs() < 1e-5, "Contract softmax: postcondition violated — (result.iter().sum::<f32>() - 1.0).abs() < 1e-5");
6942    }};
6943}
6944
6945/// Combined pre+post contract for equation `softmax`.
6946macro_rules! contract_softmax {
6947    ($input:expr, $body:expr) => {{
6948        contract_pre_softmax!($input);
6949        let _contract_result = $body;
6950        contract_post_softmax!(_contract_result);
6951        _contract_result
6952    }};
6953}
6954
6955// Auto-generated from contracts/special-tokens-registry-v1.yaml — DO NOT EDIT
6956// Contract: special-tokens-registry-v1
6957
6958/// Preconditions for equation `token_bounds`.
6959/// Domain-specific. Call: `contract_pre_token_bounds!(slice_expr)`
6960macro_rules! contract_pre_token_bounds {
6961    () => {{}};
6962    ($input:expr) => {{
6963        let input = &$input;
6964        debug_assert!(
6965            input.len() > 0,
6966            "Contract token_bounds: precondition violated — input.len() > 0"
6967        );
6968    }};
6969}
6970
6971// Auto-generated from contracts/speculative-decoding-v1.yaml — DO NOT EDIT
6972// Contract: speculative-decoding-v1
6973
6974/// Preconditions for equation `acceptance_probability`.
6975/// Domain-specific. Call: `contract_pre_acceptance_probability!(slice_expr)`
6976macro_rules! contract_pre_acceptance_probability {
6977    () => {{}};
6978    ($input:expr) => {{
6979        let input = &$input;
6980        debug_assert!(
6981            input.len() > 0,
6982            "Contract acceptance_probability: precondition violated — input.len() > 0"
6983        );
6984    }};
6985}
6986
6987/// Preconditions for equation `output_equivalence`.
6988/// Domain-specific. Call: `contract_pre_output_equivalence!(slice_expr)`
6989macro_rules! contract_pre_output_equivalence {
6990    () => {{}};
6991    ($input:expr) => {{
6992        let input = &$input;
6993        debug_assert!(
6994            input.len() > 0,
6995            "Contract output_equivalence: precondition violated — input.len() > 0"
6996        );
6997    }};
6998}
6999
7000/// Preconditions for equation `token_acceptance`.
7001/// Domain-specific. Call: `contract_pre_token_acceptance!(slice_expr)`
7002macro_rules! contract_pre_token_acceptance {
7003    () => {{}};
7004    ($input:expr) => {{
7005        let input = &$input;
7006        debug_assert!(
7007            input.len() > 0,
7008            "Contract token_acceptance: precondition violated — input.len() > 0"
7009        );
7010    }};
7011}
7012
7013// Auto-generated from contracts/ssm-kernel-v1.yaml — DO NOT EDIT
7014// Contract: ssm-kernel-v1
7015
7016/// Preconditions for equation `selective_gate`.
7017/// Domain-specific. Call: `contract_pre_selective_gate!(slice_expr)`
7018macro_rules! contract_pre_selective_gate {
7019    () => {{}};
7020    ($input:expr) => {{
7021        let input = &$input;
7022        debug_assert!(
7023            input.len() > 0,
7024            "Contract selective_gate: precondition violated — input.len() > 0"
7025        );
7026        debug_assert!(
7027            input.iter().all(|v| v.is_finite()),
7028            "Contract selective_gate: precondition violated — input.iter().all(|v| v.is_finite())"
7029        );
7030    }};
7031}
7032
7033/// Preconditions for equation `ssm_discretize`.
7034/// Domain-specific. Call: `contract_pre_ssm_discretize!(slice_expr)`
7035macro_rules! contract_pre_ssm_discretize {
7036    () => {{}};
7037    ($input:expr) => {{
7038        let x = &$input;
7039        debug_assert!(
7040            x.iter().all(|v| v.is_finite()),
7041            "Contract ssm_discretize: precondition violated — x.iter().all(|v| v.is_finite())"
7042        );
7043        debug_assert!(
7044            x.len() > 0,
7045            "Contract ssm_discretize: precondition violated — x.len() > 0"
7046        );
7047    }};
7048}
7049
7050/// Preconditions for equation `ssm_scan`.
7051/// Domain-specific. Call: `contract_pre_ssm_scan!(slice_expr)`
7052macro_rules! contract_pre_ssm_scan {
7053    () => {{}};
7054    ($input:expr) => {{
7055        let input = &$input;
7056        debug_assert!(
7057            input.len() > 0,
7058            "Contract ssm_scan: precondition violated — input.len() > 0"
7059        );
7060        debug_assert!(
7061            input.iter().all(|v| v.is_finite()),
7062            "Contract ssm_scan: precondition violated — input.iter().all(|v| v.is_finite())"
7063        );
7064    }};
7065}
7066
7067// Auto-generated from contracts/streaming-tpot-v1.yaml — DO NOT EDIT
7068// Contract: streaming-tpot-v1
7069
7070/// Preconditions for equation `tpot_definition`.
7071/// Domain-specific. Call: `contract_pre_tpot_definition!(slice_expr)`
7072macro_rules! contract_pre_tpot_definition {
7073    () => {{}};
7074    ($input:expr) => {{
7075        let input = &$input;
7076        debug_assert!(input.len() > 0,
7077            "Contract tpot_definition: precondition violated — input.len() > 0");
7078        debug_assert!(input.iter().all(|v| v.is_finite()),
7079            "Contract tpot_definition: precondition violated — input.iter().all(|v| v.is_finite())");
7080    }};
7081}
7082
7083// Auto-generated from contracts/svm-v1.yaml — DO NOT EDIT
7084// Contract: svm-v1
7085
7086/// Preconditions for equation `decision_function`.
7087/// Domain-specific. Call: `contract_pre_decision_function!(slice_expr)`
7088macro_rules! contract_pre_decision_function {
7089    () => {{}};
7090    ($input:expr) => {{
7091        let input = &$input;
7092        debug_assert!(input.len() > 0,
7093            "Contract decision_function: precondition violated — input.len() > 0");
7094        debug_assert!(input.iter().all(|v| v.is_finite()),
7095            "Contract decision_function: precondition violated — input.iter().all(|v| v.is_finite())");
7096    }};
7097}
7098
7099/// Preconditions for equation `hinge_loss`.
7100/// Domain-specific. Call: `contract_pre_hinge_loss!(slice_expr)`
7101macro_rules! contract_pre_hinge_loss {
7102    () => {{}};
7103    ($input:expr) => {{
7104        let predicted = &$input;
7105        debug_assert!(
7106            predicted.len() > 0,
7107            "Contract hinge_loss: precondition violated — predicted.len() > 0"
7108        );
7109    }};
7110}
7111
7112/// Preconditions for equation `margin`.
7113/// Domain-specific. Call: `contract_pre_margin!(slice_expr)`
7114macro_rules! contract_pre_margin {
7115    () => {{}};
7116    ($input:expr) => {{
7117        let input = &$input;
7118        debug_assert!(
7119            input.len() > 0,
7120            "Contract margin: precondition violated — input.len() > 0"
7121        );
7122        debug_assert!(
7123            input.iter().all(|v| v.is_finite()),
7124            "Contract margin: precondition violated — input.iter().all(|v| v.is_finite())"
7125        );
7126    }};
7127}
7128
7129/// Preconditions for equation `svm_predict`.
7130/// Domain-specific. Call: `contract_pre_svm_predict!(slice_expr)`
7131macro_rules! contract_pre_svm_predict {
7132    () => {{}};
7133    ($input:expr) => {{
7134        let input = &$input;
7135        debug_assert!(
7136            input.len() > 0,
7137            "Contract svm_predict: precondition violated — input.len() > 0"
7138        );
7139        debug_assert!(
7140            input.iter().all(|v| v.is_finite()),
7141            "Contract svm_predict: precondition violated — input.iter().all(|v| v.is_finite())"
7142        );
7143    }};
7144}
7145
7146// Auto-generated from contracts/swiglu-kernel-v1.yaml — DO NOT EDIT
7147// Contract: swiglu-kernel-v1
7148
7149/// Preconditions for equation `silu`.
7150/// Domain-specific. Call: `contract_pre_silu!(slice_expr)`
7151macro_rules! contract_pre_silu {
7152    () => {{}};
7153    ($input:expr) => {{
7154        let x = &$input;
7155        debug_assert!(
7156            x.iter().all(|v| v.is_finite()),
7157            "Contract silu: precondition violated — x.iter().all(|v| v.is_finite())"
7158        );
7159        debug_assert!(
7160            x.len() > 0,
7161            "Contract silu: precondition violated — x.len() > 0"
7162        );
7163    }};
7164}
7165
7166/// Preconditions for equation `swiglu`.
7167/// Domain-specific. Call: `contract_pre_swiglu!(slice_expr)`
7168macro_rules! contract_pre_swiglu {
7169    () => {{}};
7170    ($input:expr) => {{
7171        let x = &$input;
7172        debug_assert!(
7173            x.len() > 0,
7174            "Contract swiglu: precondition violated — x.len() > 0"
7175        );
7176        debug_assert!(
7177            x.iter().all(|v| v.is_finite()),
7178            "Contract swiglu: precondition violated — x.iter().all(|v| v.is_finite())"
7179        );
7180    }};
7181}
7182
7183/// Postconditions for equation `swiglu`.
7184/// Call before return: `contract_post_swiglu!(result_expr)`
7185macro_rules! contract_post_swiglu {
7186    ($result:expr) => {{
7187        let _contract_result = &$result;
7188        debug_assert!(
7189            _contract_result.iter().all(|v| v.is_finite()),
7190            "Contract swiglu: postcondition violated — result.iter().all(|v| v.is_finite())"
7191        );
7192    }};
7193}
7194
7195/// Combined pre+post contract for equation `swiglu`.
7196macro_rules! contract_swiglu {
7197    ($input:expr, $body:expr) => {{
7198        contract_pre_swiglu!($input);
7199        let _contract_result = $body;
7200        contract_post_swiglu!(_contract_result);
7201        _contract_result
7202    }};
7203}
7204
7205// Auto-generated from contracts/tdg-scoring-v1.yaml — DO NOT EDIT
7206// Contract: tdg-scoring-v1
7207
7208/// Preconditions for equation `calculate_tdg`.
7209/// Call at function entry: `contract_pre_calculate_tdg!(input_expr)`
7210macro_rules! contract_pre_calculate_tdg {
7211    () => {{}};
7212    ($input:expr) => {{
7213        let _contract_input = &$input;
7214    }};
7215}
7216
7217/// Preconditions for equation `letter_grade`.
7218/// Domain-specific. Call: `contract_pre_letter_grade!(slice_expr)`
7219macro_rules! contract_pre_letter_grade {
7220    () => {{}};
7221    ($input:expr) => {{
7222        let grad_output = &$input;
7223        debug_assert!(grad_output.len() > 0,
7224            "Contract letter_grade: precondition violated — grad_output.len() > 0");
7225        debug_assert!(grad_output.iter().all(|v| v.is_finite()),
7226            "Contract letter_grade: precondition violated — grad_output.iter().all(|v| v.is_finite())");
7227    }};
7228}
7229
7230// Auto-generated from contracts/tensor-inventory-v1.yaml — DO NOT EDIT
7231// Contract: tensor-inventory-v1
7232
7233/// Preconditions for equation `architecture_delta`.
7234/// Domain-specific. Call: `contract_pre_architecture_delta!(slice_expr)`
7235macro_rules! contract_pre_architecture_delta {
7236    () => {{}};
7237    ($input:expr) => {{
7238        let input = &$input;
7239        debug_assert!(input.len() > 0,
7240            "Contract architecture_delta: precondition violated — input.len() > 0");
7241        debug_assert!(input.iter().all(|v| v.is_finite()),
7242            "Contract architecture_delta: precondition violated — input.iter().all(|v| v.is_finite())");
7243    }};
7244}
7245
7246/// Preconditions for equation `parameter_decomposition`.
7247/// Domain-specific. Call: `contract_pre_parameter_decomposition!(slice_expr)`
7248macro_rules! contract_pre_parameter_decomposition {
7249    () => {{}};
7250    ($input:expr) => {{
7251        let indices = &$input;
7252        debug_assert!(
7253            indices.len() > 0,
7254            "Contract parameter_decomposition: precondition violated — indices.len() > 0"
7255        );
7256    }};
7257}
7258
7259/// Preconditions for equation `quantization_bytes`.
7260/// Domain-specific. Call: `contract_pre_quantization_bytes!(slice_expr)`
7261macro_rules! contract_pre_quantization_bytes {
7262    () => {{}};
7263    ($input:expr) => {{
7264        let input = &$input;
7265        debug_assert!(
7266            input.len() > 0,
7267            "Contract quantization_bytes: precondition violated — input.len() > 0"
7268        );
7269    }};
7270}
7271
7272/// Preconditions for equation `tensor_count`.
7273/// Domain-specific. Call: `contract_pre_tensor_count!(slice_expr)`
7274macro_rules! contract_pre_tensor_count {
7275    () => {{}};
7276    ($input:expr) => {{
7277        let input = &$input;
7278        debug_assert!(
7279            input.len() > 0,
7280            "Contract tensor_count: precondition violated — input.len() > 0"
7281        );
7282        debug_assert!(
7283            input.iter().all(|v| v.is_finite()),
7284            "Contract tensor_count: precondition violated — input.iter().all(|v| v.is_finite())"
7285        );
7286    }};
7287}
7288
7289/// Preconditions for equation `tied_embeddings`.
7290/// Domain-specific. Call: `contract_pre_tied_embeddings!(slice_expr)`
7291macro_rules! contract_pre_tied_embeddings {
7292    () => {{}};
7293    ($input:expr) => {{
7294        let indices = &$input;
7295        debug_assert!(
7296            indices.len() > 0,
7297            "Contract tied_embeddings: precondition violated — indices.len() > 0"
7298        );
7299    }};
7300}
7301
7302// Auto-generated from contracts/tensor-layout-v1.yaml — DO NOT EDIT
7303// Contract: tensor-layout-v1
7304
7305/// Preconditions for equation `identity`.
7306/// Domain-specific. Call: `contract_pre_identity!(slice_expr)`
7307macro_rules! contract_pre_identity {
7308    () => {{}};
7309    ($input:expr) => {{
7310        let a = &$input;
7311        debug_assert!(
7312            a.len() > 0,
7313            "Contract identity: precondition violated — a.len() > 0"
7314        );
7315    }};
7316}
7317
7318// Auto-generated from contracts/tensor-names-v1.yaml — DO NOT EDIT
7319// Contract: tensor-names-v1
7320
7321/// Preconditions for equation `architecture_normalization`.
7322/// Domain-specific. Call: `contract_pre_architecture_normalization!(slice_expr)`
7323macro_rules! contract_pre_architecture_normalization {
7324    () => {{}};
7325    ($input:expr) => {{
7326        let input = &$input;
7327        debug_assert!(input.iter().all(|v| v.is_finite()),
7328            "Contract architecture_normalization: precondition violated — input.iter().all(|v| v.is_finite())");
7329        debug_assert!(input.len() > 0,
7330            "Contract architecture_normalization: precondition violated — input.len() > 0");
7331    }};
7332}
7333
7334/// Preconditions for equation `name_resolution`.
7335/// Domain-specific. Call: `contract_pre_name_resolution!(slice_expr)`
7336macro_rules! contract_pre_name_resolution {
7337    () => {{}};
7338    ($input:expr) => {{
7339        let input = &$input;
7340        debug_assert!(input.len() > 0,
7341            "Contract name_resolution: precondition violated — input.len() > 0");
7342        debug_assert!(input.iter().all(|v| v.is_finite()),
7343            "Contract name_resolution: precondition violated — input.iter().all(|v| v.is_finite())");
7344    }};
7345}
7346
7347// Auto-generated from contracts/tensor-rc-data-v1.yaml — DO NOT EDIT
7348// Contract: tensor-rc-data-v1
7349
7350/// Preconditions for equation `identity`.
7351/// Domain-specific. Call: `contract_pre_identity!(slice_expr)`
7352macro_rules! contract_pre_identity {
7353    () => {{}};
7354    ($input:expr) => {{
7355        let a = &$input;
7356        debug_assert!(
7357            a.len() > 0,
7358            "Contract identity: precondition violated — a.len() > 0"
7359        );
7360    }};
7361}
7362
7363// Auto-generated from contracts/tensor-shape-flow-v1.yaml — DO NOT EDIT
7364// Contract: tensor-shape-flow-v1
7365
7366/// Preconditions for equation `gqa_grouping`.
7367/// Domain-specific. Call: `contract_pre_gqa_grouping!(slice_expr)`
7368macro_rules! contract_pre_gqa_grouping {
7369    () => {{}};
7370    ($input:expr) => {{
7371        let q = &$input;
7372        debug_assert!(
7373            q.len() > 0,
7374            "Contract gqa_grouping: precondition violated — q.len() > 0"
7375        );
7376    }};
7377}
7378
7379/// Preconditions for equation `lm_head`.
7380/// Domain-specific. Call: `contract_pre_lm_head!(slice_expr)`
7381macro_rules! contract_pre_lm_head {
7382    () => {{}};
7383    ($input:expr) => {{
7384        let input = &$input;
7385        debug_assert!(
7386            input.len() > 0,
7387            "Contract lm_head: precondition violated — input.len() > 0"
7388        );
7389        debug_assert!(
7390            input.iter().all(|v| v.is_finite()),
7391            "Contract lm_head: precondition violated — input.iter().all(|v| v.is_finite())"
7392        );
7393    }};
7394}
7395
7396/// Preconditions for equation `qkv_projection`.
7397/// Domain-specific. Call: `contract_pre_qkv_projection!(slice_expr)`
7398macro_rules! contract_pre_qkv_projection {
7399    () => {{}};
7400    ($input:expr) => {{
7401        let input = &$input;
7402        debug_assert!(
7403            input.len() > 0,
7404            "Contract qkv_projection: precondition violated — input.len() > 0"
7405        );
7406        debug_assert!(
7407            input.iter().all(|v| v.is_finite()),
7408            "Contract qkv_projection: precondition violated — input.iter().all(|v| v.is_finite())"
7409        );
7410    }};
7411}
7412
7413/// Preconditions for equation `residual`.
7414/// Domain-specific. Call: `contract_pre_residual!(slice_expr)`
7415macro_rules! contract_pre_residual {
7416    () => {{}};
7417    ($input:expr) => {{
7418        let input = &$input;
7419        debug_assert!(
7420            input.len() > 0,
7421            "Contract residual: precondition violated — input.len() > 0"
7422        );
7423        debug_assert!(
7424            input.iter().all(|v| v.is_finite()),
7425            "Contract residual: precondition violated — input.iter().all(|v| v.is_finite())"
7426        );
7427    }};
7428}
7429
7430/// Preconditions for equation `swiglu_shape`.
7431/// Domain-specific. Call: `contract_pre_swiglu_shape!(slice_expr)`
7432macro_rules! contract_pre_swiglu_shape {
7433    () => {{}};
7434    ($input:expr) => {{
7435        let input = &$input;
7436        debug_assert!(
7437            input.len() > 0,
7438            "Contract swiglu_shape: precondition violated — input.len() > 0"
7439        );
7440        debug_assert!(
7441            input.iter().all(|v| v.is_finite()),
7442            "Contract swiglu_shape: precondition violated — input.iter().all(|v| v.is_finite())"
7443        );
7444    }};
7445}
7446
7447// Auto-generated from contracts/tied-embeddings-v1.yaml — DO NOT EDIT
7448// Contract: tied-embeddings-v1
7449
7450/// Preconditions for equation `tied_lm_head`.
7451/// Domain-specific. Call: `contract_pre_tied_lm_head!(slice_expr)`
7452macro_rules! contract_pre_tied_lm_head {
7453    () => {{}};
7454    ($input:expr) => {{
7455        let indices = &$input;
7456        debug_assert!(
7457            indices.len() > 0,
7458            "Contract tied_lm_head: precondition violated — indices.len() > 0"
7459        );
7460    }};
7461}
7462
7463// Auto-generated from contracts/tiled-matmul-shader-v1.yaml — DO NOT EDIT
7464// Contract: tiled-matmul-shader-v1
7465
7466/// Preconditions for equation `identity`.
7467/// Domain-specific. Call: `contract_pre_identity!(slice_expr)`
7468macro_rules! contract_pre_identity {
7469    () => {{}};
7470    ($input:expr) => {{
7471        let a = &$input;
7472        debug_assert!(
7473            a.len() > 0,
7474            "Contract identity: precondition violated — a.len() > 0"
7475        );
7476    }};
7477}
7478
7479// Auto-generated from contracts/tokenizer-loading-v1.yaml — DO NOT EDIT
7480// Contract: tokenizer-loading-v1
7481
7482/// Preconditions for equation `identity`.
7483/// Call at function entry: `contract_pre_identity!(input_expr)`
7484macro_rules! contract_pre_identity {
7485    () => {{}};
7486    ($input:expr) => {{
7487        let _contract_input = &$input;
7488        debug_assert!(
7489            !_contract_input.is_empty(),
7490            "Contract identity: precondition violated — !input.is_empty()"
7491        );
7492    }};
7493}
7494
7495// Auto-generated from contracts/training-loop-v1.yaml — DO NOT EDIT
7496// Contract: training-loop-v1
7497
7498/// Preconditions for equation `ema_loss`.
7499/// Domain-specific. Call: `contract_pre_ema_loss!(slice_expr)`
7500macro_rules! contract_pre_ema_loss {
7501    () => {{}};
7502    ($input:expr) => {{
7503        let predicted = &$input;
7504        debug_assert!(
7505            predicted.len() > 0,
7506            "Contract ema_loss: precondition violated — predicted.len() > 0"
7507        );
7508    }};
7509}
7510
7511/// Preconditions for equation `val_split`.
7512/// Domain-specific. Call: `contract_pre_val_split!(slice_expr)`
7513macro_rules! contract_pre_val_split {
7514    () => {{}};
7515    ($input:expr) => {{
7516        let input = &$input;
7517        debug_assert!(
7518            input.len() > 0,
7519            "Contract val_split: precondition violated — input.len() > 0"
7520        );
7521        debug_assert!(
7522            input.iter().all(|v| v.is_finite()),
7523            "Contract val_split: precondition violated — input.iter().all(|v| v.is_finite())"
7524        );
7525    }};
7526}
7527
7528/// Preconditions for equation `warmup_lr`.
7529/// Domain-specific. Call: `contract_pre_warmup_lr!(slice_expr)`
7530macro_rules! contract_pre_warmup_lr {
7531    () => {{}};
7532    ($input:expr) => {{
7533        let params = &$input;
7534        debug_assert!(
7535            params.len() > 0,
7536            "Contract warmup_lr: precondition violated — params.len() > 0"
7537        );
7538    }};
7539}
7540
7541// Auto-generated from contracts/transpose-kernel-v1.yaml — DO NOT EDIT
7542// Contract: transpose-kernel-v1
7543
7544/// Preconditions for equation `transpose`.
7545/// Domain-specific. Call: `contract_pre_transpose!(slice_expr)`
7546macro_rules! contract_pre_transpose {
7547    () => {{}};
7548    ($input:expr) => {{
7549        let a = &$input;
7550        debug_assert!(
7551            a.len() > 0,
7552            "Contract transpose: precondition violated — a.len() > 0"
7553        );
7554    }};
7555}
7556
7557// Auto-generated from contracts/type-preservation-v1.yaml — DO NOT EDIT
7558// Contract: type-preservation-v1
7559
7560/// Preconditions for equation `container_preservation`.
7561/// Domain-specific. Call: `contract_pre_container_preservation!(slice_expr)`
7562macro_rules! contract_pre_container_preservation {
7563    () => {{}};
7564    ($input:expr) => {{
7565        let input = &$input;
7566        debug_assert!(
7567            input.len() > 0,
7568            "Contract container_preservation: precondition violated — input.len() > 0"
7569        );
7570    }};
7571}
7572
7573/// Preconditions for equation `copy_semantics`.
7574/// Domain-specific. Call: `contract_pre_copy_semantics!(slice_expr)`
7575macro_rules! contract_pre_copy_semantics {
7576    () => {{}};
7577    ($input:expr) => {{
7578        let input = &$input;
7579        debug_assert!(
7580            input.len() > 0,
7581            "Contract copy_semantics: precondition violated — input.len() > 0"
7582        );
7583    }};
7584}
7585
7586/// Preconditions for equation `numeric_semantics`.
7587/// Domain-specific. Call: `contract_pre_numeric_semantics!(slice_expr)`
7588macro_rules! contract_pre_numeric_semantics {
7589    () => {{}};
7590    ($input:expr) => {{
7591        let input = &$input;
7592        debug_assert!(
7593            input.len() > 0,
7594            "Contract numeric_semantics: precondition violated — input.len() > 0"
7595        );
7596    }};
7597}
7598
7599/// Preconditions for equation `type_inference`.
7600/// Domain-specific. Call: `contract_pre_type_inference!(slice_expr)`
7601macro_rules! contract_pre_type_inference {
7602    () => {{}};
7603    ($input:expr) => {{
7604        let input = &$input;
7605        debug_assert!(
7606            input.len() > 0,
7607            "Contract type_inference: precondition violated — input.len() > 0"
7608        );
7609    }};
7610}
7611
7612/// Preconditions for equation `type_map`.
7613/// Domain-specific. Call: `contract_pre_type_map!(slice_expr)`
7614macro_rules! contract_pre_type_map {
7615    () => {{}};
7616    ($input:expr) => {{
7617        let input = &$input;
7618        debug_assert!(
7619            input.len() > 0,
7620            "Contract type_map: precondition violated — input.len() > 0"
7621        );
7622    }};
7623}
7624
7625// Auto-generated from contracts/validated-tensor-v1.yaml — DO NOT EDIT
7626// Contract: validated-tensor-v1
7627
7628/// Preconditions for equation `density_gate`.
7629/// Domain-specific. Call: `contract_pre_density_gate!(slice_expr)`
7630macro_rules! contract_pre_density_gate {
7631    () => {{}};
7632    ($input:expr) => {{
7633        let input = &$input;
7634        debug_assert!(
7635            input.len() > 0,
7636            "Contract density_gate: precondition violated — input.len() > 0"
7637        );
7638        debug_assert!(
7639            input.iter().all(|v| v.is_finite()),
7640            "Contract density_gate: precondition violated — input.iter().all(|v| v.is_finite())"
7641        );
7642    }};
7643}
7644
7645/// Preconditions for equation `l2_norm_nondegeneracy`.
7646/// Domain-specific. Call: `contract_pre_l2_norm_nondegeneracy!(slice_expr)`
7647macro_rules! contract_pre_l2_norm_nondegeneracy {
7648    () => {{}};
7649    ($input:expr) => {{
7650        let input = &$input;
7651        debug_assert!(input.iter().all(|v| v.is_finite()),
7652            "Contract l2_norm_nondegeneracy: precondition violated — input.iter().all(|v| v.is_finite())");
7653        debug_assert!(input.len() > 0,
7654            "Contract l2_norm_nondegeneracy: precondition violated — input.len() > 0");
7655    }};
7656}
7657
7658/// Preconditions for equation `nan_inf_rejection`.
7659/// Domain-specific. Call: `contract_pre_nan_inf_rejection!(slice_expr)`
7660macro_rules! contract_pre_nan_inf_rejection {
7661    () => {{}};
7662    ($input:expr) => {{
7663        let input = &$input;
7664        debug_assert!(input.len() > 0,
7665            "Contract nan_inf_rejection: precondition violated — input.len() > 0");
7666        debug_assert!(input.iter().all(|v| v.is_finite()),
7667            "Contract nan_inf_rejection: precondition violated — input.iter().all(|v| v.is_finite())");
7668    }};
7669}
7670
7671// Auto-generated from contracts/wgpu-resident-weights-v1.yaml — DO NOT EDIT
7672// Contract: wgpu-resident-weights-v1
7673
7674/// Preconditions for equation `identity`.
7675/// Domain-specific. Call: `contract_pre_identity!(slice_expr)`
7676macro_rules! contract_pre_identity {
7677    () => {{}};
7678    ($input:expr) => {{
7679        let x = &$input;
7680    }};
7681}
7682
7683// Total: 608 preconditions, 15 postconditions from 165 contracts