# Qwen format probe 4 — annotated parens `(#N ... #N)`

**Model:** meta-llama/Meta-Llama-3.1-405B-Instruct-FP8; single-shot per level; annotated-paren dialect; output stripped via round-trip-verified converter then ail-checked.

---

## L0_const — ✅ green

tokens: prompt=695 completion=75

annotated output:
```
(#0 module m
  (#1 fn answer
    (#2 type (#3 fn-type (#4 params #4) (#4 ret (#5 own (#6 con Int #6) #5) #4) #3) #2)
    (#2 params #2)
    (#2 body 42 #2) #1) #0)
```

stripped to Form-A:
```
(module m
  (fn answer
    (type (fn-type (params) (ret (own (con Int)))))
    (params)
    (body 42)))
```


## L1_arith — ❌ check

tokens: prompt=698 completion=103

annotated output:
```
(#0 module m
  (#1 fn triple
    (#2 type (#3 fn-type (#4 params (#5 own (#6 con Int #6) #5) #4) (#4 ret (#5 own (#6 con Int #6) #5) #4) #3) #2)
    (#2 params x #2)
    (#2 body (#3 app * x (#4 lit 3 #4) #3) #2) #1) #0)
```

stripped to Form-A:
```
(module m
  (fn triple
    (type (fn-type (params (own (con Int))) (ret (own (con Int)))))
    (params x)
    (body (app * x (lit 3)))))
```

**`ail check`:**
```
error: [surface-parse-error] parse error in term: unknown term head `lit`; expected one of `app`, `tail-app`, `lam`, `let`, `let-rec`, `if`, `match`, `do`, `tail-do`, `seq`, `term-ctor`, `clone`, `reuse-as`, `loop`, `recur`, `new`, `lit-unit` at byte 125
```

## L2_print — ✅ green

tokens: prompt=693 completion=107

annotated output:
```
(#0 module m
  (#1 fn main
    (#2 type (#3 fn-type (#4 params #4) (#4 ret (#5 own (#6 con Unit #6) #5) #4) (#4 effects IO #4) #3) #2)
    (#2 params #2)
    (#2 body (#3 seq (#4 app print 7 #4) (#4 do io/print_str "\n" #4) #3) #2) #1) #0)
```

stripped to Form-A:
```
(module m
  (fn main
    (type (fn-type (params) (ret (own (con Unit))) (effects IO)))
    (params)
    (body (seq (app print 7) (do io/print_str "\n")))))
```


## L3_adt — ✅ green

tokens: prompt=712 completion=155

annotated output:
```
(#0 module m
  (#1 data Light (#2 ctor Red #2) (#2 ctor Green #2) #1)
  (#1 fn code
    (#2 type (#3 fn-type (#4 params (#5 own (#6 con Light #6) #5) #4) (#4 ret (#5 own (#6 con Int #6) #5) #4) #3) #2)
    (#2 params x #2)
    (#2 body
      (#3 match x
        (#4 case (#5 pat-ctor Red #5) 0 #4)
        (#4 case (#5 pat-ctor Green #5) 1 #4) #3) #2) #1) #0)
```

stripped to Form-A:
```
(module m
  (data Light (ctor Red) (ctor Green))
  (fn code
    (type (fn-type (params (own (con Light))) (ret (own (con Int)))))
    (params x)
    (body
      (match x
        (case (pat-ctor Red) 0)
        (case (pat-ctor Green) 1)))))
```


## L4_rec — ✅ green

tokens: prompt=724 completion=351

annotated output:
```
(#0 module m
  (#1 data IntList (#2 ctor Nil #2) (#2 ctor Cons (#3 con Int #3) (#3 con IntList #3) #2) #1)
  (#1 fn length
    (#2 type (#3 fn-type (#4 params (#5 own (#6 con IntList #6) #5) #4) (#4 ret (#5 own (#6 con Int #6) #5) #4) #3) #2)
    (#2 params xs #2)
    (#2 body
      (#3 match xs
        (#4 case (#5 pat-ctor Nil #5) 0 #4)
        (#4 case (#5 pat-ctor Cons _ t #5) (#5 app + 1 (#6 app length t #6) #5) #4) #3) #2) #1)
  (#1 fn main
    (#2 type (#3 fn-type (#4 params #4) (#4 ret (#5 own (#6 con Unit #6) #5) #4) (#4 effects IO #4) #3) #2)
    (#2 params #2)
    (#2 body
      (#3 let xs (#4 term-ctor IntList Cons 1 (#5 term-ctor IntList Cons 2 (#6 term-ctor IntList Cons 3 (#7 term-ctor IntList Nil #7) #6) #5) #4)
        (#4 seq (#5 app print (#6 app length xs #6) #5) (#5 do io/print_str "\n" #5) #4) #3) #2) #1) #0)
```

