Commit fe79724
committed
Support Rust syntax in thrust::predicate bodies
Predicate bodies can be written as ordinary Rust boolean expressions instead
of raw SMT-LIB2 string literals, reusing the formula_fn translation pipeline.
A predicate whose body is a Rust expression is emitted with an additional
#[thrust::formula_fn] attribute; that attribute is the discriminator. When
present, the body is translated through the formula_fns cache and the
resulting chc::Formula is emitted as the predicate's SMT define-fun. Raw SMT2
string bodies still work unchanged.
Rendering of a translated predicate formula goes through a new TermSortEnv
trait (implemented for Clause and IndexVec<TermVarIdx, Sort>) instead of a
fabricated Clause, so the smtlib2 Display wrappers hold &dyn TermSortEnv.
Trait/struct predicates use named field access (self.x), relying on the
named-field resolution already in main (#118).
https://claude.ai/code/session_01WdLyxyy4ieAxrexj83X5MX1 parent af7cd99 commit fe79724
13 files changed
Lines changed: 266 additions & 140 deletions
File tree
- src
- analyze
- chc
- tests/ui
- fail
- pass
- thrust-macros/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
93 | 103 | | |
94 | 104 | | |
95 | 105 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
63 | 97 | | |
64 | 98 | | |
65 | 99 | | |
| |||
88 | 122 | | |
89 | 123 | | |
90 | 124 | | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | 125 | | |
98 | 126 | | |
99 | 127 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1918 | 1918 | | |
1919 | 1919 | | |
1920 | 1920 | | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
1921 | 1932 | | |
1922 | 1933 | | |
1923 | | - | |
| 1934 | + | |
| 1935 | + | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
1924 | 1947 | | |
1925 | 1948 | | |
1926 | 1949 | | |
| |||
1980 | 2003 | | |
1981 | 2004 | | |
1982 | 2005 | | |
| 2006 | + | |
| 2007 | + | |
| 2008 | + | |
| 2009 | + | |
| 2010 | + | |
| 2011 | + | |
| 2012 | + | |
| 2013 | + | |
| 2014 | + | |
| 2015 | + | |
| 2016 | + | |
1983 | 2017 | | |
1984 | 2018 | | |
1985 | 2019 | | |
1986 | 2020 | | |
1987 | | - | |
| 2021 | + | |
1988 | 2022 | | |
1989 | 2023 | | |
1990 | 2024 | | |
| |||
2012 | 2046 | | |
2013 | 2047 | | |
2014 | 2048 | | |
2015 | | - | |
2016 | | - | |
| 2049 | + | |
| 2050 | + | |
| 2051 | + | |
| 2052 | + | |
| 2053 | + | |
| 2054 | + | |
| 2055 | + | |
| 2056 | + | |
| 2057 | + | |
| 2058 | + | |
| 2059 | + | |
| 2060 | + | |
| 2061 | + | |
| 2062 | + | |
| 2063 | + | |
| 2064 | + | |
| 2065 | + | |
| 2066 | + | |
2017 | 2067 | | |
2018 | 2068 | | |
2019 | 2069 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
0 commit comments