<commit_before>#lang racket

(require casio/simplify/util)

(provide new-enode enode-merge!
	 enode-vars real-enode-vars enode-pid
	 enode? enode-flat-expr pick-matching-flat
	 enode-expr
	 pack-leader pack-members pack-real!)

;;################################################################################;;
;;# The mighty enode, one of the main lifeforms of this planet.
;;# Enodes are born solitary creatures, but can be merged to form a pack.
;;# Everytime two groups are merged, a leader is selected for the new pack
;;# from the leaders of the packs that were merged. A solitary
;;# enode is the leader of their own pack.
;;#
;;# The following things are always true of enode packs:
;;# 1. (enode-parent en) always returns either #f, or an enode that is
;;#    part of the same pack as en.
;;# 2. In each pack, there is exactly one enode for which (enode-parent en)
;;#    returns #f, and that enode is the leader of the pack.
;;# 3. The (enode-parent) pointers are non-cyclic, and always eventually
;;#    lead to the leader of the pack.
;;# 4. (enode-children en) is a list of enodes, for which each enode has a parent.
;;# 5. If en2 is the parent of en1, then en1 is one of the children of en2.
;;# 6. The enode-children links are also non-cyclic.
;;# 7. (enode-depth en) is a positive integer.
;;# 8. Solitary enodes have a depth of 1.
;;# 9. If en2 is the parent of en1, then (enode-depth en2) > (enode-depth en1)
;;# 10. If an enode is the leader of a pack of size n, then the depth of that
;;#     enode is at least log_2(n)
;;#
;;# The following things are true of enodes in general:
;;# 1. (enode-expr en) can take one of three forms:
;;#    a. a symbol
;;#    b. a number
;;#    c. a list starting with a symbol representing an operator,
;;#       and containing one or more enodes.
;;# 2. Each enode within a given context has a unique id-code.
;;#
;;################################################################################;;

(struct enode (expr id-code children parent depth real? flat-expr)
	#:mutable
	#:methods gen:custom-write
	[(define (write-proc en port mode)
	   (fprintf port "#<enode ~a(~a)>" (enode-pid en) (enode-id-code en)))]
	#:methods gen:equal+hash
	[(define (equal-proc en1 en2 recurs-equal?)
	   (eq? (pack-leader en1) (pack-leader en2)))
         (define (hash-proc en recurse-hash)<commit_msg>Weakened Invariant<commit_after>#lang racket

(require casio/simplify/util)

(provide new-enode enode-merge!
	 enode-vars real-enode-vars enode-pid
	 enode? enode-flat-expr pick-matching-flat
	 enode-expr
	 pack-leader pack-members pack-real!)

;;################################################################################;;
;;# The mighty enode, one of the main lifeforms of this planet.
;;# Enodes are born solitary creatures, but can be merged to form a pack.
;;# Everytime two groups are merged, a leader is selected for the new pack
;;# from the leaders of the packs that were merged. A solitary
;;# enode is the leader of their own pack.
;;#
;;# The following things are always true of enode packs:
;;# 1. (enode-parent en) always returns either #f, or an enode that is
;;#    part of the same pack as en.
;;# 2. In each pack, there is exactly one enode for which (enode-parent en)
;;#    returns #f, and that enode is the leader of the pack.
;;# 3. The (enode-parent) pointers are non-cyclic, and always eventually
;;#    lead to the leader of the pack.
;;# 4. (enode-children en) is a list of enodes, for which each enode has a parent.
;;# 5. If en2 is the parent of en1, then en1 has the same expression as one of the
;;#    children of en2.
;;# 6. The enode-children links are also non-cyclic.
;;# 7. (enode-depth en) is a positive integer.
;;# 8. Solitary enodes have a depth of 1.
;;# 9. If en2 is the parent of en1, then (enode-depth en2) > (enode-depth en1)
;;# 10. If an enode is the leader of a pack of size n, then the depth of that
;;#     enode is at least log_2(n)
;;#
;;# The following things are true of enodes in general:
;;# 1. (enode-expr en) can take one of three forms:
;;#    a. a symbol
;;#    b. a number
;;#    c. a list starting with a symbol representing an operator,
;;#       and containing one or more enodes.
;;# 2. Each enode within a given context has a unique id-code.
;;#
;;################################################################################;;

(struct enode (expr id-code children parent depth real? flat-expr)
	#:mutable
	#:methods gen:custom-write
	[(define (write-proc en port mode)
	   (fprintf port "#<enode ~a(~a)>" (enode-pid en) (enode-id-code en)))]
	#:methods gen:equal+hash
	[(define (equal-proc en1 en2 recurs-equal?)
	   (eq? (pack-leader en1) (pack-leader en2)))
         (define (hash-proc en recurse-hash)
{'fraction_non_alphanumeric': 0.18049090139652985, 'fraction_numerical': 0.011426153195090986, 'mean_word_length': 3.803861788617886, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1969131', 'n_tokens_mistral': 1539, 'n_tokens_neox': 1457, 'n_words': 650}