stripped to Form-A:
```
(module m
  (data IntList (ctor Nil) (ctor Cons (con Int) (con IntList)))
  (fn length
    (type (fn-type (params (own (con IntList))) (ret (own (con Int)))))
    (params xs)
    (body
      (match xs
        (case (pat-ctor Nil) 0)
        (case (pat-ctor Cons _ t) (app + 1 (app length t))))))
  (fn main
    (type (fn-type (params) (ret (own (con Unit))) (effects IO)))
    (params)
    (body
      (let xs (term-ctor IntList Cons 1 (term-ctor IntList Cons 2 (term-ctor IntList Cons 3 (term-ctor IntList Nil))))
        (seq (app print (app length xs)) (do io/print_str "\n"))))))
```


## L5_series_len — ✅ green

tokens: prompt=985 completion=209

annotated output:
```
(#0 module m
  (#1 fn main
    (#2 type (#3 fn-type (#4 params #4) (#4 ret (#5 own (#6 con Unit #6) #5) #4) (#4 effects IO #4) #3) #2)
    (#2 params #2)
    (#2 body
      (#3 let s (#4 new Series (#5 con Float #5) 3 #4)
        (#4 let s2 (#5 app Series.push s 1.0 #5)
          (#5 let s3 (#6 app Series.push s2 2.0 #6)
            (#6 let s4 (#7 app Series.push s3 3.0 #7)
              (#7 seq (#8 app print (#9 app Series.len s4 #9) #8) (#8 do io/print_str "\n" #8) #7) #6) #5) #4) #3) #2) #1) #0)
```

stripped to Form-A:
```
(module m
  (fn main
    (type (fn-type (params) (ret (own (con Unit))) (effects IO)))
    (params)
    (body
      (let s (new Series (con Float) 3)
        (let s2 (app Series.push s 1.0)
          (let s3 (app Series.push s2 2.0)
            (let s4 (app Series.push s3 3.0)
              (seq (app print (app Series.len s4)) (do io/print_str "\n")))))))))
```


## L6_series_at — ✅ green

tokens: prompt=993 completion=211

annotated output:
```
(#0 module m
  (#1 fn main
    (#2 type (#3 fn-type (#4 params #4) (#4 ret (#5 own (#6 con Unit #6) #5) #4) (#4 effects IO #4) #3) #2)
    (#2 params #2)
    (#2 body
      (#3 let s (#4 new Series (#5 con Float #5) 3 #4)
        (#4 let s2 (#5 app Series.push s 1.0 #5)
          (#5 let s3 (#6 app Series.push s2 2.0 #6)
            (#6 let s4 (#7 app Series.push s3 3.0 #7)
              (#7 seq (#8 app print (#9 app Series.at s4 0 #9) #8) (#8 do io/print_str "\n" #8) #7) #6) #5) #4) #3) #2) #1) #0)
```

stripped to Form-A:
```
(module m
  (fn main
    (type (fn-type (params) (ret (own (con Unit))) (effects IO)))
    (params)
    (body
      (let s (new Series (con Float) 3)
        (let s2 (app Series.push s 1.0)
          (let s3 (app Series.push s2 2.0)
            (let s4 (app Series.push s3 3.0)
              (seq (app print (app Series.at s4 0)) (do io/print_str "\n")))))))))
```


## L7_sma — ❌ check

tokens: prompt=1065 completion=678

