1use crate::apply::PreparedRule;
8use crate::canon::{MSetCanon, VarCanon};
9use crate::config::EGraphConfig;
10use crate::containers::DenseId;
11use crate::containers::ShrinkPolicy;
12use crate::egraph::{EGraph, EGraphToken};
13use crate::lit_model::LitModel;
14use crate::literal::LitVal;
15use crate::sortcheck::{CCommand, CTerm};
16use crate::union_find::Justification;
17
18#[derive(Debug)]
20pub enum InterpError {
21 UnknownSort(String),
23 UnknownOp(String),
25 DeclError(String),
27 CompileError(crate::resolve::ResolveError),
29 CheckFailed(String),
31 ExtractFailed(crate::extract::ExtractError),
33 PopWithoutPush,
35}
36
37impl From<crate::resolve::ResolveError> for InterpError {
38 fn from(e: crate::resolve::ResolveError) -> Self {
39 InterpError::CompileError(e)
40 }
41}
42
43impl std::fmt::Display for InterpError {
44 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
45 match self {
46 InterpError::UnknownSort(s) => write!(f, "unknown sort: {s}"),
47 InterpError::UnknownOp(s) => write!(f, "unknown operator: {s}"),
48 InterpError::DeclError(s) => write!(f, "declaration error: {s}"),
49 InterpError::CompileError(e) => write!(f, "compile error: {e}"),
50 InterpError::CheckFailed(s) => write!(f, "check failed: {s}"),
51 InterpError::ExtractFailed(e) => write!(f, "extract failed: {e}"),
52 InterpError::PopWithoutPush => write!(f, "pop without matching push"),
53 }
54 }
55}
56
57fn parse_au_cycle_mode(value: &str) -> Result<crate::au::space::CycleMode, InterpError> {
58 match value {
59 "sides" => Ok(crate::au::space::CycleMode::AncestorOnly),
60 "sides-current" => Ok(crate::au::space::CycleMode::CurrentInclusive),
61 "pair" => Ok(crate::au::space::CycleMode::Pair),
62 other => Err(InterpError::CheckFailed(format!(
63 "unknown AU cycle mode '{other}' (expected sides, sides-current, or pair)"
64 ))),
65 }
66}
67
68struct Mark<Cfg: EGraphConfig, O> {
69 token: EGraphToken,
70 rules_len: usize,
71 globals_len: usize,
72 _phantom: std::marker::PhantomData<(Cfg, O)>,
73}
74
75#[derive(Clone, Copy, Debug, PartialEq, Eq, Default)]
104pub enum AcMode {
105 #[default]
106 Off,
107 Eager,
108 Lazy,
109}
110
111pub struct Interpreter<
112 Cfg: EGraphConfig,
113 L: LitVal,
114 M: LitModel<Value = L>,
115 const TRACK: bool,
116 const PROOFS: bool,
117> {
118 pub eg: EGraph<Cfg, L, TRACK, PROOFS>,
119 pub model: M,
120 rules: Vec<PreparedRule<Cfg::O, Cfg::S, L>>,
121 globals: crate::resolve::GlobalCtx<Cfg::S, Cfg::G>,
122 marks: Vec<Mark<Cfg, Cfg::O>>,
123 shrink_policy: ShrinkPolicy,
124 strategy: crate::saturate::SaturationStrategy,
125 ac_mode: AcMode,
126 lazy_ac_rounds: usize,
129 lazy_txn: Option<EGraphToken>,
133 last_sat: Option<crate::saturate::SatResult>,
136 last_run_time: Option<std::time::Duration>,
138 index_scratch: crate::index::IndexScratch<Cfg>,
149}
150
151impl<Cfg: EGraphConfig, L: LitVal, M: LitModel<Value = L>, const TRACK: bool, const PROOFS: bool>
152 Interpreter<Cfg, L, M, TRACK, PROOFS>
153where
154 Cfg::O: std::hash::Hash,
155 MSetCanon: VarCanon<Cfg::G, Cfg::C>,
156{
157 pub fn new(model: M) -> Self {
158 let eg = EGraph::from_model(&model);
159 Self {
160 eg,
161 model,
162 rules: Vec::new(),
163 globals: crate::resolve::GlobalCtx::new(),
164 marks: Vec::new(),
165 shrink_policy: ShrinkPolicy::Never,
166 strategy: crate::saturate::SaturationStrategy::default(),
167 ac_mode: AcMode::Off,
168 lazy_ac_rounds: 32,
169 lazy_txn: None,
170 last_sat: None,
171 last_run_time: None,
172 index_scratch: crate::index::IndexScratch::new(),
173 }
174 }
175
176 pub fn with_registries(
178 model: M,
179 sorts: crate::registry::SortRegistry<Cfg::S, TRACK>,
180 ops: crate::registry::OpRegistry<Cfg::O, Cfg::S, TRACK>,
181 ) -> Self {
182 let eg = EGraph::with_registries(sorts, ops);
183 Self {
184 eg,
185 model,
186 rules: Vec::new(),
187 globals: crate::resolve::GlobalCtx::new(),
188 marks: Vec::new(),
189 shrink_policy: ShrinkPolicy::Never,
190 strategy: crate::saturate::SaturationStrategy::default(),
191 ac_mode: AcMode::Off,
192 lazy_ac_rounds: 32,
193 lazy_txn: None,
194 last_sat: None,
195 last_run_time: None,
196 index_scratch: crate::index::IndexScratch::new(),
197 }
198 }
199
200 pub fn set_shrink_policy(&mut self, policy: ShrinkPolicy) {
202 self.shrink_policy = policy;
203 }
204
205 pub fn set_strategy(&mut self, strategy: crate::saturate::SaturationStrategy) {
207 self.strategy = strategy;
208 }
209
210 pub fn last_sat(&self) -> Option<&crate::saturate::SatResult> {
212 self.last_sat.as_ref()
213 }
214
215 pub fn last_run_time(&self) -> Option<std::time::Duration> {
218 self.last_run_time
219 }
220
221 pub fn set_cc(&mut self, enabled: bool) {
224 self.set_ac_mode(if enabled { AcMode::Eager } else { AcMode::Off });
225 }
226
227 pub fn set_ac_mode(&mut self, mode: AcMode) {
231 self.ac_mode = mode;
232 self.eg.set_cc(mode == AcMode::Eager);
233 }
234
235 pub fn set_lazy_ac_rounds(&mut self, rounds: usize) {
237 self.lazy_ac_rounds = rounds;
238 }
239
240 pub fn set_union_by(&mut self, u: crate::egraph::UnionBy) {
242 self.eg.set_union_by(u);
243 }
244
245 fn lazy_txn_open(&mut self) {
254 if self.lazy_txn.is_none() {
255 self.lazy_txn = Some(self.eg.mark(self.shrink_policy));
256 self.eg.set_cc(true);
257 }
258 }
259
260 fn lazy_txn_close(&mut self) {
262 if let Some(token) = self.lazy_txn.take() {
263 self.eg.set_cc(false);
264 self.eg.set_cc_goal(None);
265 self.eg.restore(token);
266 }
267 }
268
269 fn lazy_ac_decide(&mut self, a: Cfg::G, b: Cfg::G) -> (bool, bool) {
292 self.lazy_txn_open();
293 self.eg.set_cc_goal(Some((a, b)));
294 self.eg.rebuild();
295 let mut equal = self.eg.find(a) == self.eg.find(b);
296 let aborted = |eg: &EGraph<Cfg, L, TRACK, PROOFS>| {
297 matches!(
298 eg.completion_outcome(),
299 Some(crate::egraph::CompletionOutcome::AbortedGrowthLimit { .. })
300 )
301 };
302 let mut inconclusive = !equal && aborted(&self.eg);
303 if !equal && !inconclusive && !self.rules.is_empty() {
304 let spec = crate::saturate::RunSpec {
305 limit: self.lazy_ac_rounds,
306 ruleset: None,
307 until: Some(crate::saturate::RunGoal {
308 left: a,
309 right: b,
310 equal: true,
311 }),
312 };
313 let result = match self.strategy {
314 crate::saturate::SaturationStrategy::Naive => self.eg.saturate_spec_in(
315 &self.rules,
316 &self.model,
317 &spec,
318 &self.globals,
319 &mut self.index_scratch,
320 ),
321 crate::saturate::SaturationStrategy::SemiNaive => self.eg.saturate_semi_spec_in(
322 &self.rules,
323 &self.model,
324 &spec,
325 &self.globals,
326 &mut self.index_scratch,
327 ),
328 };
329 equal = self.eg.find(a) == self.eg.find(b);
330 inconclusive = !equal && (aborted(&self.eg) || !result.saturated);
331 }
332 self.eg.set_cc_goal(None);
333 (equal, inconclusive)
334 }
335
336 pub fn set_basis_checks(&mut self, enabled: bool) {
339 self.eg.set_basis_checks(enabled);
340 }
341
342 fn alloc_axiom_id(&mut self, lhs: Cfg::G, rhs: Cfg::G) -> crate::id::AxiomId {
343 let name = format!("axiom_{}", self.eg.axioms().len());
344 self.eg.register_axiom(&name, lhs, rhs)
345 }
346
347 fn bind_global(&mut self, name: String, id: Cfg::G, sort: Cfg::S) {
348 self.globals.insert(name, sort, id);
349 }
350
351 pub fn global(&mut self, name: &str) -> Option<(Cfg::G, Cfg::S)> {
353 self.globals
354 .get(name)
355 .map(|(_, sort, id)| (self.eg.find(id), sort))
356 }
357
358 pub fn run_checked(&mut self, cmds: &[CCommand<Cfg::O, Cfg::S, L>]) -> Result<(), InterpError> {
362 if cmds.iter().any(|c| matches!(c, CCommand::PrintStats(_))) {
366 crate::ematch::set_match_step_counting(true);
367 }
368 for cmd in cmds {
369 if !matches!(cmd, CCommand::CheckEq(..) | CCommand::CheckNeq(..)) {
376 self.lazy_txn_close();
377 }
378 let r = self.exec_checked(cmd);
379 if r.is_err() {
380 self.lazy_txn_close();
381 }
382 r?;
383 }
384 self.lazy_txn_close();
385 Ok(())
386 }
387
388 fn check_rule_mults(
392 name: &str,
393 rule: &PreparedRule<Cfg::O, Cfg::S, L>,
394 ) -> Result<(), InterpError> {
395 crate::apply::check_mult_literals::<Cfg, _, _, _>(rule).map_err(|n| {
396 InterpError::DeclError(format!(
397 "rule `{name}`: multiplicity literal {n} exceeds the configured \
398 multiplicity width (EGraphConfig::M holds at most {})",
399 <Cfg::M as crate::multiplicity::MultiplicityLike>::MAX
400 ))
401 })?;
402 crate::apply::check_rhs_mult_exprs(rule)
403 .map_err(|msg| InterpError::DeclError(format!("rule `{name}`: {msg}")))
404 }
405
406 fn exec_checked(&mut self, cmd: &CCommand<Cfg::O, Cfg::S, L>) -> Result<(), InterpError> {
407 match cmd {
408 CCommand::Decl(_) => {
409 }
411 CCommand::Let(name, ct) => {
412 let (id, sort) = self.build_cterm(ct);
413 self.bind_global(name.clone(), id, sort);
414 }
415 CCommand::Insert(ct) => {
416 self.build_cterm(ct);
417 }
418 CCommand::Union(a, b) => {
419 let (a_id, _) = self.build_cterm(a);
420 let (b_id, _) = self.build_cterm(b);
421 if PROOFS {
422 let axiom_id = self.alloc_axiom_id(a_id, b_id);
423 self.eg
424 .merge_justified(a_id, b_id, Justification::Axiom { axiom_id });
425 } else {
426 self.eg.merge(a_id, b_id);
427 }
428 self.eg.rebuild();
429 }
430 CCommand::Check(ct) => {
431 self.build_cterm(ct);
432 }
433 CCommand::CheckEq(a, b) => {
434 let (a_id, _) = self.build_cterm(a);
435 let (b_id, _) = self.build_cterm(b);
436 if self.ac_mode == AcMode::Lazy {
440 self.eg.set_cc_goal(Some((a_id, b_id)));
441 }
442 self.eg.rebuild();
447 if self.eg.find(a_id) != self.eg.find(b_id) {
448 if self.ac_mode == AcMode::Lazy {
449 match self.lazy_ac_decide(a_id, b_id) {
450 (true, _) => return Ok(()),
451 (false, aborted) => {
452 return Err(InterpError::CheckFailed(if aborted {
453 "terms are not equal (lazy AC completion hit its growth \
454 budget before deciding; inconclusive)"
455 .into()
456 } else {
457 "equality was not derived at the lazy AC operational \
458 fixpoint"
459 .into()
460 }));
461 }
462 }
463 }
464 return Err(InterpError::CheckFailed("terms are not equal".into()));
465 }
466 self.eg.set_cc_goal(None);
467 }
468 CCommand::CheckNeq(a, b) => {
469 let (a_id, _) = self.build_cterm(a);
470 let (b_id, _) = self.build_cterm(b);
471 if self.ac_mode == AcMode::Lazy {
472 self.eg.set_cc_goal(Some((a_id, b_id)));
473 }
474 self.eg.rebuild();
475 if self.eg.find(a_id) == self.eg.find(b_id) {
476 self.eg.set_cc_goal(None);
477 return Err(InterpError::CheckFailed("terms are equal".into()));
478 }
479 if self.ac_mode == AcMode::Lazy {
484 match self.lazy_ac_decide(a_id, b_id) {
485 (true, _) => {
486 return Err(InterpError::CheckFailed(
487 "terms are equal (derived by lazy AC completion)".into(),
488 ));
489 }
490 (false, true) => {
491 return Err(InterpError::CheckFailed(
492 "disequality is inconclusive (lazy AC completion hit its \
493 growth or alternation budget before deciding)"
494 .into(),
495 ));
496 }
497 (false, false) => {}
498 }
499 }
500 }
501 CCommand::Extract(ct) => {
502 let (id, _) = self.build_cterm(ct);
503 self.eg.rebuild();
506 match crate::extract::extract_best(&self.eg, id) {
510 Ok(t) => println!("{t}"),
511 Err(e) => return Err(InterpError::ExtractFailed(e)),
512 }
513 }
514 CCommand::Rewrite {
515 query,
516 rhs,
517 root_vid,
518 subsume,
519 ruleset,
520 } => {
521 let name = format!("rewrite_{}", self.eg.rules().len());
522 let rule_id = self.eg.register_rule(&name, "", "");
523 let compiled_rhs = crate::apply::compile_rhs(rhs);
524 let mut actions = vec![crate::apply::CompiledAction::Union(
525 rule_id,
526 crate::apply::RhsOp::FetchNode(*root_vid),
527 compiled_rhs,
528 )];
529 if *subsume {
530 actions.push(crate::apply::CompiledAction::Subsume(*root_vid));
531 }
532 let rule = PreparedRule {
533 rule_id,
534 query: query.clone(),
535 actions,
536 ruleset: *ruleset,
537 };
538 Self::check_rule_mults(&name, &rule)?;
539 self.rules.push(rule);
540 }
541 CCommand::Rule {
542 query,
543 actions,
544 ruleset,
545 } => {
546 let name = format!("rule_{}", self.eg.rules().len());
547 let rule_id = self.eg.register_rule(&name, "", "");
548 let compiled: Vec<_> = actions
549 .iter()
550 .map(|a| crate::apply::compile_action(a, rule_id))
551 .collect();
552 let rule = PreparedRule {
553 rule_id,
554 query: query.clone(),
555 actions: compiled,
556 ruleset: *ruleset,
557 };
558 Self::check_rule_mults(&name, &rule)?;
559 self.rules.push(rule);
560 }
561 CCommand::Run {
562 ruleset,
563 limit,
564 until,
565 } => {
566 let goal = match until {
570 None => None,
571 Some(g) => {
572 let before = self.eg.node_count();
573 let (l, _) = self.build_cterm(&g.left);
574 let (r, _) = self.build_cterm(&g.right);
575 if self.eg.node_count() > before {
576 self.eg.rebuild();
577 }
578 Some(crate::saturate::RunGoal {
579 left: l,
580 right: r,
581 equal: g.equal,
582 })
583 }
584 };
585 let spec = crate::saturate::RunSpec {
586 limit: *limit as usize,
587 ruleset: *ruleset,
588 until: goal,
589 };
590 let t0 = std::time::Instant::now();
591 let result = match self.strategy {
592 crate::saturate::SaturationStrategy::Naive => self.eg.saturate_spec_in(
593 &self.rules,
594 &self.model,
595 &spec,
596 &self.globals,
597 &mut self.index_scratch,
598 ),
599 crate::saturate::SaturationStrategy::SemiNaive => {
600 self.eg.saturate_semi_spec_in(
601 &self.rules,
602 &self.model,
603 &spec,
604 &self.globals,
605 &mut self.index_scratch,
606 )
607 }
608 };
609 self.last_run_time = Some(t0.elapsed());
610 self.last_sat = Some(result);
611 }
612 CCommand::PrintSize(op) => {
613 let counts = self.eg.op_node_counts();
614 match op {
615 Some(o) => println!("{}", counts[o.to_usize()]),
616 None => {
617 let mut total = 0;
620 for (name, n) in self.eg.ops().names().zip(counts.iter()) {
621 if *n > 0 {
622 println!("{name}: {n}");
623 }
624 total += n;
625 }
626 println!("total: {total}");
627 }
628 }
629 }
630 CCommand::PrintStats(file) => {
631 let stats = self.stats_snapshot();
632 match file {
633 None => print!("{}", stats.render_text()),
634 Some(path) => std::fs::write(path, stats.render_json()).map_err(|e| {
635 InterpError::DeclError(format!("print-stats :file '{path}': {e}"))
636 })?,
637 }
638 }
639 CCommand::Push(shrink) => {
640 let policy = if *shrink {
641 ShrinkPolicy::IfOverallocated {
642 factor: 4,
643 headroom: 2,
644 }
645 } else {
646 self.shrink_policy
647 };
648 self.marks.push(Mark {
649 token: self.eg.mark(policy),
650 rules_len: self.rules.len(),
651 globals_len: self.globals.len(),
652 _phantom: std::marker::PhantomData,
653 });
654 }
655 CCommand::AntiUnify {
656 left,
657 right,
658 playouts,
659 algorithm,
660 cycle_mode,
661 } => {
662 let (l_id, _) = self.build_cterm(left);
663 let (r_id, _) = self.build_cterm(right);
664 self.eg.rebuild();
665
666 let alg = match algorithm.as_str() {
667 "exact" => crate::au::session::AuAlgorithm::Exact,
668 "uct" => crate::au::session::AuAlgorithm::Uct,
669 other => {
670 return Err(InterpError::CheckFailed(format!(
671 "unknown AU algorithm '{other}' (expected exact or uct)"
672 )));
673 }
674 };
675
676 let snap = crate::au::egraph_api::AuSnapshot::new(&self.eg)
677 .map_err(|e| InterpError::CheckFailed(format!("{e}")))?;
678
679 let config = crate::au::session::AuConfig {
680 algorithm: alg,
681 cycle_mode: parse_au_cycle_mode(cycle_mode)?,
682 playouts: *playouts,
683 ..Default::default()
684 };
685
686 let result = crate::au::session::anti_unify(&snap, l_id, r_id, &config)
687 .map_err(|e| InterpError::CheckFailed(format!("{e}")))?;
688
689 let op_namer = |op: &crate::au::terms::TermOp<Cfg::O, Cfg::V>| match op {
690 crate::au::terms::TermOp::EGraph(o) => self.eg.ops().info(*o).name.clone(),
691 crate::au::terms::TermOp::Literal(_, v) => {
692 format!("{}", self.eg.lits().get(*v))
693 }
694 crate::au::terms::TermOp::Variants => "Variants".to_string(),
695 };
696 let rendered = result.pretty_print_with(op_namer, 80);
697 let cr = crate::au::session::compression_ratio(
698 &snap,
699 snap.class_of(l_id).unwrap(),
700 snap.class_of(r_id).unwrap(),
701 result.size,
702 );
703
704 let completion_status = match result.completion {
705 crate::au::session::Completion::Exact => "exact",
706 crate::au::session::Completion::BudgetExhausted { .. } => "budget",
707 };
708 println!(
709 "(anti-unify :size {} :cr {:.4} :completion {}\n {})",
710 result.size,
711 cr,
712 completion_status,
713 rendered.replace('\n', "\n ")
714 );
715 }
716 CCommand::CheckAu {
717 left,
718 right,
719 max_size,
720 playouts,
721 algorithm,
722 cycle_mode,
723 } => {
724 let (l_id, _) = self.build_cterm(left);
725 let (r_id, _) = self.build_cterm(right);
726 self.eg.rebuild();
727
728 let alg = match algorithm.as_str() {
729 "exact" => crate::au::session::AuAlgorithm::Exact,
730 "uct" => crate::au::session::AuAlgorithm::Uct,
731 other => {
732 return Err(InterpError::CheckFailed(format!(
733 "unknown AU algorithm '{other}' (expected exact or uct)"
734 )));
735 }
736 };
737
738 let snap = crate::au::egraph_api::AuSnapshot::new(&self.eg)
739 .map_err(|e| InterpError::CheckFailed(format!("{e}")))?;
740
741 let config = crate::au::session::AuConfig {
742 algorithm: alg,
743 cycle_mode: parse_au_cycle_mode(cycle_mode)?,
744 playouts: *playouts,
745 ..Default::default()
746 };
747
748 let result = crate::au::session::anti_unify(&snap, l_id, r_id, &config)
749 .map_err(|e| InterpError::CheckFailed(format!("{e}")))?;
750
751 if result.size > *max_size {
752 return Err(InterpError::CheckFailed(format!(
753 "anti-unifier size {} exceeds max_size {}",
754 result.size, max_size
755 )));
756 }
757 }
758 CCommand::Pop => {
759 let mark = self.marks.pop().ok_or(InterpError::PopWithoutPush)?;
760 self.eg.restore(mark.token);
761 self.rules.truncate(mark.rules_len);
762 self.globals.truncate(mark.globals_len);
763 }
764 }
765 Ok(())
766 }
767
768 fn stats_snapshot(&self) -> RunStats {
771 let sat = self.last_sat.as_ref();
772 RunStats {
773 nodes: self.eg.len(),
774 classes: self.eg.class_count(),
775 iterations: sat.map_or(0, |s| s.iterations),
776 match_steps: sat.map_or(0, |s| s.match_steps),
777 wall_time_ms: self.last_run_time.map_or(0.0, |d| d.as_secs_f64() * 1000.0),
778 saturated: sat.is_some_and(|s| s.saturated),
779 goal_met: sat.is_some_and(|s| s.goal_met),
780 }
781 }
782
783 fn build_cterm(&mut self, ct: &CTerm<Cfg::O, Cfg::S, L>) -> (Cfg::G, Cfg::S) {
786 match ct {
787 CTerm::Lit(val, sort) => {
788 let lit_op = self.eg.ops().lit_op_for_sort(*sort).unwrap();
789 let vid = self.eg.intern_lit(val.clone());
790 let id = self.eg.add_lit(lit_op, vid);
791 (id, *sort)
792 }
793 CTerm::App { op, sort, children } => {
794 let child_ids: Vec<Cfg::G> =
795 children.iter().map(|c| self.build_cterm(c).0).collect();
796 let id = self.eg.add(*op, &child_ids);
797 (id, *sort)
798 }
799 CTerm::Global(name, sort) => {
800 let (_, _, id) = self.globals.get(name).expect("global not found at runtime");
801 (self.eg.find(id), *sort)
802 }
803 }
804 }
805}
806
807#[derive(Clone, Copy, Debug, PartialEq)]
813pub struct RunStats {
814 pub nodes: usize,
815 pub classes: usize,
816 pub iterations: usize,
817 pub match_steps: u64,
818 pub wall_time_ms: f64,
819 pub saturated: bool,
820 pub goal_met: bool,
821}
822
823impl RunStats {
824 pub fn render_text(&self) -> String {
825 format!(
826 "nodes: {}\nclasses: {}\niterations: {}\nmatch-steps: {}\nwall-time-ms: {:.3}\n\
827 saturated: {}\ngoal-met: {}\n",
828 self.nodes,
829 self.classes,
830 self.iterations,
831 self.match_steps,
832 self.wall_time_ms,
833 self.saturated,
834 self.goal_met,
835 )
836 }
837
838 pub fn render_json(&self) -> String {
839 format!(
840 "{{\"nodes\":{},\"classes\":{},\"iterations\":{},\"match_steps\":{},\
841 \"wall_time_ms\":{:.3},\"saturated\":{},\"goal_met\":{}}}\n",
842 self.nodes,
843 self.classes,
844 self.iterations,
845 self.match_steps,
846 self.wall_time_ms,
847 self.saturated,
848 self.goal_met,
849 )
850 }
851}