nx_cuad_gate.nx source
↩ module page · 75 lines · 5973 B
1// nx_cuad_gate.nx -- INDEPENDENT GATE: the CUAD 41-type taxonomy, on real clause text.
2// INHERITS nx_gate_verdict (D001): counters, PASS/FAIL vector, verdict line and the harness.jrnl frame
3// all come from the base class, so nx_gate_green can judge this gate and its flake/erosion is visible.
4// A gate that rolls its own verdict is unreadable to the harness -- it can be green forever and nothing
5// downstream can tell.
6//
7// The teeth:
8// u2605u2605COVERAGE CANNOT BE SELF-FLATTERED: 41 types are declared but coverage is scored ONLY against the
9// CUED subset, so adding a constant can never raise a number.
10// u2605u2605BITE-PROVEN CONTRADICTION: the cap-vs-uncapped check must FIRE on a contract asserting both and
11// stay SILENT on one asserting only a cap -- a detector green before the defect exists proves nothing.
12// u2605UNCLASSIFIABLE IS UNKNOWN, never the nearest type.
13// license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0
14
15import "nx_cuad_lib.nx"
16import "nx_gate_verdict.nx"
17
18func main(argc: i64, argv: *i64) -> i64 {
19 let ctr: *i64 = gv_ctr()
20 gv_head("NISHI-CUAD-GATE (41-type taxonomy; coverage scored against CUED types only)" as *u8)
21
22 let c_gov: *u8 = "This agreement shall be governed by the laws of Delaware" as *u8
23 let c_escrow: *u8 = "Licensor shall deposit the source code into escrow with a neutral agent" as *u8
24 let c_mfn: *u8 = "Supplier grants Buyer most favored nation pricing on all future orders" as *u8
25 let c_uncap: *u8 = "Customer bears unlimited exposure for any breach of this section" as *u8
26 let c_cap: *u8 = "Total liability shall not exceed the aggregate fees paid in twelve months" as *u8
27 let c_both: *u8 = "Total liability shall not exceed the aggregate fees paid except that Customer bears unlimited exposure for confidentiality breaches" as *u8
28 let c_alien: *u8 = "The parties shall meet quarterly at a mutually convenient location" as *u8
29 let c_rich: *u8 = "This agreement is governed by Delaware law, grants an exclusive license, permits audit of records, requires insurance, and provides for liquidated damages upon a merger" as *u8
30
31 // ---- D: the denominator is honest ----
32 gv_check("D1 taxonomy declares all 41 CUAD types" as *u8, cuad_declared_count() == 41, ctr)
33 gv_check("D2 only 20 are actually CUED" as *u8, cuad_cued_count() == 20, ctr)
34 gv_check("D3 declared EXCEEDS cued -- the gap is reported not hidden" as *u8, cuad_declared_count() > cuad_cued_count(), ctr)
35 gv_check("D4 the uncued gap is 21 types" as *u8, cuad_uncued_count() == 21, ctr)
36 gv_check("D5 declared = cued + uncued (the partition sums)" as *u8, (cuad_cued_count() + cuad_uncued_count()) == 41, ctr)
37
38 // ---- U: a merely-DECLARED type can never contribute ----
39 gv_check("U1 joint-IP-ownership is declared" as *u8, CU_JOINT_IP_OWNERSHIP < CUAD_DECLARED, ctr)
40 gv_check("U2 but is NOT cued" as *u8, cuad_is_cued(CU_JOINT_IP_OWNERSHIP) == 0, ctr)
41 gv_check("U3 so it can never fire, whatever the text" as *u8, cuad_cue_hit(c_rich, CU_JOINT_IP_OWNERSHIP) == 0, ctr)
42 gv_check("U4 document-name likewise declared but uncued" as *u8, cuad_is_cued(CU_DOCUMENT_NAME) == 0, ctr)
43
44 // ---- C: classification ----
45 gv_check("C1 governing-law clause classifies" as *u8, cuad_classify(c_gov) == CU_GOVERNING_LAW, ctr)
46 gv_check("C2 source-code-escrow clause classifies" as *u8, cuad_classify(c_escrow) == CU_SOURCE_CODE_ESCROW, ctr)
47 gv_check("C3 MFN clause classifies" as *u8, cuad_classify(c_mfn) == CU_MOST_FAVORED_NATION, ctr)
48 gv_check("C4 unclassifiable clause is UNKNOWN not nearest-type" as *u8, cuad_classify(c_alien) == CUAD_UNKNOWN, ctr)
49 gv_check("C5 empty text is UNKNOWN" as *u8, cuad_classify("" as *u8) == CUAD_UNKNOWN, ctr)
50
51 // ---- X: the contradiction, BITE-PROVEN (fires on both-asserted, silent on cap-only) ----
52 gv_check("X1 uncapped clause fires its cue" as *u8, cuad_cue_hit(c_uncap, CU_UNCAPPED_LIABILITY) == 1, ctr)
53 gv_check("X2 capped clause fires its own distinct cue" as *u8, cuad_cue_hit(c_cap, CU_CAP_ON_LIABILITY) == 1, ctr)
54 gv_bite("X3 cap-vs-uncapped contradiction detector" as *u8, cuad_liability_contradiction(c_both), cuad_liability_contradiction(c_cap), ctr)
55 gv_check("X4 uncapped alone is not a contradiction" as *u8, cuad_liability_contradiction(c_uncap) == 0, ctr)
56 gv_check("X5 unrelated clause is not a contradiction" as *u8, cuad_liability_contradiction(c_alien) == 0, ctr)
57
58 // ---- V: coverage ----
59 gv_check("V1 alien paragraph addresses no CUAD types" as *u8, cuad_types_present(c_alien) == 0, ctr)
60 gv_check("V2 and scores zero coverage" as *u8, cuad_coverage_permille(c_alien) == 0, ctr)
61 gv_check("V3 single-topic clause addresses exactly one" as *u8, cuad_types_present(c_escrow) == 1, ctr)
62 gv_check("V4 rich contract addresses seven cued types" as *u8, cuad_types_present(c_rich) == 7, ctr)
63 gv_check("V5 coverage = 7/20 = 350 permille" as *u8, cuad_coverage_permille(c_rich) == 350, ctr)
64 gv_check("V6 coverage scored on 20 CUED not 41 declared" as *u8, cuad_coverage_permille(c_rich) != ((cuad_types_present(c_rich) * 1000) / 41), ctr)
65
66 // ---- H: the high-risk subset ----
67 gv_check("H1 uncapped liability is high risk" as *u8, cuad_is_high_risk(CU_UNCAPPED_LIABILITY) == 1, ctr)
68 gv_check("H2 MFN is high risk" as *u8, cuad_is_high_risk(CU_MOST_FAVORED_NATION) == 1, ctr)
69 gv_check("H3 insurance is not high risk" as *u8, cuad_is_high_risk(CU_INSURANCE) == 0, ctr)
70 gv_check("H4 plain governing-law raises no high-risk hit" as *u8, cuad_high_risk_present(c_gov) == 0, ctr)
71 gv_check("H5 escrow clause does" as *u8, cuad_high_risk_present(c_escrow) == 1, ctr)
72 gv_check("H6 rich contract raises two high-risk hits" as *u8, cuad_high_risk_present(c_rich) == 2, ctr)
73
74 return gv_verdict("CUAD-TAXONOMY" as *u8, ctr, "41 declared / 20 cued, coverage on cued only; cap-vs-uncap contradiction bite-proven" as *u8)
75}