File size: 2,089 Bytes
9d29c62
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# verify_curriculum_compliance.py
import asyncio
import sys
import os

# Add current directory to path
sys.path.append(os.getcwd())

from orchestrator import BuddyOrchestrator
from proof_graph import ProofStep, ProofGraph, validate_pedagogical_legality
import curriculum_engine

async def test_grade_7_violation():
    print("🧪 Testing Grade 7 Violation (Equation Systems)...")
    orchestrator = BuddyOrchestrator()
    
    # Mock data: Grade 7 student
    grade = "7"
    level = "4"
    problem_text = "פתור את מערכת המשוואות: x+y=10, x-y=2"
    
    # 1. Fetch rules
    rules = curriculum_engine.get_allowed_math_operators(grade, level)
    print(f"📋 Rules for Grade 7: Forbidden={rules['forbidden']}")
    
    # 2. Mock a "bad" ProofGraph that uses SYSTEM_OF_EQUATIONS
    bad_steps = [
        ProofStep(1, "x+y=10, x-y=2", "Original System"),
        ProofStep(2, "x=6, y=4", "Solved System", operator_used="SYSTEM_OF_EQUATIONS")
    ]
    bad_graph = ProofGraph(bad_steps)
    
    # 3. Validate
    is_legal, reason = validate_pedagogical_legality(bad_graph, rules)
    
    if not is_legal:
        print(f"✅ Success: Pedagogy Guard correctly REJECTED Grade 7 system solver. Reason: {reason}")
    else:
        print("❌ Failure: Pedagogy Guard ALLOWED forbidden operator.")

async def test_grade_8_allowed():
    print("\n🧪 Testing Grade 8 Allowed (Equation Systems)...")
    grade = "8"
    rules = curriculum_engine.get_allowed_math_operators(grade)
    
    steps = [
        ProofStep(1, "x+y=10, x-y=2", "Original System"),
        ProofStep(2, "x=6, y=4", "Solved System", operator_used="SYSTEM_OF_EQUATIONS")
    ]
    graph = ProofGraph(steps)
    
    is_legal, reason = validate_pedagogical_legality(graph, rules)
    
    if is_legal:
        print(f"✅ Success: Pedagogy Guard correctly ALLOWED Grade 8 system solver.")
    else:
        print(f"❌ Failure: Pedagogy Guard REJECTED allowed operator. Reason: {reason}")

if __name__ == "__main__":
    asyncio.run(test_grade_7_violation())
    asyncio.run(test_grade_8_allowed())