summaryrefslogtreecommitdiff
path: root/tests/lean/Constants.lean
blob: 8086442712183510e745bbfebddb2ab3aa14a6f7 (plain)
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
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
-- THIS FILE WAS AUTOMATICALLY GENERATED BY AENEAS
-- [constants]
import Base
open Primitives

namespace constants

/- [constants::X0]
   Source: 'src/constants.rs', lines 5:0-5:17 -/
def x0_body : Result U32 := Result.ret 0#u32
def x0_c : U32 := eval_global x0_body (by simp)

/- [constants::X1]
   Source: 'src/constants.rs', lines 7:0-7:17 -/
def x1_body : Result U32 := Result.ret core_u32_max
def x1_c : U32 := eval_global x1_body (by simp)

/- [constants::X2]
   Source: 'src/constants.rs', lines 10:0-10:17 -/
def x2_body : Result U32 := Result.ret 3#u32
def x2_c : U32 := eval_global x2_body (by simp)

/- [constants::incr]: forward function
   Source: 'src/constants.rs', lines 17:0-17:32 -/
def incr (n : U32) : Result U32 :=
  n + 1#u32

/- [constants::X3]
   Source: 'src/constants.rs', lines 15:0-15:17 -/
def x3_body : Result U32 := incr 32#u32
def x3_c : U32 := eval_global x3_body (by simp)

/- [constants::mk_pair0]: forward function
   Source: 'src/constants.rs', lines 23:0-23:51 -/
def mk_pair0 (x : U32) (y : U32) : Result (U32 × U32) :=
  Result.ret (x, y)

/- [constants::Pair]
   Source: 'src/constants.rs', lines 36:0-36:23 -/
structure Pair (T1 T2 : Type) where
  x : T1
  y : T2

/- [constants::mk_pair1]: forward function
   Source: 'src/constants.rs', lines 27:0-27:55 -/
def mk_pair1 (x : U32) (y : U32) : Result (Pair U32 U32) :=
  Result.ret { x := x, y := y }

/- [constants::P0]
   Source: 'src/constants.rs', lines 31:0-31:24 -/
def p0_body : Result (U32 × U32) := mk_pair0 0#u32 1#u32
def p0_c : (U32 × U32) := eval_global p0_body (by simp)

/- [constants::P1]
   Source: 'src/constants.rs', lines 32:0-32:28 -/
def p1_body : Result (Pair U32 U32) := mk_pair1 0#u32 1#u32
def p1_c : Pair U32 U32 := eval_global p1_body (by simp)

/- [constants::P2]
   Source: 'src/constants.rs', lines 33:0-33:24 -/
def p2_body : Result (U32 × U32) := Result.ret (0#u32, 1#u32)
def p2_c : (U32 × U32) := eval_global p2_body (by simp)

/- [constants::P3]
   Source: 'src/constants.rs', lines 34:0-34:28 -/
def p3_body : Result (Pair U32 U32) := Result.ret { x := 0#u32, y := 1#u32 }
def p3_c : Pair U32 U32 := eval_global p3_body (by simp)

/- [constants::Wrap]
   Source: 'src/constants.rs', lines 49:0-49:18 -/
structure Wrap (T : Type) where
  value : T

/- [constants::{constants::Wrap<T>}::new]: forward function
   Source: 'src/constants.rs', lines 54:4-54:41 -/
def Wrap.new (T : Type) (value : T) : Result (Wrap T) :=
  Result.ret { value := value }

/- [constants::Y]
   Source: 'src/constants.rs', lines 41:0-41:22 -/
def y_body : Result (Wrap I32) := Wrap.new I32 2#i32
def y_c : Wrap I32 := eval_global y_body (by simp)

/- [constants::unwrap_y]: forward function
   Source: 'src/constants.rs', lines 43:0-43:30 -/
def unwrap_y : Result I32 :=
  Result.ret y_c.value

/- [constants::YVAL]
   Source: 'src/constants.rs', lines 47:0-47:19 -/
def yval_body : Result I32 := unwrap_y
def yval_c : I32 := eval_global yval_body (by simp)

/- [constants::get_z1::Z1]
   Source: 'src/constants.rs', lines 62:4-62:17 -/
def get_z1_z1_body : Result I32 := Result.ret 3#i32
def get_z1_z1_c : I32 := eval_global get_z1_z1_body (by simp)

/- [constants::get_z1]: forward function
   Source: 'src/constants.rs', lines 61:0-61:28 -/
def get_z1 : Result I32 :=
  Result.ret get_z1_z1_c

/- [constants::add]: forward function
   Source: 'src/constants.rs', lines 66:0-66:39 -/
def add (a : I32) (b : I32) : Result I32 :=
  a + b

/- [constants::Q1]
   Source: 'src/constants.rs', lines 74:0-74:17 -/
def q1_body : Result I32 := Result.ret 5#i32
def q1_c : I32 := eval_global q1_body (by simp)

/- [constants::Q2]
   Source: 'src/constants.rs', lines 75:0-75:17 -/
def q2_body : Result I32 := Result.ret q1_c
def q2_c : I32 := eval_global q2_body (by simp)

/- [constants::Q3]
   Source: 'src/constants.rs', lines 76:0-76:17 -/
def q3_body : Result I32 := add q2_c 3#i32
def q3_c : I32 := eval_global q3_body (by simp)

/- [constants::get_z2]: forward function
   Source: 'src/constants.rs', lines 70:0-70:28 -/
def get_z2 : Result I32 :=
  do
    let i  get_z1
    let i0  add i q3_c
    add q1_c i0

/- [constants::S1]
   Source: 'src/constants.rs', lines 80:0-80:18 -/
def s1_body : Result U32 := Result.ret 6#u32
def s1_c : U32 := eval_global s1_body (by simp)

/- [constants::S2]
   Source: 'src/constants.rs', lines 81:0-81:18 -/
def s2_body : Result U32 := incr s1_c
def s2_c : U32 := eval_global s2_body (by simp)

/- [constants::S3]
   Source: 'src/constants.rs', lines 82:0-82:29 -/
def s3_body : Result (Pair U32 U32) := Result.ret p3_c
def s3_c : Pair U32 U32 := eval_global s3_body (by simp)

/- [constants::S4]
   Source: 'src/constants.rs', lines 83:0-83:29 -/
def s4_body : Result (Pair U32 U32) := mk_pair1 7#u32 8#u32
def s4_c : Pair U32 U32 := eval_global s4_body (by simp)

end constants