{"id":20124004,"url":"https://github.com/ricardoniepel/z3.linqbinding","last_synced_at":"2025-05-06T17:32:44.360Z","repository":{"id":31768403,"uuid":"35334676","full_name":"RicardoNiepel/Z3.LinqBinding","owner":"RicardoNiepel","description":"LINQ to Z3 - an esoteric LINQ binding based on Bart De Smet's idea","archived":false,"fork":false,"pushed_at":"2021-11-23T09:42:38.000Z","size":7460,"stargazers_count":14,"open_issues_count":1,"forks_count":7,"subscribers_count":8,"default_branch":"master","last_synced_at":"2023-10-20T22:49:21.584Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RicardoNiepel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-09T15:55:53.000Z","updated_at":"2023-09-30T16:47:32.000Z","dependencies_parsed_at":"2022-09-12T16:15:08.436Z","dependency_job_id":null,"html_url":"https://github.com/RicardoNiepel/Z3.LinqBinding","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RicardoNiepel%2FZ3.LinqBinding","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RicardoNiepel%2FZ3.LinqBinding/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RicardoNiepel%2FZ3.LinqBinding/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RicardoNiepel%2FZ3.LinqBinding/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RicardoNiepel","download_url":"https://codeload.github.com/RicardoNiepel/Z3.LinqBinding/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224517394,"owners_count":17324407,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T19:47:20.280Z","updated_at":"2024-11-13T19:47:21.053Z","avatar_url":"https://github.com/RicardoNiepel.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Z3.LinqBinding\nLINQ to Z3 - an esoteric LINQ binding based on Bart De Smet's idea\n\n## Original Idea\nIn 2009 Bart De Smet created a LINQ to Z3 binding and describes it in three blog posts\n* [EXPLORING THE Z3 THEOREM PROVER (WITH A BIT OF LINQ)](http://community.bartdesmet.net/blogs/bart/archive/2009/04/15/exploring-the-z3-theorem-prover-with-a-bit-of-linq.aspx)\n* [LINQ TO Z3 – THEOREM SOLVING ON STEROIDS – PART 0](http://community.bartdesmet.net/blogs/bart/archive/2009/04/19/linq-to-z3-theorem-solving-on-steroids-part-0.aspx)\n* [LINQ TO Z3 – THEOREM SOLVING ON STEROIDS – PART 1](http://community.bartdesmet.net/blogs/bart/archive/2009/09/27/linq-to-z3-theorem-solving-on-steroids-part-1.aspx)\n\n## This Version\nSince 2009 the Z3 Theorem Prover, initial from Microsoft Research, has changed:\n* new API versions with a lot of breaking changes\n* in March 2015 the licence has moved to MIT License and the source code to GitHub: https://github.com/Z3Prover/z3\n\nThis version of **Z3.LinqBinding** supports Z3 4.4.0.\u003cbr/\u003e\nAlso the sample code of a Sudoku theorem extension has been added: **Z3.LinqBinding.Sudoku**\n\n## Documentation\n\n### Basic Usage\n```C#\nusing (var ctx = new Z3Context())\n{\n    ctx.Log = Console.Out; // see internal logging\n\n    var theorem = from t in ctx.NewTheorem(new { x = default(bool), y = default(bool) })\n                  where t.x ^ t.y\n                  select t;\n\n    var result = theorem.Solve();\n    Console.WriteLine(result);\n}\n```\n\n**Output:**\n```\n(xor x y)\n{ x = True, y = False }\n```\n\n### Advanced Usage\nYou can use build in or custom symbol classes.\u003cbr/\u003e\nCurrently only bool and integer theorems are supported.\n\n```C#\nusing (var ctx = new Z3Context())\n{\n    ctx.Log = Console.Out; // see internal logging\n\n    var theorem = from t in ctx.NewTheorem\u003cSymbols\u003cint, int\u003e\u003e()\n                  where t.X1 \u003c t.X2 + 1\n                  where t.X1 \u003e 2\n                  where t.X1 != t.X2\n                  select t;\n\n    var result = theorem.Solve();\n    Console.WriteLine(result);\n}\n```\n\n**Output:**\n```\n(\u003c X1 (+ X2 1))\n(\u003e X1 2)\n(not (= X1 X2))\n{X1 = 3, X2 = 4}\n```\n\n### Sudoku Extension Usage (Z3.LinqBinding.Sudoku)\n```C#\nusing (var ctx = new Z3Context())\n{\n    var theorem = from t in SudokuTheorem.Create(ctx)\n                  where t.Cell13 == 2 \u0026\u0026 t.Cell16 == 1 \u0026\u0026 t.Cell18 == 6\n                  where t.Cell23 == 7 \u0026\u0026 t.Cell26 == 4\n                  where t.Cell31 == 5 \u0026\u0026 t.Cell37 == 9\n                  where t.Cell42 == 1 \u0026\u0026 t.Cell44 == 3\n                  where t.Cell51 == 8 \u0026\u0026 t.Cell55 == 5 \u0026\u0026 t.Cell59 == 4\n                  where t.Cell66 == 6 \u0026\u0026 t.Cell68 == 2\n                  where t.Cell73 == 6 \u0026\u0026 t.Cell79 == 7\n                  where t.Cell84 == 8 \u0026\u0026 t.Cell87 == 3\n                  where t.Cell92 == 4 \u0026\u0026 t.Cell94 == 9 \u0026\u0026 t.Cell97 == 2\n                  select t;\n\n    var result = theorem.Solve();\n    Console.WriteLine(result);\n}\n```\n\n**Output:**\n```\n-------------------------------\n| 4  3  2 | 5  9  1 | 7  6  8 |\n|         |         |         |\n| 9  6  7 | 2  8  4 | 1  3  5 |\n|         |         |         |\n| 5  8  1 | 6  7  3 | 9  4  2 |\n-------------------------------\n| 6  1  4 | 3  2  8 | 5  7  9 |\n|         |         |         |\n| 8  2  3 | 7  5  9 | 6  1  4 |\n|         |         |         |\n| 7  5  9 | 4  1  6 | 8  2  3 |\n-------------------------------\n| 2  9  6 | 1  3  5 | 4  8  7 |\n|         |         |         |\n| 1  7  5 | 8  4  2 | 3  9  6 |\n|         |         |         |\n| 3  4  8 | 9  6  7 | 2  5  1 |\n-------------------------------\n```\n\n### Blog Posts\n* [May 9 2015 - Z3.LinqBinding released](http://blogs.msdn.com/b/riwickel/archive/2015/05/09/z3-linqbinding-released.aspx)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fricardoniepel%2Fz3.linqbinding","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fricardoniepel%2Fz3.linqbinding","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fricardoniepel%2Fz3.linqbinding/lists"}