annotated output:
```
(#0 module m
  (#1 fn main
    (#2 type (#3 fn-type (#4 params #4) (#4 ret (#5 own (#6 con Unit #6) #5) #4) (#4 effects IO #4) #3) #2)
    (#2 params #2)
    (#2 body
      (#3 let s (#4 new Series (#5 con Float #5) 3 #4)
        (#4 let s1 (#5 app Series.push s 1.0 #5)
          (#5 let s2 (#6 app Series.push s1 5.0 #6)
            (#6 let s3 (#7 app Series.push s2 3.0 #7)
              (#7 seq
                (#8 let sum (#9 app + (#10 app Series.at s3 0 #10) (#10 app + (#11 app Series.at s3 1 #11) (#11 app Series.at s3 2 #11) #10) #9)
                  (#9 do io/print_str (#10 app show_float (#11 app / sum 3.0 #11) #10) #9)
                  (#9 do io/print_str "\n" #9) #8)
                (#8 let s4 (#9 app Series.push s3 8.0 #9)
                  (#9 let sum (#10 app + (#11 app Series.at s4 0 #11) (#11 app + (#12 app Series.at s4 1 #12) (#12 app Series.at s4 2 #12) #11) #10)
                    (#10 seq
                      (#11 do io/print_str (#12 app show_float (#13 app / sum 3.0 #13) #12) #11)
                      (#11 do io/print_str "\n" #11) #10) #9) #8)
                (#8 let s5 (#9 app Series.push s4 6.0 #9)
                  (#9 let sum (#10 app + (#11 app Series.at s5 0 #11) (#11 app + (#12 app Series.at s5 1 #12) (#12 app Series.at s5 2 #12) #11) #10)
                    (#10 seq
                      (#11 do io/print_str (#12 app show_float (#13 app / sum 3.0 #13) #12) #11)
                      (#11 do io/print_str "\n" #11) #10) #9) #8)
                (#8 let s6 (#9 app Series.push s5 2.0 #9)
                  (#9 let sum (#10 app + (#11 app Series.at s6 0 #11) (#11 app + (#12 app Series.at s6 1 #12) (#12 app Series.at s6 2 #12) #11) #10)
                    (#10 seq
                      (#11 do io/print_str (#12 app show_float (#13 app / sum 3.0 #13) #12) #11)
                      (#11 do io/print_str "\n" #11) #10) #9) #8) #7) #6) #5) #4) #3) #2) #1) #0)
```

stripped to Form-A:
```
(module m
  (fn main
    (type (fn-type (params) (ret (own (con Unit))) (effects IO)))
    (params)
    (body
      (let s (new Series (con Float) 3)
        (let s1 (app Series.push s 1.0)
          (let s2 (app Series.push s1 5.0)
            (let s3 (app Series.push s2 3.0)
              (seq
                (let sum (app + (app Series.at s3 0) (app + (app Series.at s3 1) (app Series.at s3 2)))
                  (do io/print_str (app show_float (app / sum 3.0)))
                  (do io/print_str "\n"))
                (let s4 (app Series.push s3 8.0)
                  (let sum (app + (app Series.at s4 0) (app + (app Series.at s4 1) (app Series.at s4 2)))
                    (seq
                      (do io/print_str (app show_float (app / sum 3.0)))
                      (do io/print_str "\n"))))
                (let s5 (app Series.push s4 6.0)
                  (let sum (app + (app Series.at s5 0) (app + (app Series.at s5 1) (app Series.at s5 2)))
                    (seq
                      (do io/print_str (app show_float (app / sum 3.0)))
                      (do io/print_str "\n"))))
                (let s6 (app Series.push s5 2.0)
                  (let sum (app + (app Series.at s6 0) (app + (app Series.at s6 1) (app Series.at s6 2)))
                    (seq
                      (do io/print_str (app show_float (app / sum 3.0)))
                      (do io/print_str "\n"))))))))))))
```

**`ail check`:**
```
error: [surface-parse-error] parse error: expected `)` (end of let-term), got `(` at byte 488
```


---
## Ladder

- L0_const: ✅ green
- L1_arith: ❌ check
- L2_print: ✅ green
- L3_adt: ✅ green
- L4_rec: ✅ green
- L5_series_len: ✅ green
- L6_series_at: ✅ green
- L7_sma: ❌ check