#git branch S_1, S_2 re treated as sets , with the commits in em as the element of these sets
many of the git ops re just set theoretic element mapping ops ( read declaring set theoretic relationships amongst the subset of these elements)
for instance (rebase --onto) is defining a subset of S_1 e_i( if the re not a sequence of commits, one can cherry pick?) and moving them to S_2 ( or defining an onto relationship for e_1 between S_1 ,S_2)
A corresponding surjective function can be
a function from set A to set B is onto (surjective), : f:A→B such that for every element b∈B, there exists at least one element a∈A where f(a)=b. This can be denoted as ∀b∈B,∃a∈A such that f(a)=b
you can also write a #haskell function to do it ( untested)
```
import Data.List (nub)
-- Define a function type
type Function a b = a -> b
-- Check if a function is onto
isOnto :: (Eq b) => Function a b -> [a] -> [b] -> Bool
isOnto f domain codomain = all (`elem` mappedValues) codomain
where
mappedValues = nub (map f domain)
-- Example usage
main :: IO ()
main = do
let f :: Int -> Char
f x = if x `mod` 2 == 0 then 'A' else 'B' -- Example function
let domain = [1, 2, 3, 4] -- Set A
let codomain = ['A', 'B'] -- Set B
print $ isOnto f domain codomain -- Output: True
```
my point is you need to treat it as a #dsa problem till it's not
cc @abnv
the #math part of #swe
#todo list