{"data":{"kind":"file","path":"README.md","version_id":"r6x60zkeqd7x8fksk3138u91","entry":{"name":"README.md","path":"README.md","is_directory":false,"size":3592,"modified_at":"2026-09-26T03:52:03.785000","content_hash":"7ad49e5de48b31200105b0d60ce6737b37ad928167237dd83c8ef0c3b51331cf"},"entries":[],"content":"# and-operator\n\n**Bitwise AND & Logical AND Mastery — v0.10.0**\n\nA `verifiers` single-turn environment that trains and evaluates exact reasoning\naround the AND operator in all its forms: bitwise AND (`&`), mask application,\nbit clearing (`n & (n - 1)`), power-of-two detection, Kernighan loop iteration\ncounts, permission-flag extraction, IPv4 subnet matching, and Python's logical\n`and` with short-circuit evaluation.\n\nEvery task has an **exactly verifiable answer** (a number, a `0b`/`0x` literal,\nor Yes/No), so scoring is deterministic and cannot be gamed by keyword stuffing.\n\n## Task Types\n\n| Type | Difficulty | Example task | Answer form |\n|------|-----------|--------------|-------------|\n| `decimal_and` | 1 | Compute `173 & 99` | decimal int |\n| `binary_and` | 1 | `0b10101101 & 0b11001011` in binary | `0b...` |\n| `logical_and_value` | 1 | Python `x and y` with given truthiness | exact value |\n| `hex_mask` | 2 | Apply bitmask `0x0FF0` to a register | `0x...` |\n| `clear_lowest_set_bit` | 2 | One pass of `n = n & (n - 1)` | decimal int |\n| `clear_bit_k` | 2 | `n & ~(1 << k)` | decimal int |\n| `power_of_two` | 2 | `(n & (n - 1)) == 0` identity | Yes/No |\n| `flag_extraction` | 2 | Is mask bit set in a permission byte? | Yes/No |\n| `kernighan_iterations` | 3 | Iterations of `while n: n &= n - 1` | decimal int |\n| `subnet_match` | 3 | Do two IPv4 addresses share a /26 network? | Yes/No |\n| `short_circuit` | 3 | Does `x != 0 and 10 / x > 1` raise? | Yes/No |\n\n## Dataset\n\n60 procedurally generated tasks (6 per type), deterministic under seed 42.\nEach row carries `prompt` (user message), `answer`, `task_type`, and\n`difficulty`, so reward functions and analyses can slice by category.\n\n## Scoring\n\n| Metric | Weight | What it measures |\n|--------|--------|------------------|\n| `answer_correct` | 0.85 | Exact final answer match (numeric-aware) |\n| `final_answer_format` | 0.05 | Ends with `Answer: <value>` as instructed |\n| `reasoning_evidence` | 0.10 | Multi-signal work shown (see below) |\n\n**`answer_correct`** extracts the value after `Answer:` (falling back to the\nlast line) and compares intelligently:\n\n- integer comparison across notations — `53`, `0x35`, `0b110101` are equal;\n- Yes/No accepts `y`/`true`/`n`/`false` equivalents;\n- leading-zero bare binaries (`0101`) are compared bit-for-bit;\n- empty completions and malformed values score 0.0.\n\n**`reasoning_evidence`** is the average of three independent sub-signals, so a\nsingle trick cannot max it out:\n\n1. a numeric representation appears (`0b...`, `0x...`, or a run of 6+ binary digits);\n2. the AND operation is actually referenced (`&`, \"bitwise\", \"logical and\", `` `and` ``);\n3. the response has substance (25+ tokens).\n\n## Design Notes\n\n- Scoring functions are `async`, guard against empty/None completions, use\n  `.get(\"content\", \"\")`, and always return floats in `[0, 1]`.\n- No keyword-based correctness checks: the true metric is the exact answer,\n  which cannot be satisfied without solving the task.\n- The system prompt contains no hidden-reward hints — it only specifies the\n  response format, keeping the evaluation clean.\n\n## Usage\n\n```python\nimport verifiers as vf\n\nenv = vf.load_environment(\"and-operator\")\n# or locally:\nfrom and_operator import load_environment\nenv = load_environment()            # full 60-row dataset\nenv = load_environment(num_examples=12)  # subset for smoke tests\n```\n\n```bash\nprime eval run OWNER/and-operator -m Qwen/Qwen3.5-0.8B\n```\n\n## Version\n\n0.10.0 — initial published release: 11 task types, 60 tasks, 3-metric rubric\nwith numeric-aware answer matching.\n","encoding":"utf-8","truncated":false,"total_bytes":3592},"status":null}